WO2022199291A1 - 生成应用层密钥 - Google Patents

生成应用层密钥 Download PDF

Info

Publication number
WO2022199291A1
WO2022199291A1 PCT/CN2022/076773 CN2022076773W WO2022199291A1 WO 2022199291 A1 WO2022199291 A1 WO 2022199291A1 CN 2022076773 W CN2022076773 W CN 2022076773W WO 2022199291 A1 WO2022199291 A1 WO 2022199291A1
Authority
WO
WIPO (PCT)
Prior art keywords
layer key
application layer
link layer
key
function
Prior art date
Application number
PCT/CN2022/076773
Other languages
English (en)
French (fr)
Inventor
黄琳
简云定
伏伟
曹鸿健
张婉桥
刘宇佳
Original Assignee
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Priority to EP22773953.9A priority Critical patent/EP4319222A1/en
Priority to US18/552,025 priority patent/US20240179517A1/en
Publication of WO2022199291A1 publication Critical patent/WO2022199291A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/04Key management, e.g. using generic bootstrapping architecture [GBA]
    • H04W12/041Key generation or derivation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/04Key management, e.g. using generic bootstrapping architecture [GBA]
    • H04W12/043Key management, e.g. using generic bootstrapping architecture [GBA] using a trusted network node as an anchor
    • H04W12/0431Key distribution or pre-distribution; Key agreement
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/50Secure pairing of devices
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Definitions

  • One or more embodiments of this specification relate to the field of Bluetooth technology, and in particular, to a method and apparatus for generating an application layer key.
  • Bluetooth technology is a radio technology that supports short-range communication between devices. Wireless data communication can be carried out between devices that establish a Bluetooth connection.
  • the application layer key pair can also be used at the application layer.
  • the communication data is encrypted to realize double-layer encryption of the communication data.
  • the application layer key is preset in the firmware of the Bluetooth device, and the preset application layer key in each Bluetooth device is the same, and the application layer key is easy to be reversely cracked by an attacker. Therefore, there is a need to provide a more reliable application layer key generation scheme.
  • One or more embodiments of this specification describe a method and apparatus for generating an application layer key, so as to reduce the possibility that the application layer key is cracked by an attacker.
  • a method for generating an application layer key comprising: determining a connection mode used when establishing a Bluetooth connection with an external Bluetooth device; determining an application layer key generation function according to the connection mode; The application layer key generation function determines the link layer dynamic parameters used in the link layer; obtains the application layer key identifier agreed with the external Bluetooth device; according to the application layer key generation function, the link layer The dynamic parameters and the application layer key identifier are used to generate the application layer key.
  • connection mode is: basic rate/enhanced data rate mode;
  • the determining the application layer key generation function according to the connection mode includes: the f2 function used when generating the link layer key, It is determined as an application layer key generation function;
  • the determining of the link layer dynamic parameters used at the link layer includes: determining the random number in each key parameter used by the f2 function when calculating the link layer key is the link layer dynamic parameter;
  • the generating the application layer key includes: replacing the link layer key identifier in each key parameter used by the f2 function when calculating the link layer key with the Application layer key identifier; use the f2 function to calculate each key parameter obtained after replacement to obtain the application layer key.
  • the application layer key identifier is different from the link layer key identifier.
  • the connection mode is: a basic rate/enhanced data rate mode, or a low power consumption mode; the determining an application layer key generation function according to the connection mode includes: determining the h6 function as the application layer key generation function; the determining the link layer dynamic parameters used at the link layer includes: acquiring the link layer key generated when the Bluetooth connection is established with an external Bluetooth device; converting the link layer key It is determined as the link layer dynamic parameter; the generating the application layer key includes: using the h6 function to calculate the application layer key identifier and the link layer key to obtain the application layer key key.
  • connection mode is the basic rate/enhanced data rate mode
  • link layer key is generated by using the f2 function and the link layer key identifier
  • application layer key identifier is the same as the The link layer key identifiers are the same or different.
  • the link layer key is generated by using the f5 function.
  • an apparatus for generating an application layer key comprising: a connection mode determination unit configured to determine a connection mode used when establishing a Bluetooth connection with an external Bluetooth device; an application layer key generation function determination unit, is configured to determine an application layer key generation function according to the connection mode; a link layer dynamic parameter acquisition unit is configured to determine a link layer dynamic parameter used at the link layer according to the application layer key generation function ;
  • the application layer key identification acquisition unit is configured to obtain the application layer key identification agreed with the external Bluetooth device;
  • the application layer key generation unit is configured to generate functions according to the application layer key, the chain
  • the road layer dynamic parameters and the application layer key identifier are used to generate the application layer key.
  • connection mode is: basic rate/enhanced data rate mode;
  • application layer key generation function determination unit is configured to: determine the f2 function used when generating the link layer key as the application layer key layer key generation function;
  • the link layer dynamic parameter obtaining unit is configured to: determine the random number in each key parameter used by the f2 function when calculating the link layer key as the link layer dynamic parameter;
  • the application layer key generation unit is configured to: replace the link layer key identifier in each key parameter used by the f2 function when calculating the link layer key with the application layer key identifier; use
  • the f2 function calculates each key parameter obtained after replacement to obtain the application layer key.
  • the application layer key identifier is different from the link layer key identifier.
  • connection mode is: basic rate/enhanced data rate mode, or low power consumption mode
  • the application layer key generation function determination unit is configured to: determine the h6 function as the application layer key generating function
  • the link layer dynamic parameter obtaining unit is configured to: obtain the link layer key generated when the Bluetooth connection is established with an external Bluetooth device; determine the link layer key as the link layer key dynamic parameters
  • the application layer key generation unit is configured to: use the h6 function to calculate the application layer key identifier and the link layer key to obtain the application layer key.
  • connection mode is the basic rate/enhanced data rate mode
  • link layer key is generated by using the f2 function and the link layer key identifier
  • application layer key identifier is the same as the The link layer key identifiers are the same or different.
  • the link layer key is generated by using the f5 function.
  • a computing device including a memory and a processor, where executable code is stored in the memory, and when the processor executes the executable code, the processor described in any embodiment of the present specification is implemented. method.
  • a Bluetooth device determines an application layer key generation function according to a connection mode used when establishing a Bluetooth connection with an external Bluetooth device, and according to the determined application layer key
  • the key generation function determines the link layer dynamic parameters used in the link layer, and generates the application layer key according to the application layer key generation function, the link layer dynamic parameters and the application layer key identifier agreed with the external Bluetooth device. Since the link layer dynamic parameters used by the link layer are dynamically generated, the application layer key generated by using the link layer dynamic parameters is also dynamically changed, so the possibility of the application layer key being cracked by attackers can be reduced. .
  • FIG. 1 is a schematic diagram of a system architecture to which a method for generating an application layer key provided by an embodiment of the present invention is applied;
  • FIG. 2 is a flowchart of a method for generating an application layer key provided by an embodiment of this specification
  • FIG. 3 is a schematic diagram of an apparatus for generating an application layer key provided by an embodiment of this specification.
  • the application layer key is written by the application developer, and the application layer key is preset in the firmware of the Bluetooth device or hard-coded in the application APP of the Bluetooth device.
  • the application layer key is fixed.
  • the preset application layer key in each Bluetooth device is the same. Once the attacker reverses it, the attacker can obtain the application layer key in each Bluetooth device, which will affect the security of data communication between Bluetooth devices. .
  • the application layer key can be generated by using functions to calculate some parameters, but it needs to be guaranteed. Both the two Bluetooth devices that establish the Bluetooth connection can learn the functions and parameters used to generate the application layer key each time.
  • the function used to generate the application layer key each time can be determined by the connection mode used each time a Bluetooth connection is established.
  • the parameters used to generate the application layer key if the parameters are generated by one of the Bluetooth devices and then distributed to another Bluetooth device, the distribution process is not only complicated, but also insecure. In this way, you can consider using the link layer dynamic parameters used by the link layer, because each time a Bluetooth connection is established, the link layer itself will generate link layer dynamic parameters, and the Bluetooth devices at both ends use the link layer parameters in the link layer.
  • the dynamic parameters of the road layer are the same. Therefore, if the dynamic parameters of the link layer used by the link layer are used as the parameters used to generate the application layer key, the parameter distribution process is not required, and the Bluetooth devices at both ends will learn about the link layer. Road layer dynamic parameters. Moreover, the dynamic parameters of the link layer are dynamically changed each time the Bluetooth is connected, so that the application layer key generated by using the dynamic parameters of the link layer is dynamically changed each time.
  • the system architecture mainly includes two Bluetooth devices.
  • one bluetooth device is a dragonfly host, and another bluetooth device is a bluetooth keyboard.
  • each bluetooth device is provided with a bluetooth chip, which is used to establish a bluetooth connection between the bluetooth chip and the bluetooth chip of another bluetooth device, and the two bluetooth devices that successfully establish a bluetooth connection can realize short-distance wireless data communication.
  • the Bluetooth device will encrypt the communication data once at the application layer and the link layer, respectively, and send the encrypted communication data twice to the Bluetooth device at the other end, and the Bluetooth device at the other end receives the encrypted communication. After the data is stored, the communication data will be obtained through corresponding two decryptions, so as to ensure the transmission security of the communication data. Since the link layer key is generated in the process of establishing the Bluetooth connection, the specific implementation process of the method for generating the application layer key is described below.
  • FIG. 2 shows a flowchart of a method of generating an application layer key according to one embodiment. It can be understood that the method can be performed by any apparatus, device, platform, or device cluster with computing and processing capabilities.
  • the specific implementation includes: Step 200: Determine the connection mode used when establishing a Bluetooth connection with an external Bluetooth device; Step 202: Determine an application layer key generation function according to the connection mode; Step 204: According to the The application layer key generation function is used to determine the link layer dynamic parameters used in the link layer; Step 206: Obtain the application layer key identifier agreed with the external Bluetooth device; Step 208: Generate according to the application layer key function, the link layer dynamic parameter and the application layer key identifier to generate the application layer key.
  • the Bluetooth device can determine the application layer key generation function according to the connection mode used when establishing the Bluetooth connection with the external Bluetooth device, and according to the determined application layer key generation function , determine the link layer dynamic parameters used in the link layer, and generate the application layer key according to the application layer key generation function, the link layer dynamic parameters and the application layer key identifier agreed with the external Bluetooth device. Since the link layer dynamic parameters used by the link layer are dynamically generated, the application layer key generated by using the link layer dynamic parameters is also dynamically changed, so the possibility of the application layer key being cracked by attackers can be reduced. . In addition, the link layer dynamic parameters used by the link layer are generated during the process of establishing a Bluetooth connection. Therefore, using the existing parameters as the parameters used to generate the application layer key can avoid complex parameters. distribution process.
  • step 200 a connection mode used when establishing a Bluetooth connection with an external Bluetooth device is determined.
  • Bluetooth connection There are many types of electronic devices that can realize Bluetooth connection, for example, mobile phones, tablet computers, laptop computers, cameras, mice, keyboards, wristbands, etc. Different types of devices use different connection modes when establishing a Bluetooth connection.
  • the determined connection modes of the Bluetooth connection may include two types: the first is a basic rate/enhanced data rate (BR/EDR) mode, and the second is a low energy consumption (LE) mode.
  • BR/EDR basic rate/enhanced data rate
  • LE low energy consumption
  • the BR/EDR mode is mainly used for audio and streaming media applications, which is based on a point-to-point network topology to create one-to-one device communication
  • the LE mode is mostly used for battery-operated devices, using point-to-point, broadcast, and network topology.
  • step 202 an application layer key generation function is determined according to the determined connection mode.
  • the application layer key generation function is used to generate an application layer key, and the generated application layer key needs to satisfy the following three conditions:
  • Condition 3 The application layer key generated each time is different from other keys used in this Bluetooth connection.
  • the two Bluetooth devices need to be able to know the application layer key generation function used each time, which can be determined by the connection mode used when establishing a Bluetooth connection with an external Bluetooth device.
  • the following two connection modes are as follows: The determined application layer key generation functions are described respectively.
  • connection mode is BR/EDR mode.
  • the calculation function in the Bluetooth standard can be directly used as the application layer key generation function.
  • the f2 function in the Bluetooth standard used when generating the link layer key or the h6 function in the Bluetooth standard can be used as the application layer key generation function , the two functions are described below.
  • Mode A The f2 function used when generating the link layer key is determined as the application layer key generation function.
  • the Bluetooth chip In the BR/EDR mode, after the Bluetooth chip establishes the Bluetooth connection, it will use the f2 function to generate the link layer key.
  • the expression of the f2 function is shown in the following formula (1):
  • LK is used to characterize the link layer key generated by the f2 function in BR/EDR mode
  • DHkey is the key generated by the Bluetooth chip in the process of establishing a Bluetooth connection
  • N_master is the master Bluetooth of the two Bluetooth devices that establish a Bluetooth connection.
  • the random number generated by the device, N_slave is the random number generated from the Bluetooth device in the two Bluetooth devices that establish the Bluetooth connection
  • "btlk” is the link layer key identifier
  • the length is 32bit
  • BD_ADDR_master is the two Bluetooth devices that establish the Bluetooth connection
  • the private address of the master bluetooth device, BD_ADDR_slave is the private address of the slave bluetooth device among the two bluetooth devices that establish a bluetooth connection.
  • the key parameters used when using the f2 function to calculate the link layer key include two random numbers N_master and N_slave. are randomly generated. Therefore, in this embodiment of the present specification, these two random numbers may be determined as link layer dynamic parameters used at the link layer in step 204 . Since the link layer dynamic parameter changes dynamically, when the application layer key is generated by using the f2 function and the link layer dynamic parameter in step 208, the generated application layer key can be made to change dynamically each time, thereby The above condition 1 is satisfied.
  • the key parameters used when using the f2 function to calculate the link layer key have been stored in the Bluetooth devices at both ends during the establishment of the Bluetooth connection. Therefore, the key parameter used in calculating the link layer key by using the f2 function can be used as the key parameter used in the application layer key generation function. In this way, there is no need to distribute the key parameters, and the Bluetooth devices at both ends can learn the key parameters used in the application-layer key generation function. And, the application layer key generation function is determined by the connection mode, so that the second condition above is satisfied.
  • the link layer key identifier "btlk" in the key parameter used by the f2 function to calculate the link layer key can be replaced with the application layer key identifier obtained in step 206, so that the f2
  • the key parameters used by the function to calculate the application layer key are different from the key parameters used to calculate the link layer key using the f2 function, so the generated application layer key will be different from the link layer key.
  • APP_AES_Key f2(DHkey,N_master,N_slave,KeyID,BD_ADDR_master,BD_ADDR_slave) (2)
  • APP_AES_Key is the application layer key generated by using the f2 function
  • KeyID is the application layer key identifier
  • Mode B Determine the h6 function as the application layer key generation function.
  • Key is used to represent the key generated by the h6 function
  • W is used to represent an encryption key
  • KeyID0 is a key identifier in the function, with a length of 32 bits.
  • the h6 function calculates the encryption key and the key identifier to generate the key Key, it may be considered to replace the key parameters used in the h6 function to generate the application layer key of the embodiment of this specification.
  • the key parameter can be replaced in the formula (3) to obtain the expression of the h6 function shown in the following formula (4):
  • App_AES_Key h6(LK,KeyID) (4)
  • APP_AES_Key is the application layer key generated by the h6 function
  • LK is the link layer key generated by using the f2 function and the link layer key identifier by formula (1) in BR/EDR mode
  • KeyID is the application layer key ID. key ID.
  • the key parameters used when using the h6 function to calculate the application layer key include the link layer key LK.
  • the parameters include two random numbers, so the link layer key LK generated each time a Bluetooth connection is established changes dynamically.
  • the link layer key may be determined as the link layer dynamic parameter used at the link layer in step 204 . Since the link layer dynamic parameter changes dynamically, when the application layer key is generated by using the h6 function and the link layer dynamic parameter in step 208, the generated application layer key can be made to change dynamically each time, thereby The above condition 1 is satisfied.
  • the Bluetooth devices at both ends generate and store the link layer key LK. Therefore, the link layer key is directly used as the key used in the application layer key generation function. key parameters, so that it is not necessary to distribute the key parameters, and the Bluetooth devices at both ends can learn the key parameters used in the application layer key generation function. And, the application layer key generation function is determined by the connection mode, so that the second condition above is satisfied.
  • the key parameters (LK, KeyID) used when using the h6 function to calculate the application layer key are different from the key parameters (W, KeyID0) used when the h6 function in the Bluetooth standard calculates the key. Therefore, the calculated The application layer key is not the same as the Key, so the above condition 3 is satisfied.
  • connection mode is LE mode.
  • At least the h6 function in the Bluetooth standard can be used as the application layer key generation function.
  • the key parameter can be replaced in the formula (3), and the expression of the h6 function shown in the following formula (5) can be obtained:
  • App_AES_Key h6(LTK,KeyID) (5)
  • APP_AES_Key is the application layer key generated by the h6 function
  • LTK is the link layer key generated by using the f5 function in the LE mode
  • KeyID is the application layer key identifier.
  • DHKey is the key generated in the process of establishing a Bluetooth connection by the Bluetooth chip
  • Na is a random number generated by the main Bluetooth device among the two Bluetooth devices that establish a Bluetooth connection
  • Nb is a Bluetooth device that is generated from the two Bluetooth devices that establish a Bluetooth connection.
  • the random number of , A is the private address of the master Bluetooth device in the two Bluetooth devices that establish a Bluetooth connection
  • B is the private address of the slave Bluetooth device in the two Bluetooth devices that establish a Bluetooth connection.
  • the key parameters used to calculate the application layer key using the h6 function include the link layer key LTK, which is calculated according to the above f5 function.
  • the key parameter used in calculating the link key is The key parameter includes two random numbers Na and Nb, so the link layer key LTK generated each time a Bluetooth connection is established changes dynamically.
  • the link layer key may be determined as the link layer dynamic parameter used at the link layer in step 204 . Since the link layer dynamic parameter changes dynamically, when the application layer key is generated by using the h6 function and the link layer dynamic parameter in step 208, the generated application layer key can be made to change dynamically each time, thereby The above condition 1 is satisfied.
  • the Bluetooth devices at both ends generate and store the link layer key LTK. Therefore, the link layer key is directly used as the key used in the application layer key generation function. key parameters, so that it is not necessary to distribute the key parameters, and the Bluetooth devices at both ends can learn the key parameters used in the application layer key generation function. And, the application layer key generation function is determined by the connection mode, so that the second condition above is satisfied.
  • the key parameters (LTK, KeyID) used when using the h6 function to calculate the application layer key are different from the key parameters (W, KeyID0) used when the h6 function in the Bluetooth standard calculates the key. Therefore, the calculated The application layer key is not the same as the Key, so the above condition 3 is satisfied.
  • step 204 the link layer dynamic parameters used at the link layer are determined according to the application layer key generation function.
  • step 202 if the determined application layer key generation function is different, the obtained link layer dynamic parameters are also different, specifically:
  • step 202 the f2 function used in generating the link layer key is determined to be the application layer key generation function, then in this step 204, each key used by the f2 function in calculating the link layer key is determined The random number in the parameter is determined as the link layer dynamic parameter.
  • step 202 If in step 202, the h6 function is determined to be the application layer key generation function, then in this step 24, first obtain the link layer key generated when the Bluetooth connection is established with the external Bluetooth device, and then the link layer key is obtained. The key is determined as the link layer dynamic parameter.
  • step 206 the application layer key identifier agreed with the external Bluetooth device is obtained.
  • the length of the link layer key identifier in the f2 function and the length of the key identifier in the h6 function are both 32 bits, so for ease of calculation, the length of the application layer key identifier may also be 32 bits.
  • the application layer key identification needs to be pre-agreed by two Bluetooth devices that establish a Bluetooth connection.
  • the application layer key identifier may be preset in the firmware of the Bluetooth device, or hard-coded in an application program installed on the Bluetooth device.
  • the Bluetooth device can obtain the preset application layer key identifier from firmware or hard coding.
  • the number of the preset application layer key identifiers may be one or more.
  • the two Bluetooth devices need to pre-agreed a selection rule for application layer key identifiers, so that the two Bluetooth devices select the same application layer key identifier.
  • step 202 it can be known from step 202 that the application layer key that needs to be generated satisfies at least the third condition above. Based on this, under the following two preconditions, the conditions that the application layer key identification needs to meet are different:
  • connection mode is the BR/EDR mode
  • application layer key generation function is the f2 function.
  • the condition that the application layer key identifier needs to meet is: the application layer key identifier is different from the link layer key identifier.
  • connection mode is BR/EDR mode
  • key generation function of the application layer is the h6 function.
  • the condition that the application layer key identifier needs to meet is: the application layer key identifier is the same or different from the link layer key identifier.
  • the functions used to calculate the application layer key and the link layer key are different under the second premise, no matter whether the application layer key identifier and the link layer key identifier are the same or different, the calculated application layer key The key is not the same as the link layer key.
  • an application layer key is generated according to the application layer key generation function, the link layer dynamic parameter and the application layer key identifier.
  • the application layer key generation function determined in step 202 is different, then the calculation process when generating the application layer key is different, specifically:
  • Case 1 The application layer key generation function is the f2 function.
  • step 204 the random number included in each key parameter used by the f2 function in calculating the link layer key is determined as the link layer dynamic parameter.
  • step 208 includes: replacing the link layer key identifier in each key parameter used by the f2 function when calculating the link layer key with the application layer key identifier; using the The f2 function calculates each key parameter obtained after replacement to obtain the application layer key.
  • Case 2 The application layer key generation function is the h6 function.
  • step 204 the link layer key generated when the Bluetooth connection is established with the external Bluetooth device is obtained; the link layer key is determined as the link layer dynamic parameter; accordingly, the implementation of step 208
  • the process includes: using the h6 function to calculate the application layer key identifier and the link layer key to obtain the application layer key.
  • the application layer key after the application layer key is generated, it can be stored in the Bluetooth device, so that the application layer key can be directly used during data communication between the Bluetooth devices.
  • an application layer key update mechanism can be implemented between two Bluetooth devices to update the application layer key, so that the update The application layer key after the update is different from the application layer key before the update. After the application layer key is updated, the Bluetooth device uses the updated application layer key to encrypt and decrypt the data to be communicated next.
  • the update mechanism of the application layer key is described below.
  • an update period can be set, and each time the set update period is reached, the application layer key is regenerated, and the regenerated application layer key is updated to the locally stored application layer key.
  • the link layer key needs to be regenerated, the application layer key is regenerated, and the regenerated application layer key is updated to the locally stored application layer key.
  • the application layer key can be recorded in the memory, the application layer key in the memory will be cleared after each restart of the Bluetooth device, and an application layer key needs to be regenerated at this time.
  • the Bluetooth device can determine the application layer key generation function according to the connection mode used when establishing the Bluetooth connection with the external Bluetooth device, and determine the application layer key generation function according to the determined application layer key generation function.
  • Link layer dynamic parameters Generate the application layer key according to the application layer key generation function, the link layer dynamic parameters and the application layer key identifier agreed with the external Bluetooth device. Since the link layer dynamic parameters used by the link layer are dynamically generated, the application layer key generated by using the link layer dynamic parameters is also dynamically changed, so the possibility of the application layer key being cracked by attackers can be reduced. . In addition, the link layer dynamic parameters used by the link layer are generated during the process of establishing a Bluetooth connection. Therefore, using the existing parameters as the parameters used to generate the application layer key can avoid complex parameters. distribution process.
  • FIG. 3 shows an apparatus for generating an application layer key according to an embodiment. It can be understood that the apparatus can be implemented by any apparatus, device, platform and device cluster having computing and processing capabilities. As shown in FIG.
  • the apparatus 30 includes: a connection mode determination unit 31 configured to determine a connection mode used when establishing a Bluetooth connection with an external Bluetooth device; an application layer key generation function determination unit 32 configured to The connection mode determines the application layer key generation function; the link layer dynamic parameter acquisition unit 33 is configured to determine the link layer dynamic parameters used at the link layer according to the application layer key generation function; the application layer key The identification acquisition unit 34 is configured to acquire the application layer key identification agreed with the external Bluetooth device; the application layer key generation unit 35 is configured to generate the function according to the application layer key, the link layer dynamic parameters and the application layer key identifier to generate an application layer key.
  • connection mode is: basic rate/enhanced data rate mode;
  • application layer key generation function determining unit is configured to: determine the f2 function used when generating the link layer key as: an application layer key generation function;
  • the link layer dynamic parameter obtaining unit is configured to: determine the random number in each key parameter used by the f2 function when calculating the link layer key as the link layer dynamic parameter
  • the application layer key generation unit is configured to: replace the link layer key identifier in each key parameter used by the f2 function when calculating the link layer key with the application layer key identifier;
  • the key parameters obtained after replacement are calculated by using the f2 function to obtain the application layer key.
  • the application layer key identifier is different from the link layer key identifier.
  • the connection mode is: basic rate/enhanced data rate mode, or low power consumption mode
  • the application layer key generation function determination unit is configured to: determine the h6 function as the application layer key. key generation function
  • the link layer dynamic parameter obtaining unit is configured to: obtain the link layer key generated when the Bluetooth connection is established with an external Bluetooth device; determine the link layer key as the link layer key layer dynamic parameters
  • the application layer key generation unit is configured to: use the h6 function to calculate the application layer key identifier and the link layer key to obtain the application layer key.
  • connection mode is the basic rate/enhanced data rate mode
  • link layer key is generated by using the f2 function and the link layer key identifier
  • application layer key identifier The same or different from the link layer key identifier.
  • the link layer key is generated by using the f5 function.
  • An embodiment of this specification provides a computing device, including a memory and a processor, the memory stores executable code, and when the processor executes the executable code, the execution of any one of the embodiments in the specification is implemented. method.
  • the structures illustrated in the embodiments of this specification do not constitute a specific limitation on the apparatus for generating the application layer key.
  • the apparatus for generating an application layer key may include more or less components than shown, or combine some components, or separate some components, or different component arrangements.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the functions described in the present invention may be implemented by hardware, software, pendants or any combination thereof.
  • the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本说明书实施例提供了一种生成应用层密钥的方法和装置。根据该实施例的方法,首先确定该与外部蓝牙设备建立蓝牙连接时使用的连接模式,然后根据确定的连接模式确定应用层密钥生成函数,然后获取在链路层使用的链路层动态参数,以及获取与外部蓝牙设备约定好的应用层密钥标识,通过利用该应用层密钥生成函数、链路层动态参数和应用层密钥标识,从而生成应用层密钥。

Description

生成应用层密钥 技术领域
本说明书一个或多个实施例涉及蓝牙技术领域,尤其涉及生成应用层密钥的方法和装置。
背景技术
蓝牙技术是一种支持设备短距离通信的无线电技术。建立蓝牙连接的设备之间可以进行无线数据通信,为保证通信数据的安全性,除了在链路层使用链路层密钥对通信数据进行加密以外,还可以在应用层利用应用层密钥对通信数据进行加密,以实现对通信数据的双层加密。
目前,该应用层密钥是预置在蓝牙设备的固件中的,且各个蓝牙设备内预置的应用层密钥相同,应用层密钥容易被攻击者逆向破解。因此,需要提供一种更可靠的应用层密钥生成方案。
发明内容
本说明书一个或多个实施例描述了一种生成应用层密钥的方法和装置,以降低应用层密钥被攻击者破解的可能性。
根据第一方面,提供了一种生成应用层密钥的方法,包括:确定与外部蓝牙设备建立蓝牙连接时使用的连接模式;根据所述连接模式,确定应用层密钥生成函数;根据所述应用层密钥生成函数,确定在链路层使用的链路层动态参数;获取与所述外部蓝牙设备约定的应用层密钥标识;根据所述应用层密钥生成函数、所述链路层动态参数和所述应用层密钥标识,生成应用层密钥。
在一个实施例中,所述连接模式为:基本速率/增强数据速率模式;所述根据所述连接模式确定应用层密钥生成函数,包括:将生成链路层密钥时使用的f2函数,确定为应用层密钥生成函数;所述确定在链路层使用的链路层动态参数,包括:将所述f2函数在计算链路层密钥时使用的各密钥参数中的随机数确定为所述链路层动态参数;所述生成应用层密钥,包括:将所述f2函数在计算链路层密钥时使用的各密钥参数中的链路层密钥标识替换为所述应用层密钥标识;利用所述f2函数对替换后得到的各密钥参数进行计算,得到所述应用层密钥。
在一个实施例中,所述应用层密钥标识与所述链路层密钥标识不相同。
在一个实施例中,所述连接模式为:基本速率/增强数据速率模式,或者低功耗模式;所述根据所述连接模式确定应用层密钥生成函数,包括:将h6函数,确定为应用层密钥生成函数;所述确定在链路层使用的链路层动态参数,包括:获取与外部蓝牙设备建立所述蓝牙连接时生成的链路层密钥;将所述链路层密钥确定为所述链路层动态参数;所述生成应用层密钥,包括:利用所述h6函数对所述应用层密钥标识和所述链路层密钥进行计算,得到所述应用层密钥。
在一个实施例中,当所述连接模式为基本速率/增强数据速率模式时;所述链路层密钥是利用f2函数以及链路层密钥标识生成的;所述应用层密钥标识与所述链路层密钥标识相同或不相同。
在一个实施例中,当所述连接模式为低功耗模式时;所述链路层密钥是利用f5函数生成的。
第二方面,还提供了一种生成应用层密钥的装置,包括:连接模式确定单元,被配置为确定与外部蓝牙设备建立蓝牙连接时使用的连接模式;应用层密钥生成函数确定单元,被配置为根据所述连接模式,确定应用层密钥生成函数;链路层动态参数获取单元,被配置为根据所述应用层密钥生成函数,确定在链路层使用的链路层动态参数;应用层密钥标识获取单元,被配置为获取与所述外部蓝牙设备约定的应用层密钥标识;应用层密钥生成单元,被配置为根据所述应用层密钥生成函数、所述链路层动态参数和所述应用层密钥标识,生成应用层密钥。
在一个实施例中,所述连接模式为:基本速率/增强数据速率模式;所述应用层密钥生成函数确定单元被配置为:将生成链路层密钥时使用的f2函数,确定为应用层密钥生成函数;链路层动态参数获取单元被配置为:将所述f2函数在计算链路层密钥时使用的各密钥参数中的随机数确定为所述链路层动态参数;所述应用层密钥生成单元被配置为:将所述f2函数在计算链路层密钥时使用的各密钥参数中的链路层密钥标识替换为所述应用层密钥标识;利用所述f2函数对替换后得到的各密钥参数进行计算,得到所述应用层密钥。
在一个实施例中,所述应用层密钥标识与所述链路层密钥标识不相同。
在一个实施例中,所述连接模式为:基本速率/增强数据速率模式,或者低功耗模式;所述应用层密钥生成函数确定单元被配置为:将h6函数,确定为应用层密钥生成函数;所述链路层动态参数获取单元被配置为:获取与外部蓝牙设备建立所述蓝牙连接时生成的链路层密钥;将所述链路层密钥确定为所述链路层动态参数;所述应用层密钥生成单元被配置为:利用所述h6函数对所述应用层密钥标识和所述链路层密钥进行计算,得 到所述应用层密钥。
在一个实施例中,当所述连接模式为基本速率/增强数据速率模式时;所述链路层密钥是利用f2函数以及链路层密钥标识生成的;所述应用层密钥标识与所述链路层密钥标识相同或不相同。
在一个实施例中,当所述连接模式为低功耗模式时;所述链路层密钥是利用f5函数生成的。
根据第三方面,提供了一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现本说明书任一实施例所述的方法。
在本说明书实施例提供的一种生成应用层密钥的方法和装置,蓝牙设备根据与外部蓝牙设备建立蓝牙连接时使用的连接模式,确定应用层密钥生成函数,并根据确定的应用层密钥生成函数,确定在链路层使用的链路层动态参数,根据应用层密钥生成函数、链路层动态参数和与与外部蓝牙设备约定的应用层密钥标识,生成应用层密钥。由于链路层使用的链路层动态参数是动态生成的,因此,利用该链路层动态参数生成的应用层密钥也是动态变化的,所以可以降低应用层密钥被攻击者破解的可能性。
附图说明
为了更清楚地说明本说明书实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本说明书的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明一个实施例提供的生成应用层密钥的方法所应用的***架构的示意图;
图2是本说明书一个实施例提供的生成应用层密钥的方法的流程图;
图3是本说明书一个实施例提供的生成应用层密钥的装置的示意图。
具体实施方式
下面结合附图,对本说明书提供的方案进行描述。
目前,应用层密钥是由应用开发者编写,并将该应用层密钥预置在蓝牙设备的固件中或者硬编码在蓝牙设备的应用APP中,该应用层密钥是固定不变的,且各个蓝牙设备内预置的应用层密钥相同,一旦被攻击者逆向破解出来,攻击者就可以获取到各个蓝牙设备内的应用层密钥,对蓝牙设备之间数据通信的安全性造成影响。
如果需要提高蓝牙设备之间数据通信的安全性,可以考虑每次生成的应用层密钥是动态变化的,该应用层密钥可以通过使用函数对一些参数进行计算的方式来生成,但需要保证建立蓝牙连接的两个蓝牙设备都能够获知到每一次生成应用层密钥所使用的的函数和参数。
其中,每一次生成应用层密钥所使用的的函数,可以通过每次建立蓝牙连接时使用的连接模式来确定。
而对于生成应用层密钥所使用的参数,如果由其中一个蓝牙设备生成该参数后,再分发给另一个蓝牙设备,该分发过程不仅复杂,而且不安全。如此,可以考虑利用链路层使用的链路层动态参数,因为在每次建立蓝牙连接时,链路层本身就会产生链路层动态参数,且两端的蓝牙设备在链路层使用的链路层动态参数相同,因此,如果将该链路层使用的链路层动态参数作为生成应用层密钥时所使用的参数,不需要参数的分发过程,两端的蓝牙设备就会获知到该链路层动态参数。并且,每一次蓝牙连接时该链路层动态参数都是动态变化的,从而可以满足每次使用链路层动态参数生成的应用层密钥是动态变化的。
下面描述以上构思的具体实现方式。
为了方便对本说明书的理解,首先对本说明书所应用的***架构进行描述。如图1中所示,该***架构主要包括两个蓝牙设备。比如,一个蓝牙设备是蜻蜓主机,另一个蓝牙设备是蓝牙键盘。
其中,每一个蓝牙设备中均设置有蓝牙芯片,用于利用该蓝牙芯片与另一个蓝牙设备的蓝牙芯片之间建立蓝牙连接,成功建立蓝牙连接的两个蓝牙设备之间可以实现短距离的无线数据通信。在无线数据通信过程中,蓝牙设备会在应用层和链路层分别对通信数据进行一次加密,将两次加密后的通信数据发送给另一端蓝牙设备,另一端蓝牙设备在接收到加密的通信数据后,会通过对应的两次解密来获取到该通信数据,从而保证通信数据的传输安全性。由于链路层密钥是在建立蓝牙连接的过程中生成的,下面描述生成应用层密钥的方法的具体实现过程。
图2示出根据一个实施例的生成应用层密钥的方法的流程图。可以理解,该方法可以通过任何具有计算、处理能力的装置、设备、平台、设备集群来执行。参见图2,此后,具体的实现包括:步骤200:确定与外部蓝牙设备建立蓝牙连接时使用的连接模式;步骤202:根据所述连接模式,确定应用层密钥生成函数;步骤204:根据所述应用层密钥生成函数,确定在链路层使用的链路层动态参数;步骤206:获取与所述外部蓝牙设备约定的应用层密钥标识;步骤208:根据所述应用层密钥生成函数、所述链路层动 态参数和所述应用层密钥标识,生成应用层密钥。
在图2所示的生成应用层密钥的方法中,蓝牙设备可以根据与外部蓝牙设备建立蓝牙连接时使用的连接模式,确定应用层密钥生成函数,并根据确定的应用层密钥生成函数,确定在链路层使用的链路层动态参数,根据应用层密钥生成函数、链路层动态参数和与外部蓝牙设备约定的应用层密钥标识,生成应用层密钥。由于链路层使用的链路层动态参数是动态生成的,因此,利用该链路层动态参数生成的应用层密钥也是动态变化的,所以可以降低应用层密钥被攻击者破解的可能性。并且,该链路层使用的链路层动态参数是在建立蓝牙连接的过程中本身就会产生的,因此,将该已有参数作为生成应用层密钥所使用的参数,可以避免复杂的参数分发过程。
下面描述图2所示的各个步骤的实现方式。
在步骤200,确定与外部蓝牙设备建立蓝牙连接时使用的连接模式。
可以实现蓝牙连接的电子设备有很多类型,例如,手机、平板电脑、笔记本电脑、相机、鼠标、键盘、手环等。不同类型的设备在建立蓝牙连接时使用的连接模式不同。
本步骤中,确定出的蓝牙连接的连接模式可以包括两种:第一种是基础速率/增强数据速率(BR/EDR)模式,第二种是低耗能(LE)模式。其中,BR/EDR模式主要用于音频和流媒体应用,是以点对点网络拓扑结构创建一对一设备通信;LE模式多用于依靠电池工作的设备,使用点对点、广播和网络等多种网络拓扑结构。
在步骤202,根据确定出的连接模式,确定应用层密钥生成函数。
在本说明书实施例中,该应用层密钥生成函数是用来生成应用层密钥的,而生成的应用层密钥需要满足如下三个条件:
条件一、每次生成的应用层密钥是动态变化的。
条件二、两个蓝牙设备需要能够获知到每一次使用的应用层密钥生成函数以及应用层密钥生成函数中使用的密钥参数。
条件三、每次生成的应用层密钥与本次蓝牙连接中使用的其他密钥不相同。
其中,上述条件二中两个蓝牙设备需要能够获知到每一次使用的应用层密钥生成函数,可以通过与外部蓝牙设备建立蓝牙连接时使用的连接模式来确定,下面针对上述两种连接模式,分别对确定的应用层密钥生成函数进行说明。
一、连接模式为BR/EDR模式。
由于蓝牙标准中存在有多个计算函数,为节省研发成本,可以直接使用蓝牙标准中 的计算函数来作为应用层密钥生成函数。在本说明书的一个实施例中,在该BR/EDR模式下,至少可以将蓝牙标准中的生成链路层密钥时使用的f2函数或将蓝牙标准中的h6函数作为应用层密钥生成函数,下面针对这两种函数分别进行说明。
方式A:将生成链路层密钥时使用的f2函数确定为应用层密钥生成函数。
在该BR/EDR模式下,蓝牙芯片在建立蓝牙连接完成后,会使用f2函数生成链路层密钥,该f2函数的表达式如下式(1)所示:
LK=f2(DHkey,N_master,N_slave,"btlk",BD_ADDR_master,BD_ADDR_slave)  (1)
其中,LK用于表征在BR/EDR模式下利用f2函数生成的链路层密钥,DHkey是蓝牙芯片建立蓝牙连接过程中生成的密钥,N_master是建立蓝牙连接的两个蓝牙设备中主蓝牙设备生成的随机数,N_slave是建立蓝牙连接的两个蓝牙设备中从蓝牙设备生成的随机数,"btlk"为链路层密钥标识,长度为32bit,BD_ADDR_master是建立蓝牙连接的两个蓝牙设备中主蓝牙设备的私有地址,BD_ADDR_slave是建立蓝牙连接的两个蓝牙设备中从蓝牙设备的私有地址。
根据上述f2函数的表达式可知,在利用f2函数计算链路层密钥时使用的密钥参数中包括两个随机数N_master和N_slave,由于这两个随机数是在每一次建立蓝牙连接过程中随机生成的,因此,在本说明书实施例中,可以将这两个随机数确定为步骤204中的在链路层使用的链路层动态参数。由于该链路层动态参数是动态变化的,那么在步骤208中利用f2函数和该链路层动态参数生成应用层密钥时,可以使得每次生成的应用层密钥是动态变化的,从而满足了上述条件一。
另外,在利用f2函数计算链路层密钥时使用的密钥参数,均已经在蓝牙连接建立过程中存储在了两端的蓝牙设备中。因此,可以将该利用f2函数计算链路层密钥时使用的密钥参数作为应用层密钥生成函数中所使用的的密钥参数。如此,不需要对密钥参数进行分发,两端的蓝牙设备就能够获知到应用层密钥生成函数中所使用的密钥参数。以及,应用层密钥生成函数通过连接模式来确定,从而满足了上述条件二。
可以理解,如果生成的应用层密钥与本次蓝牙连接中使用的其他密钥相同,比如,与链路层密钥相同,那么对通信数据使用两个相同的密钥进行加密,其安全性会受到影响,因此,可以将f2函数在计算链路层密钥时使用的密钥参数中的链路层密钥标识“btlk”替换为步骤206中获取的应用层密钥标识,使得利用f2函数在计算应用层密钥时使用的密钥参数与在利用f2函数计算链路层密钥时使用的密钥参数不同,那么生成的应用层密钥就会与链路层密钥不相同,从而满足了上述条件三。
基于上述描述,可以得出该应用层密钥生成函数的表达式如下式(2)所示:
APP_AES_Key=f2(DHkey,N_master,N_slave,KeyID,BD_ADDR_master,BD_ADDR_slave)  (2)
其中,APP_AES_Key为利用f2函数生成的应用层密钥,KeyID为应用层密钥标识。
方式B:将h6函数确定为应用层密钥生成函数。
在蓝牙标准中存在一个h6函数,该h6函数的表达式如下式(3)所示:
Key=h6(W,KeyID0)   (3)
其中,Key用于表征利用h6函数生成的密钥,W用于表征一个加密密钥,KeyID0是该函数中的一个密钥标识,长度为32bit。
由于该h6函数是对加密密钥和密钥标识进行计算生成密钥Key,那么可以考虑将该h6函数中使用的密钥参数进行更换,来生成本说明书实施例的应用层密钥,在本说明书实施例中,可以对式(3)进行密钥参数的更换,得到如下式(4)所示的h6函数的表达式:
App_AES_Key=h6(LK,KeyID)   (4)
其中,APP_AES_Key为利用h6函数生成的应用层密钥,LK为在BR/EDR模式下通过式(1)利用f2函数以及链路层密钥标识生成的链路层密钥,KeyID为应用层密钥标识。
在利用该h6函数计算应用层密钥时使用的密钥参数中包括链路层密钥LK,根据对上述方式A的描述可知,由于在利用f2函数计算链路层密钥时使用的密钥参数中包括两个随机数,因此每一次建立蓝牙连接时生成的链路层密钥LK是动态变化的。在本说明书实施例中,可以将该链路层密钥确定为步骤204中的在链路层使用的链路层动态参数。由于该链路层动态参数是动态变化的,那么在步骤208中利用h6函数和该链路层动态参数生成应用层密钥时,可以使得每次生成的应用层密钥是动态变化的,从而满足了上述条件一。
另外,在每次建立蓝牙连接过程中,两端的蓝牙设备均生成并存储了该链路层密钥LK,因此,直接将该链路层密钥作为应用层密钥生成函数中所使用的的密钥参数,从而可以不需要对密钥参数进行分发,两端的蓝牙设备就能够获知到应用层密钥生成函数中所使用的密钥参数。以及,应用层密钥生成函数通过连接模式来确定,从而满足了上述条件二。
可以理解,在利用h6函数计算应用层密钥时使用的密钥参数(LK、KeyID)与蓝 牙标准中h6函数计算Key时使用的密钥参数(W、KeyID0)不相同,因此,计算得到的应用层密钥与Key不相同,从而满足了上述条件三。
二、连接模式为LE模式。
在本说明书实施例中,在该LE模式下,至少可以将蓝牙标准中的h6函数作为应用层密钥生成函数。
根据对连接模式为BR/EDR模式下的方式B的描述可知,可以对式(3)进行密钥参数的更换,得到得到如下式(5)所示的h6函数的表达式:
App_AES_Key=h6(LTK,KeyID)   (5)
其中,APP_AES_Key为利用h6函数生成的应用层密钥,LTK为在LE模式下利用f5函数生成的链路层密钥,KeyID为应用层密钥标识。
其中,f5函数的表达式如下式(6)所示:
LTK=f5(DHKey,Na,Nb,A,B)    (6)
其中,DHKey为蓝牙芯片建立蓝牙连接过程中生成的密钥,Na是建立蓝牙连接的两个蓝牙设备中主蓝牙设备生成的随机数,Nb是建立蓝牙连接的两个蓝牙设备中从蓝牙设备生成的随机数,A是建立蓝牙连接的两个蓝牙设备中主蓝牙设备的私有地址,B是建立蓝牙连接的两个蓝牙设备中从蓝牙设备的私有地址。
在利用该h6函数计算应用层密钥时使用的密钥参数中包括链路层密钥LTK,是根据上述f5函数计算得到的,根据f5函数可知,在计算该链路密钥时使用的密钥参数中包括两个随机数Na和Nb,因此每一次建立蓝牙连接时生成的链路层密钥LTK是动态变化的。在本说明书实施例中,可以将该链路层密钥确定为步骤204中的在链路层使用的链路层动态参数。由于该链路层动态参数是动态变化的,那么在步骤208中利用h6函数和该链路层动态参数生成应用层密钥时,可以使得每次生成的应用层密钥是动态变化的,从而满足了上述条件一。
另外,在每次建立蓝牙连接过程中,两端的蓝牙设备均生成并存储了该链路层密钥LTK,因此,直接将该链路层密钥作为应用层密钥生成函数中所使用的的密钥参数,从而可以不需要对密钥参数进行分发,两端的蓝牙设备就能够获知到应用层密钥生成函数中所使用的密钥参数。以及,应用层密钥生成函数通过连接模式来确定,从而满足了上述条件二。
可以理解,在利用h6函数计算应用层密钥时使用的密钥参数(LTK、KeyID)与蓝牙标准中h6函数计算Key时使用的密钥参数(W、KeyID0)不相同,因此,计算得到 的应用层密钥与Key不相同,从而满足了上述条件三。
在步骤204,根据应用层密钥生成函数,确定在链路层使用的链路层动态参数。
在本说明书实施例中,在步骤202中,确定的应用层密钥生成函数不同,那么获取的该链路层动态参数也不同,具体地:
如果在步骤202中,将生成链路层密钥时使用的f2函数确定为了应用层密钥生成函数,那么在本步骤204中,将f2函数在计算链路层密钥时使用的各密钥参数中的随机数确定为该链路层动态参数。
如果在步骤202中,将h6函数确定为了应用层密钥生成函数,那么在本步骤24中,首先获取与外部蓝牙设备建立蓝牙连接时生成的链路层密钥,然后将该链路层密钥确定为该链路层动态参数。
在步骤206,获取与外部蓝牙设备约定的应用层密钥标识。
根据步骤202可知,f2函数中的链路层密钥标识的长度以及h6函数中的密钥标识的长度均为32bit,那么为了便于计算,该应用层密钥标识的长度也可以为32bit。
在本说明书实施例中,该应用层密钥标识需要建立蓝牙连接的两个蓝牙设备预先约定好。例如,在一个可以实现的方式中,可以将应用层密钥标识预置在蓝牙设备的固件中,或者硬编码在蓝牙设备上安装的应用程序中。蓝牙设备可以从固件或硬编码中获取到该预置的应用层密钥标识。
在本说明书实施例中,该预置的应用层密钥标识的个数可以为一个或多个。在预置的应用层密钥标识为多个时,两个蓝牙设备就需要预先约定好应用层密钥标识的选取规则,以使两个蓝牙设备选择相同的应用层密钥标识。
根据步骤202中可知,需要生成的应用层密钥至少满足上述条件三。基于此,在如下两种前提下,应用层密钥标识需要满足的条件不同:
前提一,连接模式为BR/EDR模式,且应用层密钥生成函数为f2函数。
在该前提一下,应用层密钥标识需要满足的条件为:应用层密钥标识与链路层密钥标识不相同。
只有在应用层密钥标识与链路层密钥标识不相同时,在利用f2函数计算应用层密钥和链路层密钥时,所使用的密钥参数不完全相同,如此,生成的应用层密钥和链路层密钥不相同。
前提二,连接模式为BR/EDR模式,且应用层密钥生成函数为h6函数。
在该前提二下,应用层密钥标识需要满足的条件为:应用层密钥标识与链路层密钥标识相同或不相同。
由于在该前提二下,计算应用层密钥和计算链路层密钥使用的函数不同,因此,无论应用层密钥标识与链路层密钥标识相同还是不相同,计算得到的应用层密钥与链路层密钥都不相同。
在步骤208,根据所述应用层密钥生成函数、所述链路层动态参数和所述应用层密钥标识,生成应用层密钥。
在本说明书实施例中,步骤202中确定的应用层密钥生成函数不同,那么在生成应用层密钥时的计算过程不同,具体地:
情况一:应用层密钥生成函数为f2函数。
此种情况下,在步骤204中,是将f2函数在计算链路层密钥时使用的各密钥参数中包括的随机数确定为链路层动态参数。
相应地,步骤208的实现过程包括:将所述f2函数在计算链路层密钥时使用的各密钥参数中的链路层密钥标识替换为所述应用层密钥标识;利用所述f2函数对替换后得到的各密钥参数进行计算,得到所述应用层密钥。
情况二:应用层密钥生成函数为h6函数。
此种情况下,在步骤204中,是获取与外部蓝牙设备建立蓝牙连接时生成的链路层密钥;将链路层密钥确定为该链路层动态参数;相应地,步骤208的实现过程包括:利用h6函数对应用层密钥标识和链路层密钥进行计算,得到应用层密钥。
以上完成了应用层密钥的生成过程。
在本说明书实施例中,应用层密钥在生成之后,可以存储在蓝牙设备中,以便蓝牙设备之间在数据通信时可以直接使用该应用层密钥。
而为了进一步提高数据通信的安全性,降低被攻击者破解的可能性,两个蓝牙设备之间可以执行一种应用层密钥的更新机制,以实现对应用层密钥的更新,以使更新后的应用层密钥与更新前的应用层密钥不同,在对应用层密钥更新后,蓝牙设备使用更新后的应用层密钥对接下来进行通信的数据进行加密解密。下面对应用层密钥的更新机制进行说明。
对应用层密钥进行更新的方式至少可以包括如下三种;
方式1、周期性更新。
在该方式下,可以设定一个更新周期,每当达到设定的更新周期后,则重新生成应用层密钥,将重新生成的应用层密钥对本地存储的应用层密钥进行更新。
方式2、跟随链路层密钥的更新机制。
在该方式下,每当链路层密钥需要重新生成时,则重新生成应用层密钥,并将重新生成的应用层密钥对本地存储的应用层密钥进行更新。
方式3、蓝牙设备重启后更新。
在该方式下,可以将应用层密钥记录在内存中,蓝牙设备在每次重启后该内存中的应用层密钥会被清除,此时就需要重新生成一个应用层密钥。
在上述说明书实施例中,蓝牙设备可以根据与外部蓝牙设备建立蓝牙连接时使用的连接模式,确定应用层密钥生成函数,并根据确定的应用层密钥生成函数,确定在链路层使用的链路层动态参数,根据应用层密钥生成函数、链路层动态参数和与外部蓝牙设备约定的应用层密钥标识,生成应用层密钥。由于链路层使用的链路层动态参数是动态生成的,因此,利用该链路层动态参数生成的应用层密钥也是动态变化的,所以可以降低应用层密钥被攻击者破解的可能性。并且,该链路层使用的链路层动态参数是在建立蓝牙连接的过程中本身就会产生的,因此,将该已有参数作为生成应用层密钥所使用的参数,可以避免复杂的参数分发过程。
另一方面的实施例,还提供了一种生成应用层密钥的装置。如图3示出一个实施例的生成应用层密钥的装置。可以理解,该装置可以通过任何具有计算、处理能力的装置、设备、平台和设备集群来实现。如图3所示,该装置30包括:连接模式确定单元31,被配置为确定与外部蓝牙设备建立蓝牙连接时使用的连接模式;应用层密钥生成函数确定单元32,被配置为根据所述连接模式,确定应用层密钥生成函数;链路层动态参数获取单元33,被配置为根据所述应用层密钥生成函数,确定在链路层使用的链路层动态参数;应用层密钥标识获取单元34,被配置为获取与所述外部蓝牙设备约定的应用层密钥标识;应用层密钥生成单元35,被配置为根据所述应用层密钥生成函数、所述链路层动态参数和所述应用层密钥标识,生成应用层密钥。
一个可能的实现方式中,所述连接模式为:基本速率/增强数据速率模式;所述应用层密钥生成函数确定单元被配置为:将生成链路层密钥时使用的f2函数,确定为应用层密钥生成函数;链路层动态参数获取单元被配置为:将所述f2函数在计算链路层密钥时使用的各密钥参数中的随机数确定为所述链路层动态参数;所述应用层密钥生成单元被配置为:将所述f2函数在计算链路层密钥时使用的各密钥参数中的链路层密钥标识替换为所述应用层密钥标识;利用所述f2函数对替换后得到的各密钥参数进行计 算,得到所述应用层密钥。
一个可能的实现方式中,所述应用层密钥标识与所述链路层密钥标识不相同。
一个可能的实现方式中,所述连接模式为:基本速率/增强数据速率模式,或者低功耗模式;所述应用层密钥生成函数确定单元被配置为:将h6函数,确定为应用层密钥生成函数;所述链路层动态参数获取单元被配置为:获取与外部蓝牙设备建立所述蓝牙连接时生成的链路层密钥;将所述链路层密钥确定为所述链路层动态参数;所述应用层密钥生成单元被配置为:利用所述h6函数对所述应用层密钥标识和所述链路层密钥进行计算,得到所述应用层密钥。
一个可能的实现方式中,当所述连接模式为基本速率/增强数据速率模式时;所述链路层密钥是利用f2函数以及链路层密钥标识生成的;所述应用层密钥标识与所述链路层密钥标识相同或不相同。
一个可能的实现方式中,当所述连接模式为低功耗模式时;所述链路层密钥是利用f5函数生成的。
本说明书一个实施例提供了一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现执行说明书中任一个实施例中的方法。
可以理解的是,本说明书实施例示意的结构并不构成对生成应用层密钥的装置的具体限定。在说明书的另一些实施例中,生成应用层密钥的装置可以包括比图示更多或者更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件、软件或者软件和硬件的组合来实现。
上述装置、***内的各模块之间的信息交互、执行过程等内容,由于与本说明书方法实施例基于同一构思,具体内容可参见本说明书方法实施例中的叙述,此处不再赘述。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
本领域技术人员应该可以意识到,在上述一个或多个示例中,本发明所描述的功能可以用硬件、软件、挂件或它们的任意组合来实现。当使用软件实现时,可以将这些功能存储在计算机可读介质中或者作为计算机可读介质上的一个或多个指令或代码进 行传输。
以上所述的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本发明的保护范围之内。

Claims (13)

  1. 生成应用层密钥的方法,包括:
    确定与外部蓝牙设备建立蓝牙连接时使用的连接模式;
    根据所述连接模式,确定应用层密钥生成函数;
    根据所述应用层密钥生成函数,确定在链路层使用的链路层动态参数;
    获取与所述外部蓝牙设备约定的应用层密钥标识;
    根据所述应用层密钥生成函数、所述链路层动态参数和所述应用层密钥标识,生成应用层密钥。
  2. 根据权利要求1所述的方法,其中,所述连接模式为:基本速率/增强数据速率模式;
    所述根据所述连接模式确定应用层密钥生成函数,包括:
    将生成链路层密钥时使用的f2函数,确定为应用层密钥生成函数;
    所述确定在链路层使用的链路层动态参数,包括:
    将所述f2函数在计算链路层密钥时使用的各密钥参数中的随机数确定为所述链路层动态参数;
    所述生成应用层密钥,包括:
    将所述f2函数在计算链路层密钥时使用的各密钥参数中的链路层密钥标识替换为所述应用层密钥标识;
    利用所述f2函数对替换后得到的各密钥参数进行计算,得到所述应用层密钥。
  3. 根据权利要求2所述的方法,其中,所述应用层密钥标识与所述链路层密钥标识不相同。
  4. 根据权利要求1所述的方法,其中,所述连接模式为:基本速率/增强数据速率模式,或者低功耗模式;
    所述根据所述连接模式确定应用层密钥生成函数,包括:
    将h6函数,确定为应用层密钥生成函数;
    所述确定在链路层使用的链路层动态参数,包括:
    获取与外部蓝牙设备建立所述蓝牙连接时生成的链路层密钥;
    将所述链路层密钥确定为所述链路层动态参数;
    所述生成应用层密钥,包括:
    利用所述h6函数对所述应用层密钥标识和所述链路层密钥进行计算,得到所述应用层密钥。
  5. 根据权利要求4所述的方法,其中,当所述连接模式为基本速率/增强数据速率模式时;
    所述链路层密钥是利用f2函数以及链路层密钥标识生成的;
    所述应用层密钥标识与所述链路层密钥标识相同或不相同。
  6. 根据权利要求4所述的方法,其中,当所述连接模式为低功耗模式时;所述链路层密钥是利用f5函数生成的。
  7. 生成应用层密钥的装置,包括:
    连接模式确定单元,被配置为确定与外部蓝牙设备建立蓝牙连接时使用的连接模式;
    应用层密钥生成函数确定单元,被配置为根据所述连接模式,确定应用层密钥生成函数;
    链路层动态参数获取单元,被配置为根据所述应用层密钥生成函数,确定在链路层使用的链路层动态参数;
    应用层密钥标识获取单元,被配置为获取与所述外部蓝牙设备约定的应用层密钥标识;
    应用层密钥生成单元,被配置为根据所述应用层密钥生成函数、所述链路层动态参数和所述应用层密钥标识,生成应用层密钥。
  8. 根据权利要求7所述的装置,其中,所述连接模式为:基本速率/增强数据速率模式;
    所述应用层密钥生成函数确定单元被配置为:将生成链路层密钥时使用的f2函数,确定为应用层密钥生成函数;
    链路层动态参数获取单元被配置为:将所述f2函数在计算链路层密钥时使用的各密钥参数中的随机数确定为所述链路层动态参数;
    所述应用层密钥生成单元被配置为:将所述f2函数在计算链路层密钥时使用的各密钥参数中的链路层密钥标识替换为所述应用层密钥标识;利用所述f2函数对替换后得到的各密钥参数进行计算,得到所述应用层密钥。
  9. 根据权利要求8所述的装置,其中,所述应用层密钥标识与所述链路层密钥标识不相同。
  10. 根据权利要求7所述的装置,其中,所述连接模式为:基本速率/增强数据速率模式,或者低功耗模式;
    所述应用层密钥生成函数确定单元被配置为:将h6函数,确定为应用层密钥生成函数;
    所述链路层动态参数获取单元被配置为:获取与外部蓝牙设备建立所述蓝牙连接时生成的链路层密钥;将所述链路层密钥确定为所述链路层动态参数;
    所述应用层密钥生成单元被配置为:利用所述h6函数对所述应用层密钥标识和所述链路层密钥进行计算,得到所述应用层密钥。
  11. 根据权利要求10所述的装置,其中,当所述连接模式为基本速率/增强数据速率模式时;
    所述链路层密钥是利用f2函数以及链路层密钥标识生成的;
    所述应用层密钥标识与所述链路层密钥标识相同或不相同。
  12. 根据权利要求10所述的装置,其中,当所述连接模式为低功耗模式时;所述链路层密钥是利用f5函数生成的。
  13. 一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现权利要求1-6中任一项所述的方法。
PCT/CN2022/076773 2021-03-25 2022-02-18 生成应用层密钥 WO2022199291A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP22773953.9A EP4319222A1 (en) 2021-03-25 2022-02-18 Application layer key generation
US18/552,025 US20240179517A1 (en) 2021-03-25 2022-02-18 Application layer key generation

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110317802.5A CN113038444B (zh) 2021-03-25 2021-03-25 生成应用层密钥的方法和装置
CN202110317802.5 2021-03-25

Publications (1)

Publication Number Publication Date
WO2022199291A1 true WO2022199291A1 (zh) 2022-09-29

Family

ID=76474068

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/076773 WO2022199291A1 (zh) 2021-03-25 2022-02-18 生成应用层密钥

Country Status (4)

Country Link
US (1) US20240179517A1 (zh)
EP (1) EP4319222A1 (zh)
CN (1) CN113038444B (zh)
WO (1) WO2022199291A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113038444B (zh) * 2021-03-25 2022-07-19 支付宝(杭州)信息技术有限公司 生成应用层密钥的方法和装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102523087A (zh) * 2011-12-14 2012-06-27 百度在线网络技术(北京)有限公司 一种用于对自执行网络信息进行加密处理的方法及设备
US20130340067A1 (en) * 2012-03-27 2013-12-19 Ty Brendan Lindteigen Multi-Wrapped Virtual Private Network
CN106714146A (zh) * 2015-11-13 2017-05-24 广西咪付网络技术有限公司 一种蓝牙ble设备的通信加密方法
CN111740827A (zh) * 2020-07-28 2020-10-02 北京金山云网络技术有限公司 数据传输方法、装置、计算机设备及存储介质
CN113038444A (zh) * 2021-03-25 2021-06-25 支付宝(杭州)信息技术有限公司 生成应用层密钥的方法和装置

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060075075A1 (en) * 2004-10-01 2006-04-06 Malinen Jouni I Method and system to contextually initiate synchronization services on mobile terminals in an enterprise environment
US8886935B2 (en) * 2010-04-30 2014-11-11 Kabushiki Kaisha Toshiba Key management device, system and method having a rekey mechanism
EP3021603A1 (en) * 2014-11-12 2016-05-18 Gemalto Sa Method of managing pairing with a wireless device
CN106209811A (zh) * 2016-07-04 2016-12-07 福州米立科技有限公司 蓝牙设备安全登录身份验证方法及装置
CN106535090B (zh) * 2016-10-11 2020-04-03 歌尔科技有限公司 一种蓝牙设备与智能设备的配对方法及蓝牙设备
CN109688573A (zh) * 2019-01-22 2019-04-26 北京深思数盾科技股份有限公司 蓝牙设备间的交互方法及蓝牙设备
CN110365707A (zh) * 2019-07-30 2019-10-22 广州致链科技有限公司 面向区块链物联网***的边缘计算网关及其实现方法
CN110572804B (zh) * 2019-08-27 2022-04-22 暨南大学 蓝牙通信认证请求、接收及通信方法、移动端、设备端
CN111526509B (zh) * 2020-05-26 2022-08-02 中国联合网络通信集团有限公司 一种卡数据处理方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102523087A (zh) * 2011-12-14 2012-06-27 百度在线网络技术(北京)有限公司 一种用于对自执行网络信息进行加密处理的方法及设备
US20130340067A1 (en) * 2012-03-27 2013-12-19 Ty Brendan Lindteigen Multi-Wrapped Virtual Private Network
CN106714146A (zh) * 2015-11-13 2017-05-24 广西咪付网络技术有限公司 一种蓝牙ble设备的通信加密方法
CN111740827A (zh) * 2020-07-28 2020-10-02 北京金山云网络技术有限公司 数据传输方法、装置、计算机设备及存储介质
CN113038444A (zh) * 2021-03-25 2021-06-25 支付宝(杭州)信息技术有限公司 生成应用层密钥的方法和装置

Also Published As

Publication number Publication date
CN113038444A (zh) 2021-06-25
US20240179517A1 (en) 2024-05-30
CN113038444B (zh) 2022-07-19
EP4319222A1 (en) 2024-02-07

Similar Documents

Publication Publication Date Title
WO2018014723A1 (zh) 密钥管理方法、装置、设备及***
WO2018177124A1 (zh) 业务处理方法、装置、数据共享***及存储介质
WO2018176781A1 (zh) 信息发送方法、信息接收方法、装置及***
KR20130111165A (ko) 블루투스 저 에너지 프라이버시
CN108964893B (zh) 一种密钥处理方法、装置、设备和介质
WO2020143196A1 (zh) 区块链节点之间的通信方法及装置、存储介质及电子设备
WO2020233049A1 (zh) 区块链***的数据授权方法、装置、存储介质及电子设备
CN111698794B (zh) 一种无线音频共享方法
JP5714776B2 (ja) ハイブリッド・ネットワークのためのプロトコル特有鍵
US8661244B2 (en) Method and apparatus for establishing secured link between devices
JP2020532928A (ja) デジタル署名方法、装置及びシステム
US20180062839A1 (en) Mobile security using context patterns
EP2636233A1 (en) Method and apparatus for providing efficient management of certificate revocation
WO2017067369A1 (zh) 一种加密图片、解密图片的方法、装置和设备
WO2022199291A1 (zh) 生成应用层密钥
CN109345242A (zh) 基于区块链的密钥存储、更新方法、装置、设备和介质
CN114553612B (zh) 数据加密、解密方法、装置、存储介质及电子设备
JP6934973B2 (ja) センサー装置と電子装置との間でデータを送信する方法及びシステム
CN110808969B (zh) 数据传输方法及***、电子设备、存储介质
JP6390124B2 (ja) 需要応答イベントの配布のための方法
JP2013118500A (ja) 認証装置、認証方法および認証プログラム
WO2024139734A1 (zh) 密钥更新方法、装置、电子设备和计算机可读存储介质
US9049592B2 (en) Techniques for key derivation for secure communication in wireless mesh networks
WO2024001037A1 (zh) 一种消息传输方法、装置、电子设备和存储介质
US20220377550A1 (en) Secure and trusted peer-to-peer offline communication systems and methods

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22773953

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 18552025

Country of ref document: US

WWE Wipo information: entry into national phase

Ref document number: 2022773953

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 11202307219T

Country of ref document: SG

ENP Entry into the national phase

Ref document number: 2022773953

Country of ref document: EP

Effective date: 20231025