WO2021168860A1 - 一种密钥更新方法及相关装置 - Google Patents

一种密钥更新方法及相关装置 Download PDF

Info

Publication number
WO2021168860A1
WO2021168860A1 PCT/CN2020/077353 CN2020077353W WO2021168860A1 WO 2021168860 A1 WO2021168860 A1 WO 2021168860A1 CN 2020077353 W CN2020077353 W CN 2020077353W WO 2021168860 A1 WO2021168860 A1 WO 2021168860A1
Authority
WO
WIPO (PCT)
Prior art keywords
key
node
target
parameter
update request
Prior art date
Application number
PCT/CN2020/077353
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 JP2022550128A priority Critical patent/JP7451738B2/ja
Priority to KR1020227032169A priority patent/KR20220137124A/ko
Priority to CN202080096273.4A priority patent/CN115104282B/zh
Priority to PCT/CN2020/077353 priority patent/WO2021168860A1/zh
Priority to CN202311240730.4A priority patent/CN117201014A/zh
Priority to EP20920962.6A priority patent/EP4099615A4/en
Publication of WO2021168860A1 publication Critical patent/WO2021168860A1/zh
Priority to US17/895,707 priority patent/US20220417015A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0891Revocation or update of secret information, e.g. encryption key update or rekeying
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/06Network architectures or network communication protocols for network security for supporting key management in a packet data network
    • H04L63/068Network architectures or network communication protocols for network security for supporting key management in a packet data network using time-dependent keys, e.g. periodically changing keys
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0816Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
    • H04L9/0838Key agreement, i.e. key establishment technique in which a shared key is derived by parties as a function of information contributed by, or associated with, each of these
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0816Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
    • H04L9/0838Key agreement, i.e. key establishment technique in which a shared key is derived by parties as a function of information contributed by, or associated with, each of these
    • H04L9/0841Key agreement, i.e. key establishment technique in which a shared key is derived by parties as a function of information contributed by, or associated with, each of these involving Diffie-Hellman or related key agreement protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0816Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
    • H04L9/085Secret sharing or secret splitting, e.g. threshold schemes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0866Generation of secret information including derivation or calculation of cryptographic keys or passwords involving user or device identifiers, e.g. serial number, physical or biometrical information, DNA, hand-signature or measurable physical characteristics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/088Usage controlling of secret information, e.g. techniques for restricting cryptographic keys to pre-authorized uses, different access levels, validity of crypto-period, different key- or password length, or different strong and weak cryptographic algorithms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • H04L9/3066Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy involving algebraic varieties, e.g. elliptic or hyper-elliptic curves
    • H04L9/3073Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy involving algebraic varieties, e.g. elliptic or hyper-elliptic curves involving pairings, e.g. identity based encryption [IBE], bilinear mappings or bilinear pairings, e.g. Weil or Tate pairing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3242Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving keyed hash functions, e.g. message authentication codes [MACs], CBC-MAC or HMAC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/84Vehicles

Definitions

  • the present invention relates to the field of communication technology, in particular to the field of short-distance communication technology, such as cockpit domain communication. Specifically, it relates to a key update method and related devices.
  • the node In order to ensure the security of data transmission and storage during the communication process, the node usually encrypts the transmitted data and stores or transmits it. After receiving the data, the receiver's node decrypts the ciphertext and restores the plaintext. In addition, the node can also perform integrity protection (or complete protection for short) on the data. After receiving the data, the node of the receiver verifies the integrity of the message. Successful integrity verification indicates that the message has not been modified during transmission. In secure data communication, both parties in the communication must each have encryption and decryption keys, integrity protection keys and other keys. Once encryption and decryption keys, integrity protection keys, and other keys expire or are cracked, the information encrypted or fully protected by them is easily leaked, which affects the security of transmitted data.
  • the key update mechanism In order to ensure that the key is not leaked or cracked, the key update mechanism is usually used, that is, when the key validity period is about to expire, a new key replaces the old key.
  • the message used to update the key transmitted by the node is vulnerable to man-in-the-middle attacks, which affects data security.
  • the embodiment of the present application discloses a key update method and related device, which can improve data security in the key update process.
  • an embodiment of the present application discloses a key update method, which is characterized in that it includes:
  • the first key update request includes a first key agreement parameter and first identity authentication information
  • the first identity authentication information is passed through a first shared key Generated.
  • the first shared key is the same secret value stored in the nodes of the two communicating parties, which can be a master key, a session key, or a pre-shared key PSK, etc., where the session key can be used to transmit to the node Encryption or integrity protection of the data and files.
  • the first identity authentication information may be generated through a cryptographic algorithm according to the first shared key.
  • the cryptographic algorithm can be a hash algorithm (also known as a hash algorithm) or an authentication algorithm, such as a hash calculation message authentication code HMAC algorithm (including HMAC secure hash algorithm HMAC-SHA256, HMAC-SHA3, or HMAC national secret Algorithm HMAC-SM3 etc.). Further, the cryptographic algorithm may also include the RIPEMD algorithm for rapid amplification of the RACE original integrity check message digest at the end.
  • the first target key is determined according to the first key agreement parameter.
  • the first node and the second node before the original key expires, the first node and the second node generate identity authentication information according to the first shared key, and one of the nodes first determines the other through the identity authentication information after receiving a message from the other node.
  • the identity of a node is updated according to the key agreement parameters after the identity authentication is passed, and the first target key is obtained.
  • the eavesdropper has broken the original session key, it still cannot Forged identity information, thereby avoiding man-in-the-middle attacks, and improving data security during the key update process.
  • the first key update request is used to indicate at least one of the first update time and the validity period of the first target key.
  • the time to update the key is pre-defined in the protocol and cannot be flexibly selected.
  • the first node can customize the update time of the first target key and/or the validity period of the first target key, and instruct the second node to decide when Enable the first target key.
  • the first key update request includes a first frame number, and the first frame number is indicated by multiple bits, for example, F bits.
  • the first key update request is used to indicate the first update time through the first frame number.
  • the first key update request includes a media access control sequence number (MAC SN), the MAC SN is indicated by M bits, and the M bits are some of the F bits, M is less than F.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the first target key is applied to the validity period of the first target key starting from the first update time.
  • the first key agreement parameter includes a first key agreement algorithm parameter
  • the first response message further includes a second key agreement algorithm parameter
  • the first key agreement parameter to determine the first target key includes:
  • the first target key is generated according to the first key agreement algorithm parameter and the second key agreement algorithm parameter.
  • the first key agreement algorithm parameter and the second key agreement algorithm parameter are algorithm parameters generated in the key agreement process.
  • Key agreement is a process in which both parties exchange some parameters to obtain a key through negotiation.
  • the algorithm used for key agreement is called the key agreement algorithm, and can also be called the key exchange algorithm.
  • the first node generates the first key agreement algorithm parameter
  • the second node generates the second key agreement algorithm parameter
  • the first target key is determined by the key agreement algorithm parameter provided by both parties.
  • two nodes use the same large prime number p and the generated number g, and the random numbers a and b generated respectively.
  • the first node sends the value A generated by mod P to the a power of g to the second node.
  • the second node sends the value B generated by mod P to the b power of g to the first node.
  • the first key agreement parameter includes a fresh parameter; and the determining the first target key according to the first key agreement parameter includes:
  • the first target key is generated.
  • the second target key can be a secret value shared between the first node and the second node, and can also be referred to as a shared key between the first node and the second node, including a master key, a session key, and a pre-shared key. Key PSK etc.
  • the first target key can be generated by the key derivation algorithm KDF.
  • KDF key derivation algorithm
  • fresh is a fresh parameter
  • the parameter used for update may include a counter value (counter), a sequence number (number), a random value (rand), a frame number (framenumber), and so on.
  • the first target key is a master key.
  • the master key is a higher-level secret value in the node, which is mainly used to protect keys such as session keys.
  • the session key is obtained through a key derivation function (KDF) based on the master key.
  • KDF key derivation function
  • the master key can encrypt the session key.
  • the first key agreement parameter includes a fresh parameter; and the determining the first target key according to the first key agreement parameter includes:
  • the first target key is generated according to the second target key, the freshness parameter and the algorithm identifier, and the algorithm identifier is used to mark the algorithm used to determine the encryption key or the integrity protection key.
  • the first target key is an integrity protection key or an encryption key.
  • At least one of the first key update request and the first response message is encrypted by an encryption key determined according to a second target key, and/or At least one of the first key update request and the first response message is integrity protected by an integrity protection key determined according to the second target key.
  • the traditional key update method is to update the key when the old key (that is, the second target key) expires. Since the second target key has expired, the process of determining the new key does not perform encryption and Integrity protection.
  • the first target key can be determined before the second target key expires, so the first key update request and the first response message can be encrypted using the key determined according to the second target key , Thereby improving data security.
  • the sending the first key update request to the second node includes: sending the first key update request to the second node through the first communication frame, where: The second frame number of the first communication frame is smaller than the third frame number carried in the key update request used when the key was updated last time, and the third frame number is used to indicate the start time of the last key update , The first frame number is greater than the second frame number and less than the third frame number.
  • the encryption method used can be based on the frame number and the key updated last time. Therefore, it is determined before the frame number repeats to the frame number of the last key update.
  • the first target key is used to encrypt the data frame by the first target key, so that the data frame with the same frame number twice can be encrypted by different keys, which improves the security of the data.
  • the first key update request includes a MAC sequence number (MAC SN), not the first frame number, and the MAC SN is indicated by M bits, and the M bits are the For some of the F bits, M is smaller than F.
  • the third frame number carried in the key update request used in the last key update can also be replaced by MAC SN, that is, part of the multiple bits used to indicate the third frame number The indicated MAC SN.
  • the size relationship between the first, second, and third frame numbers remains unchanged.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the communication frame includes at least one of a signaling plane uplink frame, a signaling plane downlink frame, a user plane uplink frame, or a user plane downlink frame.
  • the frame number involved in this application is the frame number of the communication frame.
  • the method further includes:
  • the communication connection with the second node is disconnected or the update failure information is sent to the second node.
  • the first node can disconnect the communication connection with the second node or send the update failure information to the second node. It is convenient to re-initiate an access request to the node that needs to update the key, thereby ensuring data security during the key update process.
  • the method before the verifying the second identity authentication information by the first shared key, the method further includes:
  • the communication connection with the second node is disconnected or the update failure information is sent to the second node.
  • the first node before verifying the identity information, the first node first performs integrity verification on the first response message to determine that the information in the first response message has not been tampered with. If the integrity verification fails, it indicates that the data in the first response message has been tampered with and cannot continue to update the key. Therefore, the first node disconnects the communication connection with the second node or sends an update failure message to the second node , It is convenient for the first node to re-access the node that needs to update the key, and also ensures the data security in the key update process.
  • an embodiment of the present application discloses a key update method, which is characterized in that it includes:
  • the key is generated by a cryptographic algorithm.
  • the cryptographic algorithm can be a hash algorithm (also known as a hash algorithm), or an authentication algorithm, such as a hash calculation message authentication code HMAC algorithm (including HMAC secure hash algorithm HMAC-SHA256, HMAC-SHA3, or HMA country Encryption algorithm HMAC-SM3, etc.).
  • HMAC algorithm including HMAC secure hash algorithm HMAC-SHA256, HMAC-SHA3, or HMA country Encryption algorithm HMAC-SM3, etc.
  • the cryptographic algorithm may also include the RIPEMD algorithm for rapid amplification of the RACE original integrity check message digest at the end.
  • the first identity authentication information is verified by the first shared key; wherein, the first shared key is the same secret value stored in the nodes of the two communicating parties, and may be a master key, a session key, or a pre-shared secret. Key PSK, etc., where the session key can be used to encrypt or protect the integrity of the data and files transmitted by the node.
  • the first identity authentication information is generated through a cryptographic algorithm according to the first shared key, so the second node can verify the first identity authentication information through a cryptographic algorithm according to the first share. If the first identity authentication information is verified, determine the first target key according to the first key agreement parameter;
  • the first response message includes second identity authentication information, and the second identity authentication information is generated by the first shared key; the second identity
  • the principle of generating the authentication information is the same as the principle of the first identity authentication information, and will not be repeated here.
  • the first node and the second node before the original session key expires, the first node and the second node generate identity authentication information according to the first shared key, and one of the nodes first determines from the identity authentication information after receiving a message from the other node
  • the identity of the other node is updated according to the key agreement parameters after the identity authentication is passed, and the first target key is obtained.
  • the identity information cannot be forged, thereby avoiding man-in-the-middle attacks and improving data security during the key update process.
  • the first key update request is used to indicate at least one of the first update time and the validity period of the first target key.
  • the time to update the key is pre-defined in the protocol and cannot be flexibly selected.
  • the first node can customize the update time of the first target key and/or the validity period of the first target key, and instruct the second node to decide when Enable the first target key.
  • the first key update request includes a first frame number, and the first key update request indicates the first update by using the first frame number. time.
  • the first frame number is indicated by multiple bits, for example, F bits.
  • the first key update request includes a media access control sequence number (MAC SN), the MAC SN is indicated by M bits, and the M bits are some of the F bits, M is less than F.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the first target key is applied to the validity period of the first target key starting from the first update time.
  • the first key agreement parameter includes a first key agreement algorithm parameter
  • the first response message further includes a second key agreement algorithm parameter
  • the first key agreement parameter to determine the first target key includes:
  • the first target key is generated according to the first key agreement algorithm parameter and the second key agreement algorithm parameter.
  • the first key agreement algorithm parameter and the second key agreement algorithm parameter are algorithm parameters generated in the key agreement process.
  • Key agreement is a process in which both parties exchange some parameters to obtain a key through negotiation.
  • the algorithm used for key agreement is called the key agreement algorithm, and can also be called the key exchange algorithm.
  • the first node generates the first key agreement algorithm parameter
  • the second node generates the second key agreement algorithm parameter
  • the first target key is determined by the key agreement algorithm parameter provided by both parties.
  • two nodes use the same large prime number p and the generated number g, and the random numbers a and b generated respectively.
  • the first node sends the value A generated by mod P to the a power of g to the second node.
  • the second node sends the value B generated by mod P to the b power of g to the first node.
  • the first key agreement parameter includes a fresh parameter; and the determining the first target key according to the first key agreement parameter includes:
  • the first target key is generated.
  • the second target key may be a shared key between the first node and the second node, including a master key, a session key, and a pre-shared key PSK.
  • the first target key can be generated by a key derivation algorithm KDF.
  • KDF key derivation algorithm
  • fresh is a fresh parameter
  • the parameter used for update may include a counter value (counter), a sequence number (number), a random value (rand), a frame number (framenumber), and so on.
  • the first target key is a master key.
  • the master key is a higher-level secret value in the node, which is mainly used to protect keys such as session keys.
  • the session key is obtained through a key derivation function (KDF) based on the master key.
  • KDF key derivation function
  • the master key can encrypt the session key.
  • the first key agreement parameter includes a fresh parameter; and the determining the first target key according to the first key agreement parameter includes:
  • the first target key is generated according to the second target key, the freshness parameter and the algorithm identifier, and the algorithm identifier is used to mark the algorithm used to determine the encryption key or the integrity protection key.
  • the first target key is an integrity protection key or an encryption key.
  • At least one of the first key update request and the first response message is encrypted by an encryption key determined according to a second target key, and/or At least one of the first key update request and the first response message is integrity protected by an integrity protection key determined according to the second target key.
  • the traditional key update method is to update the key when the old key (that is, the second target key) expires. Since the second target key has expired, the process of determining the new key does not perform encryption and Integrity protection.
  • the first target key can be determined before the second target key expires, so the first key update request and the first response message can be encrypted using the key determined according to the second target key , Thereby improving data security.
  • the method further includes:
  • the connection with the first node is disconnected or the update indicating that the update fails to be sent to the first node.
  • the second node can disconnect the connection with the first node or send the update information indicating that the update failed to the first node. Stop this key process to ensure the data security of the second node during the key update process.
  • the method before the verifying the first identity authentication information through the first shared key, the method further includes:
  • the connection with the first node is disconnected or the update information indicating that the update has failed is sent to the first node.
  • the second node before verifying the identity information, the second node first performs integrity verification on the first key update request, and determines that the information in the first key update request has not been tampered with. If the integrity verification fails, it indicates that the data in the first key update request has been tampered with, and the key cannot be updated. Therefore, the second node can disconnect from the first node or send an update indication to the first node that the update failed The information to ensure the data security during the key update process.
  • an embodiment of the present application discloses a device, including:
  • the sending unit is configured to send a first key update request to the second node, where the first key update request includes first key negotiation parameters and first identity authentication information, and the first identity authentication information is passed Generated by the first shared key;
  • a receiving unit configured to receive a first response message from the second node, where the first response message includes second identity authentication information
  • a verification unit configured to verify the second identity authentication information through the first shared key
  • the determining unit is configured to determine the first target key according to the first key agreement parameter if the second identity authentication information is verified.
  • the above-mentioned node and the second node generate identity authentication information according to the first shared key.
  • one node After receiving a message from another node, one node first determines the identity of the other node through the identity authentication information. After the authentication is passed, the key is updated according to the key negotiation parameters to obtain the first target key. In this case, even if the eavesdropper has broken the original session key, the identity information cannot be forged, thereby avoiding The man-in-the-middle attack improves the data security during the key update process.
  • the first key update request is used to indicate at least one of the first update time and the validity period of the first target key.
  • the time to update the key is pre-defined in the protocol and cannot be flexibly selected.
  • the node provided in this application can customize the update time of the first target key and/or the validity period of the first target key, and instruct the second node to decide when to activate the first target according to demand. Key.
  • the first key update request includes a first frame number, and the first key update request indicates the first update by using the first frame number. time.
  • the first frame number is indicated by multiple bits, for example, F bits.
  • the first key update request includes a media access control sequence number (MAC SN), the MAC SN is indicated by M bits, and the M bits are some of the F bits, M is less than F.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the first target key is applied to the validity period of the first target key starting from the first update time.
  • the first key agreement parameter includes a first key agreement algorithm parameter
  • the first response message further includes a second key agreement algorithm parameter
  • the determination Unit configured to generate the first target key according to the first key agreement algorithm parameter and the second key agreement algorithm parameter.
  • the first key agreement parameter includes a freshness parameter; and the determining unit is configured to generate the first key agreement parameter according to the second target key and the freshness parameter.
  • the target key is configured to generate the first key agreement parameter according to the second target key and the freshness parameter.
  • the second target key may be a shared key between the first node and the second node, including a master key, a session key, and a pre-shared key PSK.
  • the first target key can be generated by a key derivation algorithm KDF.
  • KDF key derivation algorithm
  • fresh is a fresh parameter
  • the parameter used for update may include a counter value (counter), a sequence number (number), a random value (rand), a frame number (framenumber), and so on.
  • the first target key is a master key of the node.
  • the first key agreement parameter includes a freshness parameter; and the determining unit is configured to generate all the parameters according to the second target key, the freshness parameter, and the algorithm identifier.
  • the algorithm identifier is used to mark the algorithm used to determine the encryption key or the integrity protection key.
  • the first target key is an integrity protection key or an encryption key of the node.
  • At least one of the first key update request and the first response message is encrypted by an encryption key determined according to a second target key, and/or At least one of the first key update request and the first response message is integrity protected by an integrity protection key determined according to the second target key.
  • the traditional key update method is to update the key when the old key expires. Since the second target key has expired, the process of determining the new key does not perform encryption and integrity protection.
  • the node provided in the embodiment of the present application can determine the first target key before the key expires, so the first key update request and the first response message can be performed using the key determined according to the second target key. Encryption, thereby improving data security.
  • the sending unit is configured to send a first key update request to the second node through a first communication frame, wherein the second frame of the first communication frame The number is smaller than the third frame number carried in the key update request used when the key was updated last time, and the third frame number is used to indicate the start time of the last key update, and the first frame number is greater than all The second frame number is smaller than the third frame number.
  • the encryption method used can be based on the frame number and the key updated last time. Therefore, it is determined before the frame number repeats to the frame number of the last key update.
  • the first target key is used to encrypt the data frame by the first target key, so that the data frame with the same frame number twice can be encrypted by different keys, which improves the security of the data.
  • the first key update request includes a MAC sequence number (MAC SN), not the first frame number, and the MAC SN is indicated by M bits, and the M bits are the For some of the F bits, M is smaller than F.
  • the third frame number carried in the key update request used in the last key update can also be replaced by MAC SN, that is, part of the multiple bits used to indicate the third frame number The indicated MAC SN.
  • the size relationship between the first, second, and third frame numbers remains unchanged.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the communication frame includes at least one of a signaling plane uplink frame, a signaling plane downlink frame, a user plane uplink frame, or a user plane downlink frame.
  • the sending unit and the receiving unit disconnect the communication connection with the second node or send to the second node Update failed information.
  • the above-mentioned node can disconnect the communication connection with the second node or send the update failure information to the second node, which is convenient for Re-initiate an access request to the node that needs to update the key, thereby ensuring data security during the key update process.
  • the verification unit is further configured to perform integrity verification on the first response message; if the integrity verification is passed, continue to execute the passing of the first shared secret.
  • the sending unit and the receiving unit disconnect the communication connection with the second node or send the update failure information to the second node or send the update to the second node through the sending unit Failed information.
  • the node may first verify the integrity of the first response message before verifying the identity information to determine that the information in the first response message has not been tampered with. If the integrity verification fails, it indicates that the data in the first response message has been tampered with and cannot continue to update the key. Therefore, the node disconnects the communication connection with the second node or sends an update failure message to the second node , It is convenient for the node to re-access the node that needs to update the key, and also ensures the data security in the key update process.
  • an embodiment of the present application discloses a device, including
  • a receiving unit configured to receive a first key update request from a first node, where the first key update request includes first key negotiation parameters and first identity authentication information;
  • a verification unit configured to verify the first identity authentication information through a first shared key
  • a determining unit configured to determine a first target key according to the first key agreement parameter if the first identity authentication information is verified
  • a sending unit configured to send a first response message to the first node, where the first response message includes second identity authentication information, and the second identity authentication information is generated by the first shared key .
  • the aforementioned node and the first node Before the original session key expires, the aforementioned node and the first node generate identity authentication information according to the first shared key. After receiving a message from another node, one node first determines the identity of the other node through the identity authentication information After the identity authentication is passed, the key is updated according to the key negotiation parameters to obtain the first target key. In this case, even if the eavesdropper has broken the original session key, the identity information cannot be forged. This avoids man-in-the-middle attacks and improves data security during the key update process.
  • the first key update request is used to indicate at least one of the first update time and the validity period of the first target key.
  • the time to update the key is pre-defined in the protocol and cannot be flexibly selected.
  • the first node can customize the update time of the first target key and/or the validity period of the first target key, and indicate to the node, which is beneficial to decide what to do on demand. When the first target key is enabled.
  • the first key update request includes a first frame number, and the first key update request indicates the first update time through the first frame number .
  • the first frame number is indicated by multiple bits, for example, F bits.
  • the first key update request includes a media access control sequence number (MAC SN), the MAC SN is indicated by M bits, and the M bits are some of the F bits, M is less than F.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the first target key is applied to the validity period of the first target key starting from the first update time.
  • the first key agreement parameter includes a first key agreement algorithm parameter
  • the first response message includes a second key agreement algorithm parameter
  • the determining unit For generating the first target key according to the first key agreement algorithm parameter and the second key agreement algorithm parameter.
  • the first key agreement parameter includes a freshness parameter; and the determining unit is configured to generate the first key agreement parameter according to the second target key and the freshness parameter.
  • the target key is configured to generate the first key agreement parameter according to the second target key and the freshness parameter.
  • the second target key may be a shared key between the first node and the second node, including a master key, a session key, and a pre-shared key PSK.
  • the first target key can be generated by a key derivation algorithm KDF.
  • KDF key derivation algorithm
  • fresh is a fresh parameter
  • the parameter used for update may include a counter value (counter), a sequence number (number), a random value (rand), a frame number (framenumber), and so on.
  • the first target key is a master key of the node.
  • the first key agreement parameter includes a freshness parameter; the determining unit is configured to generate the all the information according to the second target key, the freshness parameter, and the algorithm identifier.
  • the algorithm identifier is used to identify the algorithm used to determine the encryption key or the integrity protection key.
  • the first target key is an integrity protection key or an encryption key of the second node.
  • at least one of the first key update request and the first response message is encrypted by an encryption key determined according to a second target key, and/or At least one of the first key update request and the first response message is integrity protected by an integrity protection key determined according to the second target key.
  • the traditional key update method is to update the key when the old key expires. Since the second target key has expired, the process of determining the new key does not perform encryption and integrity protection.
  • the first target key can be determined before the key expires. Therefore, the first key update request and the first response message can be encrypted with the key determined according to the second target key, thereby improving Improved data security.
  • the sending unit and the receiving unit are disconnected from the first node or sent to the first node through the sending unit.
  • the node sends an update indicating that the update has failed.
  • the node can disconnect the connection with the first node or send update information indicating that the update failed to the first node, thereby Stop this key process to ensure the data security of the node during the key update process.
  • the verification unit is further configured to perform integrity verification on the first key update request; if the integrity verification is passed, continue to execute the passing of the first key update request.
  • the node disconnects from the first node or sends an update indicating update failure to the first node through the sending unit.
  • the aforementioned node Before verifying the identity information, the aforementioned node first verifies the integrity of the first key update request, and determines that the information in the first key update request has not been tampered with. If the integrity verification fails, it indicates that the data in the first key update request has been tampered with and cannot continue to update the key. Therefore, the aforementioned node can disconnect from the first node or send an update indicating that the update failed to the first node. Information to ensure data security during the key update process.
  • an embodiment of the present application discloses a device.
  • the node includes a memory, a processor, and a communication interface.
  • a calculator program is stored in the memory, and the processor calls the computer program stored in the memory to use To perform the following operations:
  • the first key update request includes a first key agreement parameter and first identity authentication information, and the first identity authentication information is passed Generated by the first shared key;
  • the first target key is determined according to the first key agreement parameter.
  • the above-mentioned node and the second node generate identity authentication information according to the first shared key.
  • one node After receiving a message from another node, one node first determines the identity of the other node through the identity authentication information. After the authentication is passed, the key is updated according to the key negotiation parameters to obtain the first target key. In this case, even if the eavesdropper has broken the original session key, the identity information cannot be forged, thereby avoiding The man-in-the-middle attack improves the data security during the key update process.
  • the first key update request is used to indicate at least one of the first update time and the validity period of the first target key.
  • the time to update the key is pre-defined in the protocol and cannot be flexibly selected.
  • the node provided by this application can customize the update time of the first target key and/or the validity period of the first target key, and instruct the second node to determine when to activate the first target key according to demand.
  • the target key can be customized.
  • the first key update request includes a first frame number, and the first key update request indicates the first update by using the first frame number. time.
  • the first frame number is indicated by multiple bits, for example, F bits.
  • the first key update request includes a medium access control sequence number (MAC SN), the MAC SN is indicated by M bits, and the M bits are some of the F bits, M is less than F.
  • the multiple bits used to indicate the first frame number include two parts: a high part and a low part, where the low part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the first target key is applied to the validity period of the first target key starting from the first update time.
  • the first key agreement parameter includes a first key agreement algorithm parameter
  • the first response message further includes a second key agreement algorithm parameter
  • the processor is specifically configured to:
  • the first target key is generated according to the first key agreement algorithm parameter and the second key agreement algorithm parameter.
  • the first key agreement parameter includes a fresh parameter; in terms of determining the first target key according to the first key agreement parameter, the processor specifically Used for:
  • the first target key is generated.
  • the second target key may be a shared key between the first node and the second node, including a master key, a session key, and a pre-shared key PSK.
  • the first target key can be generated by a key derivation algorithm KDF.
  • KDF key derivation algorithm
  • fresh is a fresh parameter
  • the parameter used for update may include a counter value (counter), a sequence number (number), a random value (rand), a frame number (framenumber), and so on.
  • the first key agreement parameter includes a fresh parameter; in terms of determining the first target key according to the first key agreement parameter, the processing The device is specifically used for:
  • the first target key is a master key of the node.
  • the first target key is generated according to the second target key, the freshness parameter and the algorithm identifier, and the algorithm identifier is used to mark the algorithm used to determine the encryption key or the integrity protection key.
  • the first target key is an integrity protection key or an encryption key of the node.
  • At least one of the first key update request and the first response message is encrypted by an encryption key determined according to a second target key, and/or At least one of the first key update request and the first response message is integrity protected by an integrity protection key determined according to the second target key.
  • the traditional key update method is to update the key when the old key expires. Since the second target key has expired, the process of determining the new key does not perform encryption and integrity protection.
  • the first target key can be determined before the key expires. Therefore, the first key update request and the first response message can be encrypted with the key determined according to the second target key, thereby improving Improved data security.
  • the communication interface sends a first key update request to the second node through a first communication frame, wherein the second frame number of the first communication frame is less than the upper
  • the third frame number carried in the key update request used when the key is updated once the third frame number is used to indicate the start time of the last updated key, and the first frame number is greater than the second The frame number is smaller than the third frame number.
  • the encryption method used can be based on the frame number and the key updated last time. Therefore, it is determined before the frame number repeats to the frame number of the last key update.
  • the first target key is used to encrypt the data frame by the first target key, so that the data frame with the same frame number twice can be encrypted by different keys, which improves the security of the data.
  • the first key update request includes a MAC sequence number (MAC SN), not the first frame number, and the MAC SN is indicated by M bits, and the M bits are the For some of the F bits, M is smaller than F.
  • the third frame number carried in the key update request used in the last key update can also be replaced by MAC SN, that is, part of the multiple bits used to indicate the third frame number The indicated MAC SN.
  • the size relationship between the first, second, and third frame numbers remains unchanged.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the communication frame includes at least one of a signaling plane uplink frame, a signaling plane downlink frame, a user plane uplink frame, or a user plane downlink frame.
  • the processor is further configured to, if the second identity information is not verified, instruct the communication interface to disconnect the communication connection with the second node or pass the The communication interface sends the update failure information to the second node.
  • the above-mentioned node can disconnect the communication connection with the second node or send the update failure information to the second node, which is convenient for Re-initiate an access request to the node that needs to update the key, thereby ensuring data security during the key update process.
  • the processor after receiving the first response message from the second node, the processor is further configured to: perform integrity verification on the first response message; If the verification is passed, the step of verifying the second identity authentication information through the first shared key is continued;
  • the processor is further configured to, if the integrity verification fails, instruct the communication interface to disconnect the communication connection with the second node or send the update failure information to the second node through the communication interface.
  • the integrity verification can determine whether the information has been tampered with. Therefore, before verifying the identity information, the node first performs integrity verification on the first response message to determine that the information in the first response message has not been tampered with. If the integrity verification fails, it indicates that the data in the first response message has been tampered with and cannot continue to update the key. Therefore, the node disconnects the communication connection with the second node or sends an update failure message to the second node , It is convenient for the node to re-access the node that needs to update the key, and also ensures the data security in the key update process.
  • an embodiment of the present application discloses a device.
  • the node includes a memory, a processor, and a communication interface.
  • a calculator program is stored in the memory, and the processor calls the computer program stored in the memory to use To perform the following operations:
  • the first key update request includes a first key agreement parameter and first identity authentication information, and the first identity authentication information is passed Generated by the first shared key;
  • the first target key is determined according to the first key agreement parameter.
  • the above-mentioned node and the first node Before the original session key expires, the above-mentioned node and the first node generate identity authentication information according to the first shared key. After receiving a message from the other node, one node first determines the identity of the other node through the identity authentication information After the identity authentication is passed, the key is updated according to the key negotiation parameters to obtain the first target key. In this case, even if the eavesdropper has broken the original session key, the identity information cannot be forged. This avoids man-in-the-middle attacks and improves data security during the key update process.
  • the first key update request is used to indicate at least one of the first update time and the validity period of the first target key.
  • the time to update the key is pre-defined in the protocol and cannot be flexibly selected.
  • the first node can customize the update time of the first target key and/or the validity period of the first target key, and instruct the node to determine when to activate the first target key as required. key.
  • the first key update request includes a first frame number, and the first key update request indicates the first update by using the first frame number. time.
  • the first frame number is indicated by multiple bits, for example, F bits.
  • the first key update request includes a media access control sequence number (MAC SN), the MAC SN is indicated by M bits, and the M bits are some of the F bits, M is less than F.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the first target key is applied to the validity period of the first target key starting from the first update time.
  • the first key agreement parameter includes a first key agreement algorithm parameter
  • the first response message further includes a second key agreement algorithm parameter
  • the processor is specifically configured to:
  • the first target key is generated according to the first key agreement algorithm parameter and the second key agreement algorithm parameter.
  • the first key agreement parameter includes a freshness parameter; in terms of determining the first target key according to the first key agreement parameter, the processor specifically Used for:
  • the first target key is generated.
  • the second target key may be a shared key between the first node and the second node, including a master key, a session key, and a pre-shared key PSK.
  • the first target key can be generated by a key derivation algorithm KDF.
  • KDF key derivation algorithm
  • fresh is a fresh parameter
  • the parameter used for update may include a counter value (counter), a sequence number (number), a random value (rand), a frame number (framenumber), and so on.
  • the first target key is a master key of the node.
  • the first key agreement parameter includes a fresh parameter; in terms of determining the first target key according to the first key agreement parameter, the processing The device is specifically used for:
  • the first target key is generated according to the second target key, the freshness parameter and the algorithm identifier, and the algorithm identifier is used to mark the algorithm used to determine the encryption key or the integrity protection key.
  • the first target key is an integrity protection key or an encryption key of the node.
  • At least one of the first key update request and the first response message is encrypted by an encryption key determined according to a second target key, and/or At least one of the first key update request and the first response message is integrity protected by an integrity protection key determined according to the second target key.
  • the traditional key update method is to update the key when the old key expires. Since the second target key has expired, the process of determining the new key does not perform encryption and integrity protection.
  • the first target key can be determined before the key expires. Therefore, the first key update request and the first response message can be encrypted with the key determined according to the second target key, thereby improving Improved data security.
  • the processor is further configured to, if the first identity information is not verified, instruct the communication interface to disconnect the communication connection with the first node or send the communication interface to the first node through the communication interface.
  • a node sends a message indicating that the update has failed.
  • the node can disconnect the connection with the first node or send an update indicating that the update failed to the first node, thereby stopping the key process to ensure confidentiality. Data security of the node during the key update process.
  • the processor after receiving the first key update request from the first node, the processor is further configured to: perform integrity verification on the first key update request If the integrity verification is passed, continue to perform the step of verifying the first identity authentication information through the first shared key;
  • the processor is further configured to, if the integrity verification fails, instruct the communication interface to disconnect from the first node or send information indicating that the update fails to the first node through the communication interface.
  • the aforementioned node Before verifying the identity information, the aforementioned node first verifies the integrity of the first key update request, and determines that the information in the first key update request has not been tampered with. If the integrity verification fails, it indicates that the data in the first key update request has been tampered with and cannot continue to update the key. Therefore, the aforementioned node can disconnect from the first node or send an update indicating that the update failed to the first node. Information to ensure data security during the key update process.
  • the embodiments of the present application disclose a computer-readable storage medium in which a computer program is stored.
  • the computer program runs on one or more processors, the first Aspect, any one possible implementation manner of the first aspect, the second aspect, or any one possible implementation manner of the second aspect.
  • an embodiment of the present application discloses a chip system.
  • the chip system includes at least one processor, a memory, and an interface circuit.
  • the interface circuit is used to provide information input/output for the at least one processor.
  • the at least one memory stores a computer program, and when the computer program runs on one or more processors, executes the first aspect, any one of the possible implementation manners of the first aspect, the second aspect, or the second aspect The method described in any one of the possible implementations.
  • an embodiment of the present application discloses a vehicle, and the vehicle includes a first node (for example, a car cabin domain controller CDC). Further, the vehicle further includes a second node (for example, at least one of a camera, a screen, a microphone, a sound, a radar, an electronic key, a keyless entry or a start system controller, etc.), wherein the first node is the above
  • a first node for example, a car cabin domain controller CDC
  • the vehicle further includes a second node (for example, at least one of a camera, a screen, a microphone, a sound, a radar, an electronic key, a keyless entry or a start system controller, etc.), wherein the first node is the above
  • the second node is the foregoing fourth aspect or Any one of the possible implementation manners of the fourth aspect, or
  • FIG. 1 is a schematic diagram of the principle of a DH algorithm provided by an embodiment of the present application
  • Figure 2 is a schematic diagram of a key derivation algorithm provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of the architecture of a communication system provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a usage scenario of a key update method provided by an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a key update method provided by an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of another key update method provided by an embodiment of the present application.
  • FIG. 7 is a schematic flowchart of another key update method provided by an embodiment of the present application.
  • FIG. 8 is a schematic flowchart of another key update method provided by an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a node provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of another node provided by an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of another node provided by an embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of another node provided by an embodiment of the present application.
  • a node is an electronic device with the ability to send and receive data.
  • a node can be a car cockpit (Cockpit Domain) device, or a module in a car cockpit device (cockpit domain controller (CDC), camera, screen, microphone, audio, electronic key, keyless entry or start One or more of the system controller and other modules).
  • the node can be a data transfer device, such as a router, a repeater, a bridge, or a switch, or a terminal device, such as various types of user equipment (UE) and mobile phones.
  • UE user equipment
  • Tablet computers can also include machine smart devices such as self-driving (self-driving) equipment, transportation safety equipment, virtual reality (virtual reality, VR) terminal equipment, Augmented reality (AR) terminal equipment, machine type communication (MTC) equipment, industrial control equipment, remote medical equipment, smart grid equipment, smart city ) Devices, which may also include wearable devices (such as smart watches, smart bracelets, pedometers, etc.) and so on.
  • machine smart devices such as self-driving (self-driving) equipment, transportation safety equipment, virtual reality (virtual reality, VR) terminal equipment, Augmented reality (AR) terminal equipment, machine type communication (MTC) equipment, industrial control equipment, remote medical equipment, smart grid equipment, smart city ) Devices, which may also include wearable devices (such as smart watches, smart bracelets, pedometers, etc.) and so on.
  • wearable devices such as smart watches, smart bracelets, pedometers, etc.
  • data is transferred between communication nodes. If the data is to be kept secret, it needs to be encrypted with a key. Because the secret level and level of the content that needs to be kept secret in the node are sometimes different, it needs to be encrypted with different types of keys. Commonly used key types include session keys, master keys, shared keys, and so on.
  • Session keys include encryption keys, integrity protection keys, and file keys.
  • the encryption key can be used to protect the data transmitted by the node, and can also be called the data encryption key; the integrity protection key can be used to protect the integrity of the transmitted data; the file key can be used to protect the transmission document.
  • the session key can be pre-configured in the nodes of the communicating parties, or it can be obtained through negotiation between the communicating parties, or derived from the original key, or it can be obtained by the Key Distribution Center (KDC) distribute.
  • the session key may be a key of a symmetric encryption algorithm, or a key of an asymmetric encryption algorithm (asymmetric encryption algorithm).
  • the master key is a higher-level secret value in the node, which can be used to derive session keys, secondary master keys, and so on.
  • the secondary primary key is a key whose level is between the primary key and the session key, and is sometimes referred to as an intermediate key.
  • the master key can be strictly protected through physical or electronic isolation.
  • the shared key is the same secret value stored in the nodes of the two communicating parties.
  • the nodes can use the master key, or session key, or pre-shared key (PSK) as Shared key. There can be one or more shared keys in the node.
  • PSK pre-shared key
  • the node uses the session key as the shared key.
  • node A and node B use a symmetric encryption algorithm to communicate (that is, encryption and decryption use the same key), and node A uses the encryption key Km to encrypt the plaintext message and send it to the node B, Node B uses the decryption key Km for decryption.
  • the encryption key Km can be used as a shared key between the two nodes.
  • a node can use a pre-shared key as a shared key, where the pre-shared key is a secret value that identifies the connection between two nodes.
  • the pre-shared key can be pre-configured in the nodes of the communicating parties.
  • the cockpit domain controller (CDC) of the vehicle and the vehicle radar equipment are two nodes that can communicate.
  • the CDC and the vehicle radar are deployed during deployment.
  • the secret value has been pre-configured, and only the CDC of the vehicle can connect or transmit data with the roof radar.
  • the pre-shared key can also be obtained by both parties through communication. For example, before the CDC connects with the Bluetooth of the mobile phone, the pre-shared key can be generated by confirming the pairing.
  • the pre-shared key can also be sent by a trusted device (such as KDC) to the first node and the second node respectively.
  • KDC trusted device
  • Key agreement is a process in which two parties in communication exchange some parameters to obtain a key through negotiation.
  • the algorithm used for key agreement is called the key agreement algorithm, and can also be called the key exchange algorithm.
  • Commonly used key agreement algorithms include Diffie-Hellman (DH) algorithm, Diffie-Hellman (ECDH) algorithm based on Elliptic Curve Cryptosystems (ECC), Oakley (Oakley) algorithm, National secret algorithm (such as SM1, SM2, SM3 and SM4), etc.
  • two nodes use the same prime number p and random number g, and random numbers a and b generated respectively.
  • the first node sends the value generated by mod P to the second node to the second node
  • the second node sends the value generated by mod P to the b power of g to the first node
  • the first node does a on the received result.
  • the second node performs a power operation on the received result
  • the final password is formed
  • the key exchange is completed, where mod represents the modulus operation.
  • Fig. 1 is a schematic diagram of the principle of a DH algorithm provided by an embodiment of the present application.
  • the steps of the DH algorithm for key exchange are as follows:
  • Step 1 The first node determines the prime number p, the random number g, and the random number a.
  • Step 3 The first node sends the prime number p, the random number g and the first calculated value A to the second node.
  • Step 4 The second node determines the random number b.
  • Step 7 The second node sends the first calculated value B to the first node.
  • Key derivation is to derive one or more keys from a secret value
  • KDF key derivation algorithm
  • fresh is a fresh parameter (fresh parameter), a parameter used for update, which can include at least one of a counter value (counter), a sequence number (number), a random value (rand), a frame number (framenumber), etc.
  • freshness parameters of the moments are usually different.
  • the frame number is the number of the frame, and the frame is a specific information structure composed of several bits or fields. For example, time division multiple access (TDMA) communication technology divides time into periodic frames, and each frame The frame number changes periodically from 0 to 2715647.
  • TDMA time division multiple access
  • PBKDF password-based key derivation function
  • scrypt algorithm etc.
  • the PBKDF algorithm includes the first generation PBKDF1 and the second generation PBKDF2.
  • some KDF algorithms use a hash algorithm to hash the input secret value in the process of deriving the key. Therefore, the KDF function can also receive the algorithm identifier as input to indicate which hash algorithm to use.
  • Figure 2 is a schematic diagram of a key derivation algorithm provided by an embodiment of the present application.
  • the derived key 1 can be obtained through the secret value 201, the algorithm identification 1 and the fresh parameter fresh1, and the secret value 201, the algorithm identification 1 And the fresh parameter fresh2, the derived key 2 can be obtained, in which the number of iterations and the block size have been preset.
  • a cryptographic algorithm can be a mathematical function used for encryption and/or decryption, and can also be referred to as a cryptographic function.
  • Commonly used cryptographic algorithms include hashing algorithms or authentication algorithms. Among them, the hash algorithm is also called a hash (Hash) function or hash algorithm. The hash algorithm can convert information of any length into an identifier, and it is difficult to find the reverse law.
  • Commonly used hash algorithms include hash-based message authentication code (HMAC), HMAC national secret algorithm HMAC-SM (such as HMAC-SM3), HMAC-secure hash algorithm, HMAC-SHA), such as HMAC-SHA256, HMAC-SHA3, etc., may also include message digest (MD) algorithms, such as MD2, MD4, or MD5. Further, the cryptographic algorithm may also include a rapid-amplification of cDNA ends (RACE) original integrity verification message digest (RACE Integrity Primitives Evaluation Message Digest, RIPEMD) algorithm.
  • RACE rapid-amplification of cDNA ends
  • FIG. 3 is a schematic diagram of the architecture of a communication system provided by an embodiment of the present application, which includes a first node 301 and a second node 302.
  • the first node 301 can communicate with the second node 302 through a data link.
  • the communicated information can be encrypted using an encryption key.
  • the first node 301 encrypts the plaintext message 303 to be sent with the encryption key 305 to obtain the ciphertext message 304.
  • the first node 301 sends the ciphertext message 304 to the second node 302.
  • the second node 302 after the second node 302 receives the ciphertext message 304, it can decrypt the ciphertext message 304 with a key to obtain the plaintext message 303 to complete the data transmission.
  • the first node 301 and the second node 302 may also include keys such as integrity protection keys, file keys, and master keys.
  • first node 301 and the second node 302 may be different devices.
  • FIG. 4 is a schematic diagram of a usage scenario of a key update method provided by an embodiment of the present application.
  • CDC401 and camera 402 are two nodes in the smart cockpit device.
  • CDC401 can be regarded as the first node 301
  • the camera 402 can be regarded as the second node 302.
  • the camera 402 encrypts the video data through Bluetooth and sends it to CDC401.
  • CDC401 receives encrypted video data via Bluetooth and decrypts it to obtain the captured video data.
  • the first node 301 and the second node 302 can also be the same type of nodes.
  • the first node 301 is mobile phone A
  • the second node 302 is mobile phone B. Then mobile phone A can encrypt the voice data of the local end and send it through the network call. To the B side.
  • the data link for transmitting data between the first node 301 and the second node 302 may include various types of connection media, such as a wired link, a wireless link (such as WIFI, Bluetooth, etc.), or an optical fiber link.
  • connection media such as a wired link, a wireless link (such as WIFI, Bluetooth, etc.), or an optical fiber link.
  • the first node 301 may be the initiator of the communication and may be referred to as the master node.
  • the second node 302 may be the receiver of the communication and may be referred to as the slave node.
  • the service life of the key is often limited, so it is necessary to introduce a key update mechanism.
  • the CDC401 and camera 402 connected by Bluetooth as an example, if the E0 encryption method is adopted, the CDC401 and camera 402 need to update the key within 2 28 Bluetooth clocks (approximately 23.3 hours); if it passes the advanced encryption standard (advanced encryption standard, AES) encryption algorithm, CDC401 and camera 402 need to update the key every 2 38 ticks (about 2.72 years).
  • AES advanced encryption standard
  • the embodiments of the present application provide the following methods.
  • FIG. 5 is a schematic flowchart of a key update method provided by an embodiment of the present application.
  • the key update method can be implemented based on the architecture shown in FIG. 3. The method includes but is not limited to the following steps:
  • Step S501 The first node sends a first key update request to the second node.
  • the first key update request includes the first key agreement parameter and the first identity authentication information.
  • the first key agreement parameter is a key parameter used to generate the first target key, and several optional cases are exemplified as follows:
  • the first key agreement parameter may include the parameter KEm of the key agreement algorithm.
  • the parameter KEm of the key agreement algorithm may be referred to as the first key agreement algorithm parameter.
  • the parameters of the DH algorithm determined in the first node include a prime number p, a random number g, a random number a, and a calculated value A.
  • the prime number p, the random number g, and the calculated value A need to be sent to the second node, the prime number p, the random number g, and the calculated value A can be regarded as the public key of the first node.
  • the random number a since the random number a is not sent to the second node, so the random number a can be regarded as the private key of the first node.
  • the first node uses the calculated value A as the first key agreement algorithm parameter KEm, and the prime number p and the random number g are sent to the second node before sending the first key update request, or the prime number p and the random number
  • the number g and the calculated value A are used as the first key agreement algorithm parameter KEm, and are sent to the second node through the first key update request.
  • the first key negotiation parameter may include fresh parameters.
  • the first identity authentication information in the first key update request may be generated by the shared key between the first node and the second node.
  • the first key update request will be generated
  • the shared key of is called the first shared key
  • the first shared key can be a key such as a master key or a pre-shared key PSK.
  • the first identity authentication information may be generated by a cryptographic algorithm.
  • HMAC receives input of one or more character parameters and outputs an identification, which can be used as the first identity authentication information.
  • S1 can be the first key agreement algorithm parameter KEm described in the above case 1, or it can be the fresh parameter described in the above case 2 (for example, at least one of the counter value, sequence number, random value, frame number, etc.) one).
  • the first key update request may also indicate at least one of the expiration of the first target key and the information of the first update time, where the first update time is used to indicate the activation of the
  • the time of the first target key may also be referred to as the activation time or the activation time.
  • the first key update request includes first indication information indicating the validity period of the first target key.
  • the first indication information may be a specific date and time.
  • the first indication information is the date and time of February 6, 2020. 00:52:50, which can indicate the valid date and time of the first target key to 00:52:50 on February 06, 2020 or the invalid date and time from 00:52:50 on February 06, 2020 Start in seconds;
  • the first indication information can also be a character string indicating valid time or invalid time, for example, the timestamp "1590921570", indicating 00:52:50 on February 6, 2020;
  • the first indication information is also It may be a timer, etc., for example, the validity period of the first target key is 1000 seconds, indicating that the first target key is valid before the 1000th second after being generated or activated;
  • the second indication information may also include a frame number and the like.
  • the first key update request includes second indication information indicating the first update time.
  • the second indication information may be one or more of frame number, specific date and time, character string, or timer.
  • the frame number is the number or index of the communication frame
  • the communication frame is a message structure when the first node communicates with the second node.
  • the communication frame includes at least one of a signaling plane uplink frame, a signaling plane downlink frame, a user plane uplink frame, or a user plane downlink frame.
  • the frame number of the communication frame usually circulates within the preset frame number value range. For example, the time division multiple access TDMA communication technology divides time into periodic frames, and the frame number of each frame changes periodically from 0 to 2715647.
  • the first node may indicate the first update time through the frame number carried in the update request.
  • the frame number carried in the first key update request is referred to as the first frame number.
  • the first frame number is 2345, indicating that the first target key is applied after the communication frame starting from the frame number 2345.
  • the first frame number can be multiple frame numbers.
  • the first frame number can include the A frame number of the user plane downlink frame and the B frame number of the user plane uplink frame, and it can indicate the number of frames from A and The first target key is applied in subsequent user plane downlink frames, and the first target key is applied from the B frame number and subsequent user plane uplink frames.
  • the first frame number may be indicated by multiple bits, for example, F bits.
  • the first key update request includes a media access control serial number (MAC SN), and the MAC SN is indicated by M bits, and the M bits are the F For some of the bits, M is less than F.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN, and the high-order part passes through N-bit indication.
  • the N bits are multiple bits used to indicate a superframe number.
  • the first identity authentication information may also have the following cases:
  • the activation time timer indicates the time to activate the new key.
  • the first identity authentication information when the first identity authentication information is generated, in addition to the first shared key, other information (such as the number of the first node, the address of the first node, or the connection identifier between the first node and the second node, etc.) can also be included. ). It should be noted that when the first key update request includes the random value NONCEm, the information expiration indicating the validity period of the first target key, and the information timer of the first update time, the first node first generates the identity authentication The information AUTHm may not use some or all of the parameters.
  • the first node may send a first key update request to the second node through the first communication frame, wherein the second frame number of the first communication frame is smaller than the key used in the last key update
  • the third frame number carried in the update request, and the third frame number is used to indicate the start time of the last updated key.
  • the first frame number carried in the first key update request is greater than the second frame number and less than the third frame number.
  • the third frame number is 2365, indicating that after the last updated key is applied to the communication frame starting from frame number 2365, the first node needs to determine the first target key before the frame number reaches 2365 again, so the first The node may send the first key update request in the first communication frame with the frame number 2345, and the first key update request uses the first frame number 2355 to indicate the start time of the first target key.
  • the encryption method used can be based on the frame number and the key updated last time. Therefore, it is determined before the frame number repeats to the frame number of the last key update.
  • the first target key is used to encrypt the data frame by the first target key, so that the data frame with the same frame number twice can be encrypted by different keys, which improves the security of the data.
  • the first key update request includes a MAC sequence number (MAC SN), not the first frame number, and the MAC SN is indicated by M bits, and the M bits are the For some of the F bits, M is smaller than F.
  • the third frame number carried in the key update request used in the last key update can also be replaced by MAC SN, that is, part of the multiple bits used to indicate the third frame number The indicated MAC SN.
  • the size relationship between the first, second, and third frame numbers remains unchanged.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the first target key and the last updated key are the same type of key.
  • the third frame number is The frame number carried in the key update request used when the encryption key was updated last time.
  • the first node may record the frame number of the communication frame, and send the first key update request when the frame number of the communication frame and the third frame number are less than or equal to the first threshold.
  • the first node presets the first threshold to be 20, and if the third frame number is 2365, the first node may send the first key update request when the communication frame with the frame number of 2345 is recorded.
  • the first node may record the frame numbers of one or more communication frames, for example, record at least two of the uplink frame on the signaling plane, the downlink frame on the signaling plane, the uplink frame on the user plane, or the downlink frame on the user plane.
  • the first key update request is sent.
  • the first node may pre-configure the target frame number, if the first node When it is detected that the difference between the current communication frame number and the target frame number is less than or equal to the first threshold, the first key update request is sent. It should be noted that, in addition to obtaining the third frame number carried when the key was updated last time, the first node may also record the frame number of the key update request sent when the key was updated last time, or the frame number when the response message was received last time. The frame number, or the frame number of the communication frame when the key updated last time is applied for the first communication, is used to detect whether the current key needs to be updated.
  • Step S502 The second node verifies the first identity authentication information according to the first shared key.
  • the first identity authentication information is generated by the first node according to the first shared key between the first node and the second node, so the second node can verify the first identity authentication according to the first shared key Is the information correct?
  • the second node should also use the same parameters to generate the identity authentication information for verification. If the verified identity authentication information is the same as the first identity authentication information, it is considered that the verification is passed.
  • the first identity authentication information is generated through HMAC, so the second node can generate identity authentication information for verification through HMAC, also called check value check1, and then verify the first identity authentication information through HMAC. 1. Whether the identity authentication information is correct.
  • the first key agreement parameter S1 can refer to the corresponding description in step S501.
  • the second node may not perform the subsequent key update step.
  • the second node may disconnect the communication connection with the first node, or the second node may send information indicating that the update has failed to the first node, or the second node may discard the first key update request. Make a response to ensure the data security of the second node.
  • the second node may verify the integrity of the message of the first key update request to prevent the information in the first key update request from being tampered with by other devices.
  • the first key update request may include an integrity protection verification identifier, and the second node verifies the integrity of the message of the first key update request through the integrity protection verification identifier. If the verification is passed, the verification of the first identity authentication information is continued. If the verification fails, the second node can disconnect the communication connection with the first node, or send a message indicating update failure to the first node, or the second node discards the first key update request and does not do Respond to ensure the data security of the second node.
  • Step S503 If the first identity authentication information is verified, the second node determines the first target key according to the first key agreement parameter.
  • the second node determines the first target key according to the first key agreement parameter in the first key update request, which includes at least the following four optional methods:
  • the first key agreement parameter satisfies the first situation above, that is, the first key agreement parameter includes the first key agreement algorithm parameter KEm, and the second node can determine the second key agreement algorithm parameter KEs of the key agreement algorithm .
  • the second node may generate the first target key according to the first key agreement algorithm parameter KEm and the second key agreement algorithm parameter KEs.
  • the parameters of the DH algorithm received by the second node from the first node may include a prime number p, a random number g, and the first calculated value A
  • the second node can determine the DH algorithm
  • the random number b is used by the second node to generate the first target key, so the random number b can be regarded as the private key of the second node, and the calculated value B It is used to send to the first node, so the calculated value B can be regarded as the public key of the second node.
  • Method 2 The first key agreement parameter satisfies the second situation above, that is, the first key agreement parameter includes a fresh parameter, and the second node may generate the first target key according to the second target key and the fresh parameter.
  • the second target key may be a shared key between the first node and the second node.
  • the second node may generate the first target key through KDF.
  • Method 3 The first key agreement parameter satisfies the second situation above, that is, the first key agreement parameter includes a fresh parameter, and in the case that the algorithm identification tag is obtained in the second node, the second node can use the second target key K2
  • the algorithm identifier can be used to indicate the algorithm used to generate the first target key.
  • the character string "encryption” is used to indicate the algorithm used to generate the encryption key
  • the character string "integrity” is used to indicate the algorithm used to generate the integrity.
  • the algorithm to protect the key can also be used to indicate the use of a certain hash algorithm.
  • the character string "SHA256” is used to indicate that the algorithm for determining the first target key is the SHA256 algorithm.
  • the algorithm identification can also be represented by an algorithm identification or a numerical value. For example, 01 represents an AES encryption algorithm, and 10 represents an AES-cypher-based message authentication (AES-cypher-based message authentication code, AES-CMAC) integrity algorithm.
  • the algorithm identifier may be preset between the first node and the second node, or may be sent to the second node after being determined by the first node.
  • Method 4 The first key agreement parameter satisfies the second situation above, that is, the first key agreement parameter includes fresh parameters.
  • the type represents the key type. For example, the character string "encryption” is used to indicate that it is used to generate an encryption key, and the character string "integrity" is used to indicate that it is used to generate an integrity protection key.
  • the algorithm identifier is used to indicate the algorithm used to generate the first target key.
  • the key type may be indicated in the first key update request, or may be pre-negotiated between the first node and the second node before generating the first target key.
  • the second node may first determine according to the first target key K2 and the fresh parameter fresh.
  • the intermediate key determines the first target key K1 according to at least one of the algorithm identification tag and the key type type according to the intermediate key.
  • KDF1 and KDF2 can be the same key derivation function or different key derivation functions.
  • the first node only needs to generate new fresh parameters when determining the intermediate key Kmid, and does not need to generate new fresh parameters every time the first target is determined, which reduces the number of times to generate fresh parameters. It is more convenient to manage the generated fresh parameters.
  • the first target key generated in the second node is applied after the time from the first update time.
  • the first target key is applied after the communication frame starting from the first update time.
  • the second node may obtain the third frame number (or the MAC sequence number corresponding to the third frame number) carried in the key update request when the key was updated last time, if the second node detects The frame number of the communication frame has been reversed (or restarted a new round of counting) once, and the frame number of the current communication frame is equal to or greater than the third frame number (or the MAC sequence number corresponding to the third frame number), and this
  • the security context can be deleted to facilitate the re-initiation of the connection with the other party and ensure communication Security in the process.
  • the security context includes at least one of security information such as a shared key, a key validity period, and key update time.
  • the second node may also obtain the frame number of the communication frame when the key updated last time is used for communication for the first time, if the second node detects that the frame number of the communication frame has been inverted once, and the current communication frame The frame number of is equal to or greater than the frame number of the communication frame when the key updated last time is applied for the first communication, and the key update request has not been received or the new key has not been applied, the second node can The connection with the first node is disconnected, and further, the security context can be deleted to ensure the security in the communication process.
  • Step S504 The second node sends a first response message to the first node.
  • the first response message includes second identity authentication information, which is used to authenticate the identity of the second node.
  • the first response message also includes the second key agreement algorithm parameter KEs.
  • the first response message also includes random values NONCEs generated by the second node.
  • the second identity authentication information may be generated by the second node based on the first shared key between the first node and the second node.
  • the second identity authentication information may be generated by a cryptographic algorithm.
  • HMAC receives input of one or more character parameters and outputs an identification, which can be used as identity authentication information.
  • HMAC as an example for the cryptographic algorithm as an example to illustrate:
  • the parameters used to generate the second identity authentication information may also include other parameters (such as the number of the second node, the address of the second node, or the relationship between the second node and the first node). Connection identification, etc.).
  • the first response message includes parameters such as the second key agreement parameter KEs and/or the random value NONCEs, the second node may not use these parameters to generate the identity authentication information AUTHs.
  • the first response message is a response message sent by the second node after the first identity authentication information is authenticated according to the first key agreement parameter and the first shared key.
  • Step S505 The first node verifies the second identity authentication information through the first shared key.
  • the second identity information is generated by the second node according to the first shared key between the first node and the second node, so the first node can verify whether the second identity authentication information is correct according to the first shared key .
  • the first node should also use the same parameters to generate the identity authentication information for verification. If the verified identity authentication information is the same as the second identity authentication information, it is considered that the verification is passed.
  • the second identity authentication information can be generated by HMAC, so the first node can generate identity authentication information for verification through HMAC, also called check value check2, and then pass the identity authentication information verification for verification. Whether the second identity authentication information is correct.
  • HMAC also called check value check2
  • the first identity authentication information AUTHs is HMAC (PSK, KEs)
  • the first node uses the pre-shared key PSK with the second node and the second key negotiation parameter KEs in the first response message
  • the check value check2 HMAC (PSK, KEs) is obtained through HMAC. If the check value check2 is the same as AUTHs, the verification is passed.
  • the first node can disconnect the connection with the second node, or send information indicating that the update failed to the second node , Or discard the first response message without responding, so as to ensure the data security during the data update process, and also to facilitate the connection with the node that needs to update the key.
  • the first node may verify the message integrity of the first response message to prevent the information in the first response message from being tampered with by other devices.
  • the second node may add an integrity protection verification identifier to the first response message, and the first node verifies the message integrity of the first response message through the integrity protection verification identifier, and if the verification passes, it continues to verify the second identity authentication information If the verification fails, the first node can disconnect the connection with the second node, or send a message indicating update failure to the second node, or discard the first response message without responding to ensure data update Data security in the process.
  • Step S506 If the second identity authentication information is verified, the first node determines the first target key according to the first key agreement parameter.
  • the first node determines the first target key according to the first key negotiation parameter, and there are at least the following optional methods:
  • the first key agreement parameter satisfies the first situation above, that is, the first key agreement parameter includes the parameter of the key agreement algorithm, and the first response message includes the second key agreement parameter KEs.
  • the first node may generate the first target key according to the first key agreement algorithm parameter KEm and the second key agreement algorithm parameter KEs.
  • the parameters of the DH algorithm generated in the first node include the prime number p, the random number g, the random number a, and the first calculated value A.
  • the first node receives the data from the second node.
  • the parameters of the DH algorithm include the first calculated value B.
  • Method 2 The first key agreement parameter satisfies the second situation above, that is, the first key agreement parameter includes a fresh parameter, and the first node generates the first target key according to the second target key and the fresh parameter.
  • the first node may generate the first target key through KDF.
  • the first key agreement parameter satisfies the second situation above, that is, the first key agreement parameter includes a fresh parameter
  • the first node in the case that the algorithm identification tag is obtained in the first node, the first node can use the second target key K2 ,
  • the algorithm identifier can be used to indicate the algorithm used to generate the first target key.
  • the character string "encryption” is used to indicate the algorithm used to generate the encryption key
  • the character string "integrity” is used to indicate the algorithm used to generate the integrity.
  • the algorithm to protect the key can also be used to indicate the use of a certain hash algorithm.
  • the character string "SHA256” is used to indicate that the algorithm for determining the first target key is the SHA256 algorithm.
  • the algorithm identification can also be represented by an algorithm identification or a numerical value. For example, 01 represents an AES encryption algorithm, and 10 represents an AES-cypher-based message authentication (AES-cypher-based message authentication code, AES-CMAC) integrity algorithm.
  • the algorithm identifier may be preset between the first node and the second node, or may be determined by the first node.
  • Method 4 The first key agreement parameter satisfies the second situation above, that is, the first key agreement parameter includes a fresh parameter.
  • the first node can be based on the second
  • the type represents the key type.
  • the character string "encryption” is used to indicate that it is used to generate an encryption key
  • the character string "integrity" is used to indicate that it is used to generate an integrity protection key.
  • the algorithm identifier is used to indicate the algorithm used to generate the first target key.
  • the key type may be indicated in the first key update request, or may be pre-negotiated between the first node and the second node before generating the first target key.
  • the first node may first determine according to the first target key K2 and the fresh parameter fresh.
  • the intermediate key determines the first target key K1 according to at least one of the algorithm identification tag and the key type type according to the intermediate key.
  • KDF1 and KDF2 can be the same key derivation function or different key derivation functions.
  • K1 KDF2(KDF1(K2, fresh), tag, type).
  • the first target key may be applied as a shared key between the first node and the second node, including a master key, a session key, and so on.
  • the first target target key may be applied within the time starting from the first update time.
  • the first target key is the master key
  • the information indicating the first secret key included in the first key update request is the timestamp "1590921570", indicating that the time when the first target key is activated is 2020 At 00:52:50 on February 06, the first node and the second node will use the first target key as the master key after the time from 00:52:50 on February 06, 2020.
  • the first target target key may be applied to the validity period of the first target key.
  • the first target key is the master key
  • the information indicating the first secret key included in the first key update request is the timestamp "1590952447", indicating that the validity period of the first target key is February 2020 Within 09:28:26 on the 06th, the first node and the second node can use the first target key as the master key at 09:28:26 on February 06, 2020.
  • the second node may also detect the validity period of the first target key, so that the new target key can be determined before the validity period of the first target key.
  • the first target key is applied to the validity period of the first target key starting from the first update time Inside.
  • the second target key may be an encryption key.
  • the first key update request may be encrypted by the second target key.
  • the second node receives the first key update request .
  • You can use the second target to decrypt.
  • the first response request can be encrypted with the second target key. Accordingly, after the first node receives the first response message, it can use the second target to decrypt it.
  • the second target key may be an integrity protection key.
  • the first key update request may undergo integrity protection through the second target key.
  • the second node can use the second target key to check the integrity of the data.
  • the first response request can be integrity protected by the second target key.
  • the first node can use the second target key to check the integrity of the data.
  • the time to update the key is configured. Therefore, when the new key is updated, because the old key has expired, the encryption process needs to be terminated when the key is updated, and then the key update is completed.
  • the encryption process is resumed, but the termination of the encryption process and the resumption of the encryption process will affect the key update efficiency, and the termination of the encryption process will affect the security.
  • the key update method of the present application the key is updated before the old key expires. Since the old key has not expired, there is no need to terminate the encryption process, which improves the efficiency of key update and improves data security.
  • the second target key may be the master key.
  • the second target key may be used to determine the encryption key or the integrity protection key. Therefore, the first key update request may be processed according to the first key update request.
  • the encryption key determined by the second target key is encrypted, and/or the integrity protection is performed through the integrity protection key determined according to the second target key.
  • the second node can use the encryption key determined according to the second target key to decrypt the first key update request, and/or, after completing the first key update request determined according to the second target key
  • the sexual protection key may use the integrity protection key determined according to the second target key to check the integrity of the data.
  • the first response request may be encrypted with an encryption key determined according to the second target key, and/or integrity protected with an integrity protection key determined according to the second target key.
  • the first node may use the encryption key determined according to the second target key to decrypt the first response message, and/or, after passing through the integrity protection key determined according to the second target key The integrity of the data can be checked using the integrity protection key determined according to the second target key.
  • the first response message may also be encrypted by the first target key or Carry out integrity protection.
  • the first node detects whether the counter value has been reversed (or restarts a new round of counting), and when the counter value occurs Before the reversal, the first key update request is sent to the second node, and the determined first target key is the master key.
  • the first node may disconnect the communication connection with the second node to facilitate re-accessing the second node and ensure that the first node is connected to the second node. The security of the two-node communication process.
  • the first node may obtain the third frame number (or the MAC sequence number corresponding to the third frame number) carried in the key update request when the key was updated last time, if the first node detects The frame number of the communication frame has been inverted once, and the frame number of the current communication frame is equal to or greater than the third frame number (or the MAC sequence number corresponding to the third frame number), and the key update request has not been sent or has not yet Applying the new key, the first node can disconnect the connection with the second node.
  • the security context can be deleted to facilitate the re-initiation of the connection with the other party and ensure the security in the communication process.
  • the first node and the second node generate identity authentication information according to the first shared key, and one of the nodes first passes the identity authentication after receiving a message from the other node.
  • the information determines the identity of another node.
  • the key is updated according to the first key agreement parameter to obtain the first target key. In this case, even if the eavesdropper has broken the original session The key still cannot forge identity information, thereby avoiding man-in-the-middle attacks and improving data security during the key update process.
  • FIG. 6 is another key update method provided by an embodiment of the present application, and the method includes at least the following steps:
  • Step S601 The first node sends a first key update request to the second node.
  • the first key update request may be encrypted by an encryption key determined according to the second target key and/or integrity protection may be performed by an integrity key determined according to the second target key.
  • the second target key is a shared key between the first node and the second node.
  • the first key update request includes the first key agreement parameter and the first identity authentication information.
  • the first key agreement parameter may be the first key agreement algorithm parameter KEm.
  • the first key update request may further include at least one of a random value NONCEm, information timer indicating the first update time, and information expiration indicating the validity period of the first target key.
  • the first identity authentication information in the first key update request may be generated by the first shared key between the first node and the second node, where the first shared key may include the master secret. Key, pre-shared key PSK, etc.
  • the function for generating the first identity authentication information can be a cryptographic algorithm.
  • the cryptographic algorithm as HMAC as an example
  • the first key update request includes parameters such as the first key agreement algorithm parameter KEm, the random value NONCEm, the information expiration indicating the validity period of the first target key, or the information timer of the first update time, the first node
  • some or all of the parameters may not be used.
  • the first node may send a first key update request to the second node through the first communication frame, wherein the second frame number of the first communication frame is smaller than the key used in the last key update
  • the third frame number carried in the update request, and the third frame number is used to indicate the start time of the last updated key.
  • the first frame number carried in the first key update request is greater than the second frame number and less than the third frame number.
  • the third frame number is 2365, indicating that after the last updated key is applied to the communication frame starting from frame number 2365, the first node needs to determine the first target key before the frame number reaches 2365 again, so the first The node may send the first key update request in the first communication frame with the frame number 2345, and the first key update request uses the first frame number 2355 to indicate the start time of the first target key.
  • the encryption method used can be based on the frame number and the key updated last time. Therefore, it is determined before the frame number repeats to the frame number of the last key update.
  • the first target key is used to encrypt the data frame by the first target key, so that the data frame with the same frame number twice can be encrypted by different keys, which improves the security of the data.
  • the first node may pre-configure the target frame number, if the first node When it is detected that the difference between the current communication frame number and the target frame number is less than or equal to the first threshold, the first key update request is sent.
  • Step S602 The second node decrypts the first key update request.
  • the second node may use the encryption key determined according to the second target key to decrypt the first key update request.
  • Step S603 The second node verifies the integrity of the message of the first key update request.
  • the second node may disconnect the communication connection with the first node, or the second node may send information indicating that the update fails to the first node, or the second node may discard the first secret. Key update request.
  • the second node may not perform step S603. In this case, after performing step S602, the second node may continue to perform step S604 and the steps after step S604.
  • Step S604 The second node verifies the first identity authentication information.
  • the first identity authentication information is generated by the first node according to the first shared key between the first node and the second node, so the second node can verify the first identity authentication according to the first shared key Is the information correct?
  • the second node should also use the same parameters to generate the identity authentication information for verification. If the verified identity authentication information is the same as the first identity authentication information, it is considered that the verification is passed.
  • the first identity authentication information is generated through HMAC, so the second node can generate identity authentication information for verification through HMAC, also called check value check1, and then verify the first identity authentication information through HMAC. 1. Whether the identity authentication information is correct.
  • the second node may disconnect the communication connection with the first node, or the second node may send information indicating that the update failed to the first node, or the second node may discard the The first key update request.
  • the second node may also perform the operation of step S604 first and then perform the operation of step S603.
  • Step S605 If the first identity authentication information is verified, the second node generates a first target key according to the first key agreement algorithm parameter and the second key agreement algorithm parameter.
  • the second node may determine the second key agreement algorithm parameter KEs of the key agreement algorithm.
  • the second node generates the first target key according to the first key agreement algorithm parameter KEm and the second key agreement algorithm parameter KEs.
  • the second node receives from the first node the parameters of the DH algorithm including the prime number p, the random number g, and the first calculated value A, and the second node can determine the value of the DH algorithm
  • Step S606 the second node sends a first response message to the first node.
  • the first response message may be encrypted by an encryption key determined according to the second target key and/or integrity protection may be performed by an integrity key determined according to the second target key.
  • the key is a shared key between the second node and the first node.
  • the first response message includes the second identity authentication information and the second key agreement algorithm parameter KEs.
  • the second identity authentication information is used to verify the identity of the second node.
  • a shared secret key is generated.
  • the first response message may also include random values NONCEs.
  • the second identity authentication information may be generated by a cryptographic algorithm.
  • the first key update request includes parameters such as the second key agreement algorithm parameter KEs and the random value NONCEs
  • the second node may not use some or all of the parameters to generate the second identity authentication information AUTHs.
  • the second node may also perform the operation of step S606 first and then perform the operation of step S605.
  • Step S607 The first node decrypts the first response message.
  • the first node may use the encryption key determined according to the second target key to decrypt the first response message.
  • the first node may also perform the operation of step S607 first and then perform the operation of step S606.
  • Step S608 The first node verifies the message integrity of the first response message.
  • the first node may disconnect the connection with the second node, or send information indicating that the update fails to the second node, or discard the first response message.
  • the first node may not perform step S608.
  • the first node may continue to perform step S609 and the steps after step S609.
  • Step S609 The first node verifies the second identity authentication information.
  • the second identity information is generated by the second node according to the first shared key between the first node and the second node, so the first node can verify whether the second identity authentication information is correct according to the first shared key .
  • the first node should also use the same parameters to generate the identity authentication information for verification. If the verified identity authentication information is the same as the second identity authentication information, it is considered that the verification is passed.
  • the second identity authentication information can be generated by HMAC, so the first node can generate identity authentication information for verification through HMAC, also called check value check2, and then pass the identity authentication information for verification. Whether the second identity authentication information is correct.
  • HMAC also called check value check2
  • the first identity authentication information AUTHs is HMAC (PSK, KEs)
  • the first node uses the pre-shared key PSK with the second node and the second key negotiation parameter KEs in the first response message
  • the check value check2 HMAC (PSK, KEs) is obtained through HMAC. If the check value check2 is the same as AUTHs, the verification is passed.
  • the first node may disconnect the connection with the second node, or send information indicating that the update fails to the second node, or discard the first response message.
  • the first node may also perform the operation of step S609 first and then perform the operation of step S608.
  • Step S610 If the second identity authentication information is verified, the first node generates a first target key according to the first key agreement algorithm parameter and the second key agreement algorithm parameter.
  • the first node since the first response message includes the second key agreement algorithm parameter KEs, the first node generates the first target key according to the first key agreement algorithm parameter KEm and the second key agreement algorithm parameter KEs.
  • the parameters of the DH algorithm generated in the first node include the prime number p, the random number g, the random number a, and the first calculated value A.
  • the first node receives the data from the second node.
  • the parameters of the DH algorithm include the first calculated value B.
  • the first target key may be applied as a shared key between the first node and the second node, or may be applied to a master key or a session key.
  • the first node and the second node generate identity authentication information according to the first shared key, and one of the nodes first passes the identity authentication after receiving a message from the other node.
  • the information determines the identity of another node.
  • the key is updated according to the first key agreement parameter to obtain the first target key. In this case, even if the eavesdropper has broken the original session The key still cannot forge identity information, thereby avoiding man-in-the-middle attacks and improving data security during the key update process.
  • FIG. 7 is another key update method provided by an embodiment of the present application, and the method includes at least the following steps:
  • Step S701 The first node sends a first key update request to the second node.
  • the first key update request may be encrypted by an encryption key determined according to the second target key and/or integrity protection may be performed by an integrity key determined according to the second target key.
  • the second target key is a shared key between the second node and the first node.
  • the first key update request includes the first key agreement parameter and the first identity authentication information.
  • the first key agreement parameter may be a fresh parameter fresh.
  • the first key request may further include at least one of a random value NONCEm, information timer indicating the first update time, and information expiration indicating the validity period of the first target key.
  • the first identity authentication information in the first key update request may be generated by the first shared key between the first node and the second node, where the first shared key may include the master secret. Key, pre-shared key PSK, etc.
  • the function for generating the first identity authentication information may be a cryptographic algorithm.
  • the cipher algorithm as HMAC as an example
  • the first key update request includes information such as the fresh parameter fresh, the random value NONCEm, the information expiration indicating the validity period of the first target key, or the information timer of the first update time
  • the first node generates the first identity authentication
  • the information AUTHm may or may not use some or all of the parameters.
  • the first node may send a first key update request to the second node through the first communication frame, wherein the second frame number of the first communication frame is smaller than the key used in the last key update
  • the third frame number carried in the update request, and the third frame number is used to indicate the start time of the last updated key.
  • the first frame number carried in the first key update request is greater than the second frame number and less than the third frame number.
  • the third frame number is 2365, indicating that after the last updated key is applied to the communication frame starting from frame number 2365, the first node needs to determine the first target key before the frame number reaches 2365 again, so the first The node may send the first key update request in the first communication frame with the frame number 2345, and the first key update request uses the first frame number 2355 to indicate the start time of the first target key.
  • the encryption method used can be based on the frame number and the key updated last time. Therefore, it is determined before the frame number repeats to the frame number of the last key update.
  • the first target key is used to encrypt the data frame by the first target key, so that the data frame with the same frame number twice can be encrypted by different keys, which improves the security of the data.
  • the first node may pre-configure the target frame number, if the first node When it is detected that the difference between the current communication frame number and the target frame number is less than or equal to the first threshold, the first key update request is sent.
  • Step S702 The second node decrypts the first key update request.
  • the second node may use the encryption key determined according to the second target key to decrypt the first key update request.
  • Step S703 The second node verifies the integrity of the message of the first key update request.
  • the second node may disconnect the communication connection with the first node, or the second node may send information indicating that the update failed to the first node, or the second node may discard the The first key update request.
  • the second node may not perform step S703. In this case, after performing step S702, the second node may continue to perform step S704 and the steps after step S704.
  • Step S704 The second node verifies the first identity authentication information.
  • the first identity authentication information is generated by the first node according to the first shared key between the first node and the second node, so the second node can verify the first identity authentication according to the first shared key Is the information correct?
  • the second node should also use the same parameters to generate the identity authentication information for verification. If the verified identity authentication information is the same as the first identity authentication information, it is considered that the verification is passed.
  • the first identity authentication information is generated through HMAC, so the second node can generate identity authentication information for verification through HMAC, also called check value check1, and then verify the first identity authentication information through HMAC. 1. Whether the identity authentication information is correct.
  • the second node uses the pre-shared key PSK with the first node
  • the second node may disconnect the communication connection with the first node, or the second node may send information indicating that the update failed to the first node, or the second node may discard the The first key update request.
  • the second node may also perform the operation of step S704 first and then perform the operation of step S703.
  • Step S705 If the first identity authentication information is verified, the second node generates the first target key according to the second target key and the freshness parameter.
  • the second node may disconnect the communication connection with the first node, or the second node may send information indicating that the update failed to the first node, or the second node may discard the The first key update request.
  • Step S706 The second node sends a first response message to the first node.
  • the first key update request may be encrypted by an encryption key determined according to the second target key and/or integrity protection may be performed by an integrity key determined according to the second target key.
  • the second target key is a shared key between the second node and the first node.
  • the first response message includes second identity authentication information, where the second identity authentication information is used to verify the identity of the second node, and may be generated by the first shared key between the first node and the second node.
  • the first response message may also include random values NONCEs.
  • the algorithm for generating the second identity authentication information may be a cryptographic algorithm.
  • the first response message includes parameters such as random values NONCEs
  • the second node may not use these parameters to generate the second identity authentication information AUTHs.
  • the second node may also perform the operation of step S706 first and then perform the operation of step S705.
  • Step S707 The first node decrypts the first response message.
  • the first node may use the encryption key determined according to the second target key to decrypt the first response message.
  • Step S708 The first node verifies the message integrity of the first response message.
  • the first node of the first node may disconnect the connection with the second node, or send information indicating that the update has failed to the second node, or discard the first node or discard the first node. Response message.
  • the first node may not perform step S708. In this case, after performing step S707, the first node may continue to perform step S709 and the steps after step S709.
  • Step S709 The first node verifies the second identity authentication information.
  • the second identity information is generated by the second node according to the first shared key between the first node and the second node, so the first node can verify whether the second identity authentication information is correct according to the first shared key .
  • the first node should also use the same parameters to generate the identity authentication information for verification. If the verified identity authentication information is the same as the second identity authentication information, it is considered that the verification is passed.
  • the second identity authentication information can be generated by HMAC, so the first node can generate identity authentication information for verification through HMAC, also called check value check2, and then pass the identity authentication information verification for verification. Whether the second identity authentication information is correct.
  • HMAC also called check value check2
  • the first identity authentication information AUTHs is HMAC (PSK, NONCEs)
  • the first node obtains the calibration through HMAC according to the pre-shared key PSK with the second node and the random value NONCEs in the first response message.
  • the verification value check2 HMAC (PSK, NONCEs), if the verification value check2 is the same as AUTHs, the verification is passed.
  • the first node may disconnect the communication connection with the second node, or send information indicating that the update fails to the second node, or discard the first response message.
  • the first node may also perform the operation of step S709 first and then perform the operation of step S708.
  • Step S710 If the second identity authentication information is verified, the first node generates the first target key according to the second target key and the freshness parameter.
  • the first node can click to generate the first target key through the key derivation function according to the second target key and the fresh parameter.
  • the second node can determine the first target according to the second target key K2 and the fresh parameter fresh.
  • the first target key may be applied as a shared key between the first node and the second node, including a master key, a user session key, and the like.
  • the first node and the second node generate identity authentication information according to the first shared key, and one of the nodes first passes identity authentication after receiving a message from the other node The information determines the identity of another node.
  • the key is updated according to the second target key and fresh parameters to obtain the first target key. In this case, even if the eavesdropper has broken the original The session key is still unable to forge identity information, thereby avoiding man-in-the-middle attacks and improving data security during the key update process.
  • FIG. 8 is another key update method provided by an embodiment of the present application.
  • the method includes but is not limited to the following steps:
  • Step S801 The first node sends a first key update request to the second node.
  • the first key update request may be encrypted by an encryption key determined according to the second target key and/or integrity protection may be performed by an integrity key determined according to the second target key.
  • the second target key is a shared key between the second node and the first node.
  • the first key update request includes the first key agreement parameter and the freshness parameter fresh and the first identity authentication information.
  • the first key agreement parameter may be a fresh parameter fresh.
  • the first key request may further include at least one of a random value NONCEm, information timer indicating the first update time, and information expiration indicating the validity period of the first target key.
  • the first identity authentication information in the first key update request may be generated by the first shared key between the first node and the second node, where the first shared key may include the master secret. Key, pre-shared key PSK, etc.
  • the algorithm for generating the first identity authentication information may be a cryptographic algorithm.
  • the first key update request includes information such as the fresh parameter fresh, the random value NONCEm, the information expiration indicating the validity period of the first target key, or the information timer of the first update time
  • the first node generates the first identity authentication
  • the information AUTHm may not use some or all of the parameters.
  • the first node may send a first key update request to the second node through the first communication frame, wherein the second frame number of the first communication frame is smaller than the key used in the last key update
  • the third frame number carried in the update request, and the third frame number is used to indicate the start time of the last updated key.
  • the first frame number carried in the first key update request is greater than the second frame number and less than the third frame number.
  • the third frame number is 2365, indicating that after the last updated key is applied to the communication frame starting from frame number 2365, the first node needs to determine the first target key before the frame number reaches 2365 again, so the first The node may send the first key update request in the first communication frame with the frame number 2345, and the first key update request uses the first frame number 2355 to indicate the start time of the first target key.
  • the encryption method used can be based on the frame number and the key updated last time. Therefore, it is determined before the frame number repeats to the frame number of the last key update.
  • the first target key is used to encrypt the data frame by the first target key, so that the data frame with the same frame number twice can be encrypted by different keys, which improves the security of the data.
  • the first node may pre-configure the target frame number, if the first node When it is detected that the difference between the current communication frame number and the target frame number is less than or equal to the first threshold, the first key update request is sent.
  • Step S802 The second node decrypts the first key update request.
  • the second node may use the encryption key determined according to the second target key to decrypt the first key update request.
  • Step S803 The second node verifies the integrity of the message of the first key update request.
  • the second node may disconnect the communication connection with the first node, or the second node may send information indicating that the update fails to the first node, or the second node may discard the first node.
  • a key update request does not respond.
  • the second node may not perform step S803. In this case, after performing step S802, the second node may continue to perform step S804 and the steps after step S804.
  • Step S804 The second node verifies the first identity authentication information.
  • the second node may disconnect the communication connection with the first node, or the second node may send information indicating that the update failed to the first node, or the second node may discard the The first key update request.
  • the second node may also perform the operation of step S804 first and then perform the operation of step S803.
  • Step S805 If the first identity authentication information is verified, the second node generates the first target key according to the second target key, the freshness parameter, and the algorithm identifier.
  • the algorithm identifier may be used to indicate the algorithm for generating the key.
  • the algorithm identification can be used to indicate the identification of the algorithm for generating keys such as the master key, encryption key or integrity protection key, such as the use of the string "encryption” to indicate the generation of the encryption key, and the use of the string "integrity” to indicate Generate an integrity protection key.
  • the algorithm identifier can also be used to indicate the use of a certain hash algorithm, for example, using the character string "SHA256" to indicate that the algorithm for determining the first target key is the SHA256 algorithm.
  • the algorithm identifier may be preset between the first node and the second node, or may be sent to the second node after being determined by the first node.
  • the second node can determine the first target key K1 according to the second target key K2, the fresh parameter fresh, and the algorithm identification tag.
  • the type represents the key type.
  • the character string "encryption” is used to indicate that it is used to generate an encryption key
  • the character string "integrity” is used to indicate that it is used to generate an integrity protection key.
  • the second node may first determine the intermediate key according to the first target key K2 and the fresh parameter fresh, and then determine the first target secret according to at least one of the algorithm identification tag and the key type according to the intermediate key.
  • Step S806 the second node sends a first response message to the first node.
  • the first response message may be encrypted by an encryption key determined according to the second target key and/or integrity protection may be performed by an integrity key determined according to the second target key.
  • the key is a shared key between the second node and the first node.
  • the first response message includes second identity authentication information, where the second identity authentication information is used to authenticate the identity of the second node.
  • the second identity authentication information may be generated by the first shared key between the first node and the second node.
  • the first response message also includes random values NONCEs.
  • the algorithm for generating the second identity authentication information may be a cryptographic algorithm.
  • the first response message includes parameters such as random values NONCEs
  • the second node may not use these parameters to generate the second identity authentication information AUTHs.
  • the second node may also perform the operation of step S806 first and then perform the operation of step S805.
  • Step S807 The first node decrypts the first response message.
  • the first node may use the encryption key determined according to the second target key to decrypt the first response message.
  • Step S808 The first node verifies the message integrity of the first response message.
  • the first identity authentication information is generated by the first node according to the first shared key between the first node and the second node, so the second node can verify the first identity authentication according to the first shared key Is the information correct?
  • the first node may not perform step S808. In this case, after performing step S807, the first node may continue to perform step S809 and the steps after step S809.
  • Step S809 The first node verifies the second identity authentication information.
  • the second identity information is generated by the second node according to the first shared key between the first node and the second node, so the first node can verify whether the second identity authentication information is correct according to the first shared key .
  • the second node should also use the same parameters to generate the identity authentication information for verification. If the verified identity authentication information is the same as the first identity authentication information, it is considered that the verification is passed.
  • the first identity authentication information is generated through HMAC, so the second node can generate identity authentication information for verification through HMAC, also called check value check1, and then verify the first identity authentication information through HMAC. 1. Whether the identity authentication information is correct.
  • the second node uses the pre-shared key PSK with the first node
  • the first node can disconnect the connection with the second node, or send a message indicating that the update failed to the second node, or The first response message is discarded.
  • Step S809 The first node verifies the second identity authentication information through the first shared key.
  • the second identity information is generated by the second node according to the first shared key between the first node and the second node, so the first node can verify whether the second identity authentication information is correct according to the first shared key .
  • the first node should also use the same parameters to generate the identity authentication information for verification. If the verified identity authentication information is the same as the second identity authentication information, it is considered that the verification is passed.
  • the second identity authentication information can be generated by HMAC, so the first node can generate identity authentication information for verification through HMAC, also called check value check2, and then pass the identity authentication information verification for verification. Whether the second identity authentication information is correct.
  • HMAC also called check value check2
  • the first identity authentication information AUTHs is HMAC (PSK, NONCEs)
  • the first node obtains the calibration through HMAC according to the pre-shared key PSK with the second node and the random value NONCEs in the first response message.
  • the verification value check2 HMAC (PSK, NONCEs), if the verification value check2 is the same as AUTHs, the verification is passed.
  • the first node may disconnect the connection with the second node, or send information indicating that the update fails to the second node, or discard the first response message.
  • the first node may also perform the operation of step S809 first and then perform the operation of step S808.
  • Step S810 If the second identity authentication information is verified, the first node generates the first target key according to the second target key and the freshness parameter.
  • the algorithm identifier may be used to indicate the algorithm for generating the key.
  • the algorithm identification can be used to indicate the identification of the algorithm for generating keys such as the master key, encryption key or integrity protection key, such as the use of the string "encryption” to indicate the generation of the encryption key, and the use of the string "integrity” to indicate Generate an integrity protection key.
  • the algorithm identifier can also be used to indicate the use of a certain hash algorithm, for example, using the character string "SHA256" to indicate that the algorithm for determining the first target key is the SHA256 algorithm.
  • the algorithm identifier may be preset between the first node and the second node, or may be determined by the first node.
  • the first node may first determine the intermediate key according to the first target key K2 and the fresh parameter fresh, and then determine the first target secret according to at least one of the algorithm identification tag and the key type according to the intermediate key.
  • the first target key may be applied as a shared key between the first node and the second node, including a master key, a user session key, and the like.
  • the first node and the second node generate identity authentication information according to the first shared key, and one of the nodes first passes the identity authentication after receiving a message from the other node. The information determines the identity of another node.
  • the key is updated according to the second target key, fresh parameters and algorithm identification, and the first target key is obtained. In this case, even if the eavesdropper has compromised Even with the original session key, the identity information cannot be forged, thereby avoiding man-in-the-middle attacks and improving data security during the key update process.
  • the first key update request sent by the first node may not carry the first identity authentication information, and accordingly, the second node may not perform The process of verifying the first identity information.
  • the first response message may not carry the second identity authentication information, and accordingly, the second node may not perform the process of verifying the second identity authentication information.
  • the first key update request is encrypted by the second target key (or the session key derived from the second target key), which can also achieve the purpose of authenticating the identities of both parties.
  • the first node and the second node include a master key and a session key.
  • the session key is a key determined according to the master key
  • the master key expires, you can The master key is updated through the key update method shown in Figure 6 or Figure 7.
  • the session key determined according to the master key also needs to be updated. Therefore, the first node and the second node can reuse the graph.
  • the key update method shown in 8 updates the session key.
  • FIG. 9 is a schematic structural diagram of a device 90 provided by an embodiment of the present application.
  • the device 90 may be an electronic device with data transceiving capability, or one of the electronic devices with data transceiving capability.
  • a device such as a chip or an integrated circuit, etc., the device 90 may include a sending unit 901, a receiving unit 902, a verification unit 903, and a determining unit 904. The description of each unit is as follows:
  • the sending unit 901 is configured to send a first key update request to a second node, where the first key update request includes a first key agreement parameter and first identity authentication information, and the first identity authentication information is Generated by the first shared key;
  • the receiving unit 902 is configured to receive a first response message from the second node, where the first response message includes second identity authentication information;
  • the verification unit 903 is configured to verify the second identity authentication information through the first shared key
  • the determining unit 904 is configured to determine the first target key according to the first key agreement parameter if the second identity authentication information is verified.
  • the aforementioned device 90 and the second node generate identity authentication information according to the first shared key.
  • one node After receiving a message from another node, one node first determines the identity of the other node through the identity authentication information. After the identity authentication is passed, the key is updated according to the key negotiation parameters to obtain the first target key. In this case, even if the eavesdropper has broken the original session key, the identity information cannot be forged, thereby avoiding Man-in-the-middle attacks are eliminated, and data security during the key update process is improved.
  • the above-mentioned division of multiple units is only a logical division based on functions, and is not intended to limit the specific structure of the device 90.
  • some of the functional modules may be subdivided into more small functional modules, and some functional modules may also be combined into one functional module.
  • the device 90 is in the key
  • the general flow of the update process is the same.
  • the aforementioned multiple units can also be simplified into a communication unit and a processing unit.
  • the communication unit is used to implement one or more of the functions of the sending unit 901 and the receiving unit 902, and the processing unit is used to implement the verification unit 903 and the processing unit.
  • the function of one or more of the units 904 is determined.
  • each unit corresponds to its own program code (or program instruction), and when the program code corresponding to each of these units runs on the processor, the unit executes the corresponding process to realize the corresponding function.
  • the first key update request is used to indicate at least one of the first update time and the validity period of the first target key.
  • the time to update the key is pre-defined in the protocol and cannot be flexibly selected.
  • the device 90 provided in this application can customize the update time of the first target key and/or the validity period of the first target key, and instruct the second node to determine when to activate the first target key according to demand.
  • the target key is pre-defined in the protocol and cannot be flexibly selected.
  • the first key update request includes a first frame number, and the first key update request indicates the first update time through the first frame number.
  • the first frame number is indicated by multiple bits, for example, F bits.
  • the first key update request includes a media access control sequence number (MAC SN), the MAC SN is indicated by M bits, and the M bits are some of the F bits, M is less than F.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the first frame number carried in the first key update request is 2345
  • the first frame number may indicate that the first target key is applied after the communication frame starting from the frame number 2345.
  • the first target key is applied to the validity period of the first target key starting from the first update time.
  • the time to update the key is configured. Therefore, the new key is updated when the old key expires. Since the old key has expired, the encryption process needs to be terminated first when the key is updated. After the key update is completed, the encryption process can be resumed. However, terminating the encryption process and restoring the encryption process will affect the key update efficiency, and terminating the encryption process will affect security. In the device 90 of the present application, when the key is updated, since the old key has not expired, the encryption process does not need to be terminated, which improves the efficiency of key update and improves data security.
  • the first key agreement parameter includes a first key agreement algorithm parameter
  • the first response message also includes a second key agreement algorithm parameter
  • the determining unit 904 uses Generating the first target key according to the first key agreement algorithm parameter and the second key agreement algorithm parameter.
  • the first key agreement parameter includes a freshness parameter; the determining unit 904 is configured to generate the first target key according to the second target key and the freshness parameter .
  • the second target key may be a shared key between the first node and the second node, including a master key, a session key, and a pre-shared key PSK.
  • the first target key can be generated by a key derivation algorithm KDF.
  • KDF key derivation algorithm
  • fresh is a fresh parameter
  • the parameter used for update may include a counter value (counter), a sequence number (number), a random value (rand), a frame number (framenumber), and so on.
  • the first target key is the master key of the device 90.
  • the first key agreement parameter includes a freshness parameter
  • the determining unit 904 is configured to generate the first key agreement parameter according to the second target key, the freshness parameter, and an algorithm identifier.
  • the target key, and the algorithm identifier is used to mark the algorithm used to determine the encryption key or the integrity protection key.
  • the first target key is an integrity protection key or an encryption key of the device 90.
  • At least one of the first key update request and the first response message is encrypted by an encryption key determined according to a second target key, and/or, the first At least one of a key update request and the first response message is integrity protected by an integrity protection key determined according to the second target key.
  • the traditional key update method is to update the key when the old key expires. Since the second target key has expired, the process of determining the new key does not perform encryption and integrity protection.
  • the device 90 provided in the embodiment of the present application can determine the first target key before the key expires. Therefore, the first key update request and the first response message can use the key determined according to the second target key. Encryption, thereby improving data security.
  • the sending unit 901 is configured to send a first key update request to the second node through a first communication frame, where the second frame number of the first communication frame is less than the upper
  • the third frame number carried in the key update request used when the key is updated once the third frame number is used to indicate the start time of the last updated key, and the first frame number is greater than the second The frame number is smaller than the third frame number.
  • the encryption method used can be based on the frame number and the key updated last time. Therefore, it is determined before the frame number repeats to the frame number of the last key update.
  • the first target key is used to encrypt the data frame by the first target key, so that the data frame with the same frame number twice can be encrypted by different keys, which improves the security of the data.
  • the first key update request includes a MAC sequence number (MAC SN), not the first frame number, and the MAC SN is indicated by M bits, and the M bits are the For some of the F bits, M is smaller than F.
  • the third frame number carried in the key update request used in the last key update can also be replaced by MAC SN, that is, part of the multiple bits used to indicate the third frame number The indicated MAC SN.
  • the size relationship between the first, second, and third frame numbers remains unchanged.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the communication frame includes at least one of a signaling plane uplink frame, a signaling plane downlink frame, a user plane uplink frame, or a user plane downlink frame.
  • the sending unit 901 and the receiving unit 902 disconnect the communication connection with the second node or send to the second node through the sending unit 901 Update failed information.
  • the aforementioned device 90 can disconnect the communication connection with the second node or send the update failure information to the second node. It is convenient to re-initiate an access request to the node that needs to update the key, thereby ensuring data security during the key update process.
  • the verification unit 903 is further configured to perform integrity verification on the first response message; if the integrity verification is passed, continue to perform the verification by the first shared key. Said the step of the second identity authentication information;
  • the sending unit 901 and the receiving unit 902 disconnect the communication connection with the second node or send the update failure information to the second node or send the update failure information to the second node through the sending unit 901 .
  • the device 90 may first verify the integrity of the first response message before verifying the identity information, and determine that the information in the first response message has not been tampered with. If the integrity verification fails, it indicates that the data in the first response message has been tampered with and cannot continue to update the key. Therefore, the device 90 disconnects the communication connection with the second node or sends an update failure to the second node. The information facilitates the device 90 to re-access the node where the key needs to be updated, and also ensures the data security during the key update process.
  • each unit may also correspond to the corresponding description of any one of the embodiments shown in FIG. 5, FIG. 6, FIG. 7 or FIG. 8.
  • the device 90 is the first node in any one of the embodiments shown in FIG. 5, FIG. 6, FIG. 7 or FIG. 8.
  • FIG. 10 is a schematic structural diagram of an apparatus 100 provided by an embodiment of the present application.
  • the apparatus 100 may be an electronic device with a data transceiving capability, or one of the electronic devices with a data transceiving capability.
  • a device such as a chip or an integrated circuit, etc., the device 100 may include a receiving unit 1001, a verification unit 1002, a determining unit 1003, and a sending unit 1004, wherein the description of each unit is as follows:
  • the receiving unit 1001 is configured to receive a first key update request from a first node, where the first key update request includes first key negotiation parameters and first identity authentication information;
  • the verification unit 1002 is configured to verify the first identity authentication information through the first shared key
  • the determining unit 1003 is configured to determine a first target key according to the first key agreement parameter if the first identity authentication information is verified;
  • the sending unit 1004 is configured to send a first response message to the first node, where the first response message includes second identity authentication information, and the second identity authentication information is generated by the first shared key of.
  • the above-mentioned apparatus 100 and the first node Before the original session key expires, the above-mentioned apparatus 100 and the first node generate identity authentication information according to the first shared key. After receiving a message from another node, one node first determines the identity of the other node through the identity authentication information. Identity, after the identity authentication is passed, the key is updated according to the key negotiation parameters to obtain the first target key. In this case, even if the eavesdropper has broken the original session key, the identity information cannot be forged , Thereby avoiding man-in-the-middle attacks and improving data security during the key update process.
  • the above-mentioned division of multiple units is only a logical division based on functions, and is not intended to limit the specific structure of the device 100.
  • some of the functional modules may be subdivided into more small functional modules, and some functional modules may also be combined into one functional module.
  • the device 100 is in the key
  • the general flow of the update process is the same.
  • the above-mentioned multiple units can also be simplified into a communication unit and a processing unit.
  • the communication unit is used to implement the functions of the receiving unit 1001 and the sending unit 1004, and the processing unit is used to implement one of the verification unit 1002 and the determining unit 1003. Or multiple functions.
  • each unit corresponds to its own program code (or program instruction), and when the program code corresponding to each of these units runs on the processor, the unit executes the corresponding process to realize the corresponding function.
  • the first key update request is used to indicate at least one of the first update time and the validity period of the first target key.
  • the time to update the key is pre-defined in the protocol and cannot be flexibly selected.
  • the first node can customize the update time of the first target key and/or the validity period of the first target key, and instruct the device 100 to decide what to do according to demand. When the first target key is enabled.
  • the first key update request includes a first frame number, and the first key update request indicates the first update time through the first frame number.
  • the first frame number is indicated by multiple bits, for example, F bits.
  • the first key update request includes a media access control sequence number (MAC SN), the MAC SN is indicated by M bits, and the M bits are some of the F bits, M is less than F.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the first frame number carried in the first key update request is 2345
  • the first frame number may indicate that the first target key is applied after the communication frame starting from the frame number 2345.
  • the first target key is applied to the validity period of the first target key starting from the first update time.
  • the first key agreement parameter includes a first key agreement algorithm parameter
  • the first response message includes a second key agreement algorithm parameter
  • the determining unit 1003 is configured to The first target key is generated according to the first key agreement algorithm parameter and the second key agreement algorithm parameter.
  • the first key agreement parameter includes a fresh parameter; the determining unit 1003 is configured to generate the first target key according to the second target key and the fresh parameter .
  • the second target key may be a shared key between the first node and the second node, including a master key, a session key, and a pre-shared key PSK.
  • the first target key can be generated by a key derivation algorithm KDF.
  • KDF key derivation algorithm
  • fresh is a fresh parameter
  • the parameter used for update may include a counter value (counter), a sequence number (number), a random value (rand), a frame number (framenumber), and so on.
  • the first target key is the master key of the device 100.
  • the first key agreement parameter includes a freshness parameter
  • the determining unit 1003 is configured to generate the first key agreement parameter according to the second target key, the freshness parameter, and an algorithm identifier.
  • the target key, and the algorithm identifier is used to identify the algorithm used to determine the encryption key or the integrity protection key.
  • the first target key is an integrity protection key or an encryption key of the device 100.
  • At least one of the first key update request and the first response message is encrypted by an encryption key determined according to a second target key, and/or, the first At least one of a key update request and the first response message is integrity protected by an integrity protection key determined according to the second target key.
  • the traditional key update method is to update the key when the old key expires. Since the second target key has expired, the process of determining the new key does not perform encryption and integrity protection.
  • the device 100 can determine the first target key before the key expires, so the first key update request and the first response message can be encrypted using the key determined according to the second target key. Thereby improving data security.
  • the sending unit 1004 is further configured to: if the first identity information is not verified, the device 100 disconnects the communication connection with the first node or sends to the first node Information indicating that the update failed.
  • the apparatus 100 can disconnect the connection with the first node or send an update indicating that the update failed to the first node. Therefore, this key process is stopped to ensure the data security of the device 100 during the key update process.
  • the verification unit 1002 is further configured to perform integrity verification on the first response message; if the integrity verification is passed, continue to perform the verification through the first shared key The step of the second identity authentication information;
  • the sending unit 1004 is further configured to, if the integrity verification fails, the device 100 disconnects the communication connection with the first node or sends information indicating that the update fails to the first node.
  • the above-mentioned apparatus 100 Before verifying the identity information, the above-mentioned apparatus 100 first performs integrity verification on the first key update request, and determines that the information in the first key update request has not been tampered with. If the integrity verification fails, it indicates that the data in the first key update request has been tampered with and cannot continue to update the key. Therefore, the above-mentioned apparatus 100 may disconnect the connection with the first node or send an update indication to the first node that the update failed. The information to ensure the data security during the key update process.
  • each unit may also correspond to the corresponding description of any one of the embodiments shown in FIG. 5, FIG. 6, FIG. 7 or FIG. 8.
  • the device 100 is the second node in any one of the embodiments shown in FIG. 5, FIG. 6, FIG. 7 or FIG. 8.
  • FIG. 11 is a schematic structural diagram of an apparatus 110 provided by an embodiment of the present application.
  • the apparatus 110 may be an electronic device with a data transceiving capability, or one of the electronic devices with a data transceiving capability. Devices, such as chips or integrated circuits, etc.
  • the apparatus 110 may include a memory 1101, a processor 1102, and a communication interface 1103. Further optionally, a bus 1104 may be included, where the memory 1101, the processor 1102, and the communication interface 1103 are connected through the bus 1104.
  • the memory 1101 is used to provide storage space, and the storage space can store data such as an operating system and a computer program.
  • the memory 1101 includes but is not limited to random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or Portable read-only memory (compact disc read-only memory, CD-ROM).
  • the processor 1102 is a module that performs arithmetic operations and logical operations, and can be a processing module such as a central processing unit (CPU), a graphics processing unit (GPU), or a microprocessor (MPU) One or a combination of more.
  • a processing module such as a central processing unit (CPU), a graphics processing unit (GPU), or a microprocessor (MPU) One or a combination of more.
  • the communication interface 1103 is used to receive data sent from the outside and/or send data to the outside, and may be a wired link interface including an Ethernet cable, etc., or a wireless link (WIFI, Bluetooth, etc.) interface.
  • the communication interface may also include a transmitter (such as a radio frequency transmitter, etc.) or a receiver coupled with the interface.
  • the processor 1102 in the device 110 is configured to read the computer program code stored in the memory 1101, and perform the following operations:
  • the first key update request is sent to the second node through the communication interface 1103, where the first key update request includes the first key agreement parameter and the first identity authentication information, and the first identity authentication information is passed through the -Generated by a shared key;
  • the first target key is determined according to the first key agreement parameter.
  • the above-mentioned device 110 and the second node generate identity authentication information according to the first shared key.
  • one node After receiving a message from another node, one node first determines the identity of the other node through the identity authentication information. After the identity authentication is passed, the key is updated according to the key negotiation parameters to obtain the first target key. In this case, even if the eavesdropper has broken the original session key, the identity information cannot be forged, thereby avoiding Man-in-the-middle attacks are eliminated, and data security during the key update process is improved.
  • the first key update request is used to indicate at least one of the first update time and the validity period of the first target key.
  • the time to update the key is pre-defined in the protocol and cannot be flexibly selected.
  • the device 110 provided in this application can customize the update time of the first target key and/or the validity period of the first target key, and instruct the second node to determine when to activate the first target key according to demand.
  • a target key is pre-defined in the protocol and cannot be flexibly selected.
  • the first key update request includes a first frame number, and the first key update request indicates the first update time through the first frame number.
  • the first frame number is indicated by multiple bits, for example, F bits.
  • the first key update request includes a media access control sequence number (MAC SN), the MAC SN is indicated by M bits, and the M bits are some of the F bits, M is less than F.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the first frame number carried in the first key update request is 2345
  • the first frame number may indicate that the first target key is applied after the communication frame starting from the frame number 2345.
  • the first target key is applied to the validity period of the first target key starting from the first update time.
  • the time to update the key is configured. Therefore, the new key is updated when the old key expires. Since the old key has expired, the encryption process needs to be terminated first when the key is updated. After the key update is completed, the encryption process can be resumed. However, terminating the encryption process and restoring the encryption process will affect the key update efficiency, and terminating the encryption process will affect security.
  • the encryption process does not need to be terminated, which improves the efficiency of key update and improves data security.
  • the first key agreement parameter includes a first key agreement algorithm parameter
  • the first response message further includes a second key agreement algorithm parameter
  • Key agreement parameters in terms of determining the first target key, the processor 1102 is specifically configured to: generate the first target key according to the first key agreement algorithm parameter and the second key agreement algorithm parameter .
  • the first key agreement parameter includes a fresh parameter; in terms of determining the first target key according to the first key agreement parameter, the processor 1102 is specifically configured to:
  • the first target key is generated.
  • the second target key may be a shared key between the first node and the second node, including a master key, a session key, and a pre-shared key PSK.
  • the first target key may be generated through a key derivation algorithm.
  • fresh is a fresh parameter
  • the parameter used for update may include a counter value (counter), a sequence number (number), a random value (rand), a frame number (framenumber), and so on.
  • the first target key is the master key of the device 110.
  • the first key agreement parameter includes a fresh parameter; in terms of determining the first target key according to the first key agreement parameter, the processor 1102 specifically uses At:
  • the first target key is generated according to the second target key, the freshness parameter and the algorithm identifier, and the algorithm identifier is used to mark the algorithm used to determine the encryption key or the integrity protection key.
  • the first target key is an integrity protection key or an encryption key of the device 110.
  • At least one of the first key update request and the first response message is encrypted by an encryption key determined according to a second target key, and/or, the first At least one of a key update request and the first response message is integrity protected by an integrity protection key determined according to the second target key.
  • the traditional key update method is to update the key when the old key expires. Since the second target key has expired, the process of determining the new key does not perform encryption and integrity protection.
  • the device 110 may determine the first target key before the key expires, so the first key update request and the first response message may be encrypted using the key determined according to the second target key. Thereby improving data security.
  • the first key update request is sent to the second node through the first communication frame through the communication interface 1103, where the second frame number of the first communication frame is less than the last update
  • the third frame number carried in the key update request used when the key is used is used, the third frame number is used to indicate the start time of the last updated key, and the first frame number is greater than the second frame number And is smaller than the third frame number.
  • the encryption method used can be based on the frame number and the key updated last time. Therefore, it is determined before the frame number repeats to the frame number of the last key update.
  • the first target key is used to encrypt the data frame by the first target key, so that the data frame with the same frame number twice can be encrypted by different keys, which improves the security of the data.
  • the first key update request includes a MAC sequence number (MAC SN), not the first frame number, and the MAC SN is indicated by M bits, and the M bits are the For some of the F bits, M is smaller than F.
  • the third frame number carried in the key update request used in the last key update can also be replaced by MAC SN, that is, part of the multiple bits used to indicate the third frame number The indicated MAC SN.
  • the size relationship between the first, second, and third frame numbers remains unchanged.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the communication frame includes at least one of a signaling plane uplink frame, a signaling plane downlink frame, a user plane uplink frame, or a user plane downlink frame.
  • the processor 1102 is further configured to, if the second identity information verification fails, instruct the communication interface 1103 to disconnect the communication connection with the second node or pass the communication interface 1103 sends the update failure information to the second node.
  • the above-mentioned apparatus 110 can disconnect the communication connection with the second node or send the update failure information to the second node. It is convenient to re-initiate an access request to the node that needs to update the key, thereby ensuring data security during the key update process.
  • the processor 1102 is further configured to: perform integrity verification on the first response message; if the integrity verification is passed, Continue to perform the step of verifying the second identity authentication information through the first shared key;
  • the processor 1102 is further configured to, if the integrity verification fails, instruct the communication interface 1103 to disconnect the communication connection with the second node or send the update failure information to the second node through the communication interface 1103.
  • the integrity verification can determine whether the information has been tampered with. Therefore, before verifying the identity information, the device 110 first performs integrity verification on the first response message to determine that the information in the first response message has not been tampered with. If the integrity verification fails, it indicates that the data in the first response message has been tampered with and cannot continue to update the key. Therefore, the device 110 disconnects the communication connection with the second node or sends an update failure to the second node. The information facilitates the device 110 to re-access the node where the key needs to be updated, and also ensures the data security during the key update process.
  • each unit may also correspond to the corresponding description of any one of the embodiments shown in FIG. 5, FIG. 6, FIG. 7 or FIG. 8.
  • the node 10 is the first node in any one of the embodiments shown in FIG. 5, FIG. 6, FIG. 7 or FIG. 8.
  • FIG. 12 is a schematic structural diagram of an apparatus 120 provided by an embodiment of the present application.
  • the apparatus 120 may be an electronic device with a data transceiving capability, or one of the electronic devices with a data transceiving capability. Devices, such as chips or integrated circuits, etc.
  • the device 120 may include a memory 1201, a processor 1202, and a communication interface 1203. Further optionally, a bus 1204 may be included, where the memory 1201, the processor 1202, and the communication interface 1203 are connected through the bus 1204.
  • the memory 1201 is used to provide storage space, and the storage space can store data such as an operating system and a computer program.
  • the memory 1201 includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or Portable read-only memory (compact disc read-only memory, CD-ROM).
  • the processor 1202 is a module that performs arithmetic operations and logical operations, and can be a processing module such as a central processing unit (CPU), a graphics processing unit (GPU), or a microprocessor (MPU) One or a combination of more.
  • a processing module such as a central processing unit (CPU), a graphics processing unit (GPU), or a microprocessor (MPU) One or a combination of more.
  • the communication interface 1203 is used to receive data sent from the outside and/or send data to the outside, and may be a wired link interface including an Ethernet cable or the like, or a wireless link (WIFI, Bluetooth, etc.) interface.
  • the communication interface may also include a transmitter (such as a radio frequency transmitter, etc.) or a receiver coupled with the interface.
  • the processor 1202 in the device 120 is configured to read the computer program code stored in the memory 1201, and perform the following operations:
  • a first key update request is sent to the second node through the communication interface 1203, where the first key update request includes a first key agreement parameter and first identity authentication information, and the first identity authentication information is Generated by the first shared key;
  • the first target key is determined according to the first key agreement parameter.
  • the above-mentioned device 120 and the first node Before the original session key expires, the above-mentioned device 120 and the first node generate identity authentication information according to the first shared key. After receiving a message from another node, one node first determines the identity of the other node through the identity authentication information. Identity, after the identity authentication is passed, the key is updated according to the key negotiation parameters to obtain the first target key. In this case, even if the eavesdropper has broken the original session key, the identity information cannot be forged , Thereby avoiding man-in-the-middle attacks and improving data security during the key update process.
  • the first key update request is used to indicate at least one of the first update time and the validity period of the first target key.
  • the time to update the key is pre-defined in the protocol and cannot be flexibly selected.
  • the first node can customize the update time of the first target key and/or the validity period of the first target key, and instruct the device 120 to determine when to activate the first target according to demand. Key.
  • the first key update request includes a first frame number, and the first key update request indicates the first update time through the first frame number.
  • the first frame number is indicated by multiple bits, for example, F bits.
  • the first key update request includes a media access control sequence number (MAC SN), the MAC SN is indicated by M bits, and the M bits are some of the F bits, M is less than F.
  • the multiple bits used to indicate the first frame number include two parts: a high-order part and a low-order part, where the low-order part is M bits used to indicate the MAC SN.
  • the high-order part is indicated by N bits.
  • the N bits are multiple bits used to indicate a superframe number.
  • the first frame number carried in the first key update request is 2345
  • the first frame number may indicate that the first target key is applied after the communication frame starting from the frame number 2345.
  • the first target key is applied to the validity period of the first target key starting from the first update time.
  • the time to update the key is configured. Therefore, the new key is updated when the old key expires. Since the old key has expired, the encryption process needs to be terminated first when the key is updated. After the key update is completed, the encryption process can be resumed. However, terminating the encryption process and restoring the encryption process will affect the key update efficiency, and terminating the encryption process will affect security. In the device 120 provided in the present application, when the key is updated, since the old key has not expired, the encryption process does not need to be terminated, which improves the efficiency of key update and improves data security.
  • the first key agreement parameter includes a first key agreement algorithm parameter
  • the first response message further includes a second key agreement algorithm parameter
  • the processor 1202 is specifically configured to:
  • the first target key is generated according to the first key agreement algorithm parameter and the second key agreement algorithm parameter.
  • the first key agreement parameter includes a fresh parameter; in terms of determining the first target key according to the first key agreement parameter, the processor 1202 is specifically configured to:
  • the first target key is generated.
  • the second target key may be a shared key between the first node and the second node, including a master key, a session key, and a pre-shared key PSK.
  • the first target key can be generated by a key derivation algorithm KDF.
  • KDF key derivation algorithm
  • fresh is a fresh parameter
  • the parameter used for update may include a counter value (counter), a sequence number (number), a random value (rand), a frame number (framenumber), and so on.
  • the first target key is the master key of the device 120.
  • the first key agreement parameter includes a fresh parameter; in terms of determining the first target key according to the first key agreement parameter, the processor 1202 specifically uses At:
  • the first target key is generated according to the second target key, the freshness parameter and the algorithm identifier, and the algorithm identifier is used to mark the algorithm used to determine the encryption key or the integrity protection key.
  • the first target key is an integrity protection key or an encryption key of the device 120.
  • At least one of the first key update request and the first response message is encrypted by an encryption key determined according to a second target key, and/or, the first At least one of a key update request and the first response message is integrity protected by an integrity protection key determined according to the second target key.
  • the traditional key update method is to update the key when the old key expires. Since the second target key has expired, the process of determining the new key does not perform encryption and integrity protection.
  • the first target key can be determined before the key expires. Therefore, the first key update request and the first response message can be encrypted with the key determined according to the second target key, thereby improving Improved data security.
  • the processor 1202 is further configured to, if the first identity information is not verified, instruct the communication interface 1203 to disconnect the communication connection with the first node or to communicate with the first node through the communication interface 1203.
  • the node sends a message indicating that the update has failed.
  • the device 120 may disconnect the connection with the first node or send an update indicating update failure to the first node, thereby stopping the key process to ensure The data security of the node during the key update process.
  • the processor 1202 after receiving the first key update request from the first node, the processor 1202 is further configured to: perform integrity verification on the first key update request; If the sexual verification is passed, the step of verifying the first identity authentication information through the first shared key is continued;
  • the processor 1202 is further configured to, if the integrity verification fails, instruct the communication interface 1203 to disconnect from the first node or send information indicating that the update fails to the first node through the communication interface 1203.
  • the aforementioned device 120 Before verifying the identity information, the aforementioned device 120 first performs integrity verification on the first key update request, and determines that the information in the first key update request has not been tampered with. If the integrity verification fails, it indicates that the data in the first key update request has been tampered with and cannot continue to update the key. Therefore, the above-mentioned apparatus 120 may disconnect the connection with the first node or send an update indication to the first node that the update failed. The information to ensure the data security during the key update process.
  • each unit may also correspond to the corresponding description of any one of the embodiments shown in FIG. 5, FIG. 6, FIG. 7, or FIG. 8.
  • the device 120 is the first node in any one of the embodiments shown in FIG. 5, FIG. 6, FIG. 7 or FIG. 8.
  • the embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program runs on one or more processors, execute FIG. 5 and FIG. 6 , The method described in any one of the embodiments shown in FIG. 7 or FIG. 8.
  • An embodiment of the present application also provides a chip system, the chip system includes at least one processor, a memory, and an interface circuit.
  • the interface circuit is used to provide information input/output for the at least one processor, and the at least one processor
  • a computer program is stored in the memory, and when the computer program runs on one or more processors, the key update method described in any one of the embodiments shown in FIG. 5, FIG. 6, FIG. 7 or FIG. 8 is executed.
  • An embodiment of the present application also provides a smart cockpit product.
  • the smart cockpit product includes a first node (for example, a car cockpit domain controller CDC), and the first node is shown in FIG. 5, FIG. 6, FIG. 7 or FIG. 8. Shows the first node in any embodiment.
  • the vehicle further includes a second node (for example, at least one of a camera, a screen, a microphone, a sound, a radar, an electronic key, a keyless entry and a start system controller, etc.), and the second node is a graph 5.
  • the second node in any of the embodiments shown in FIG. 6, FIG. 7, or FIG. 8.
  • An embodiment of the present application also provides a vehicle, which includes a first node (for example, a car cabin domain controller CDC). Further, the vehicle further includes a second node (for example, at least one of a camera, a screen, a microphone, a sound, a radar, an electronic key, a keyless entry or a start system controller, etc.), wherein the first node is The first node in any one of the embodiments shown in FIG. 5, FIG. 6, FIG. 7 or FIG. 8, and the second node is the first node in any one of the embodiments shown in FIG. 5, FIG. 6, FIG. 7 or FIG. The second node.
  • the embodiments of the present application also provide a computer program product. When the computer program product runs on one or more processors, it can execute any of the embodiments shown in FIG. 5, FIG. 6, FIG. 7 or FIG. 8. The key update method.
  • the nodes of the two communicating parties need to generate identity authentication information according to the first shared key, and the node first passes the identity after receiving a message from another node.
  • the authentication information determines the identity of the other communication node.
  • the first target key is determined according to the key agreement parameters. In this case, even if the eavesdropper has broken the original session key, it still cannot Falsify identity information, thereby avoiding man-in-the-middle attacks and improving data security in the data update process.
  • the modules in the device of the embodiment of the present application may be combined, divided, and deleted according to actual needs.
  • the program can be stored in a computer-readable storage medium, and the storage medium can include: flash memory Disk, Read-Only Memory (ROM), Random Access Memory (RAM), magnetic disk or optical disk, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Power Engineering (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Algebra (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本申请实施例提供一种密钥更新方法及相关装置,应用于短距离通信领域,尤其涉及座舱域通信。所述方法包括:向第二节点发送第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息,所述第一身份认证信息是通过第一共享密钥生成的;接收来自所述第二节点的第一响应消息,其中,所述第一响应消息包括第二身份认证信息;通过所述第一共享密钥验证所述第二身份认证信息;若第二身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥。采用本申请实施例,能够提高密钥更新过程中的数据安全性。

Description

一种密钥更新方法及相关装置 技术领域
本发明涉及通信技术领域,尤其涉及短距离通信技术领域,例如座舱域通信。具体涉及一种密钥更新方法及相关装置。
背景技术
通信技术已经深入了人们的生活,我们在享受通信便利的同时也会面临安全漏洞和隐私泄露的威胁。为确保通信过程中数据的传输、存储安全,节点通常都会对传输的数据加密后存储或传输,接收方的节点接收到数据后解密密文,还原明文。另外,节点还可以对数据进行完整性保护(或者简称为完保),接收方的节点收到数据后回验证消息的完整性,完整性验证成功说明消息在传输过程中没有被修改。在安全的数据通信中,通信的双方必须分别具有加解密的密钥、完整性保护密钥等密钥。一旦加解密的密钥、完整性保护密钥等密钥到期或者被破解,由其加密或完保的信息就容易被泄漏,影响传输数据的安全性。
密钥的使用寿命是有期限的,为了保证密钥不被泄漏或破解,通常会采用密钥更新机制,即在密钥有效期快要结束时,由一个新的密钥取代旧密钥。而密钥更新过程中,节点传输的用于更新密钥的消息容易受到中间人攻击,影响数据安全性。
因此,如何提高密钥更新过程中的数据安全性的是本领域技术人员正在研究的问题。
发明内容
本申请实施例公开了一种密钥更新方法及相关装置,能够提高密钥更新过程中的数据安全性。
第一方面,本申请实施例公开了一种密钥更新方法,其特征在于,包括:
向第二节点发送第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息,所述第一身份认证信息是通过第一共享密钥生成的。其中,第一共享密钥是通信双方的节点中保存的相同的秘密值,可以是主密钥、或者会话密钥、或者预共享密钥PSK等,其中,会话密钥可以用来对节点传输的数据、文件进行加密或完整性保护。另外,第一身份认证信息可以是根据第一共享密钥通过密码算法生成的。其中,密码算法可以为散列算法(又称为哈希算法)或者认证算法等,如哈希运算消息认证码HMAC算法(包括HMAC安全散列算法HMAC-SHA256、HMAC-SHA3、或者HMAC国密算法HMAC-SM3等)。进一步的,密码算法还可以包括末端快速扩增RACE原始完整性校验消息摘要RIPEMD算法。
接收来自所述第二节点的第一响应消息,其中,所述第一响应消息包括第二身份认证信息;该第二身份认证信息的生成的原理与第一身份认证信息的原理相同,此处不再赘述。
通过所述第一共享密钥验证所述第二身份认证信息;
若第二身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥。
上述方法中,在原有的密钥到期之前,第一节点和第二节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一 个节点的身份,在身份认证通过后,才根据密钥协商参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
在第一方面的一种可能的实施方式中,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
传统密钥更新过程中,更新密钥的时间是协议中预先定义好的,不能灵活选择。而本申请的密钥更新方法中,第一节点可以自定义第一目标密钥的更新时间和/或第一目标密钥的有效期,并指示给第二节点,有利于按需求来决定何时启用第一目标密钥。
在第一方面的又一种可能的实施方式中,所述第一密钥更新请求包括第一帧号,所述第一帧号通过多个比特指示,例如F个比特。所述第一密钥更新请求用于通过所述第一帧号指示所述第一更新时间。可替代的,所述第一密钥更新请求包括媒体接入控制序列号(MAC SN),所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
在第一方面的又一种可能的实施方式中,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
在第一方面的又一种可能的实施方式中,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息还包括第二密钥协商算法参数;所述根据所述第一密钥协商参数,确定第一目标密钥,包括:
根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
其中,第一密钥协商算法参数和第二密钥协商算法参数是密钥协商过程中产生的算法参数。而密钥协商是通信双方通过交互一部分参数,从而协商得到密钥的过程。用于密钥协商的算法称为密钥协商算法,也可以称为密钥交换算法。本申请实施例中,第一节点生成第一密钥协商算法参数,第二节点生成第二密钥协商算法参数,通过双方提供的密钥协商算法参数确定第一目标密钥。其中,以DH算法为例,两个节点使用同一个大素数p和生成数g,各自产生的随机数a和b。第一节点将g的a次方mod P产生的数值A发送给第二节点,第二节点将g的b次方mod P产生的数值B发送给第一节点,第一节点再对接收的数值A做a次方运算,第二节点对接收的数值B做a次方运算,由于K=A bmodp=(g amodp) bmodp=g abmodp=(g bmodp) amodp=B amodp,因此第一节点与第二节点生成的密钥K是相同的。
在第一方面的又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;所述根据所述第一密钥协商参数,确定第一目标密钥,包括:
根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
其中,第二目标密钥可以是第一节点与第二节点中共享的一个秘密值,也可以称为第一节点与第二节点的共享密钥,包括主密钥、会话密钥和预共享密钥PSK等。另外,根据 第二目标密钥和所述新鲜参数,可以通过密钥派生算法KDF生成所述第一目标密钥。例如,通过秘密值Key派生的新密钥DK可以表示为:DK=KDF(Key,fresh)。其中,fresh是新鲜参数,用于更新的参数,可以包括计数器值(counter)、序列号(number)、随机值(rand)、帧号(framenumber)等等。
在第一方面的又一种可能的实施方式中,所述第一目标密钥为主密钥。
主密钥是节点中等级较高的一个秘密值,主要用于对会话密钥等密钥的保护。在一种可选的方案中,会话密钥是根据主密钥通过密钥派生函数(key derivation function,KDF)得到的。可选的,主密钥可以对会话密钥进行加密。
在第一方面的又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;所述根据所述第一密钥协商参数,确定第一目标密钥,包括:
根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标记确定加密密钥或者完整性保护密钥所使用的算法。
在第一方面的又一种可能的实施方式中,所述第一目标密钥为完整性保护密钥或者加密密钥。
在第一方面的又一种可能的实施方式中,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
可以理解,传统的密钥更新方法是在旧密钥(即第二目标密钥)到期时更新密钥,由于第二目标密钥已到期,因此确定新密钥的过程没有进行加密和完整性保护。而本申请实施例中,可以在第二目标密钥到期之前确定第一目标密钥,因此第一密钥更新请求和第一响应消息可以使用根据第二目标密钥确定的密钥进行加密,从而提高了数据安全性。
在第一方面的又一种可能的实施方式中,所述向第二节点发送第一密钥更新请求,包括:通过第一通信帧向第二节点发送第一密钥更新请求,其中,所述第一通信帧的第二帧号小于上一次更新密钥时用到的密钥更新请求中携带的第三帧号,所述第三帧号用于指示上一次更新的密钥的启动时间,所述第一帧号大于所述第二帧号且小于所述第三帧号。由于对通信过程中的通信帧进行安全保护时,使用的加密方法可以是根据帧号和上次更新的密钥进行加密的,因此,在帧号重复到上一次更新密钥的帧号之前确定第一目标密钥,从而通过第一目标密钥来加密数据帧,这样可以使得两次相同的帧号的数据帧是通过不同的密钥进行加密的,提高了数据的安全性。在可替代的方案中,所述第一密钥更新请求包括MAC序列号(MAC SN),并非所述第一帧号,所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。那么可替代的,上一次更新密钥时用到的密钥更新请求中携带的第三帧号也可以替代为MAC SN,即用于指示所述第三帧号的多个比特中的部分比特所指示的MAC SN。在该可替代的方案中,第一、第二以及第三帧号之间的大小关系不变。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
在第一方面的又一种可能的实施方式中,所述通信帧包括信令面上行帧、信令面下行帧、用户面上行帧或者用户面下行帧中的至少一项。进一步,本申请中所涉及的帧号为所述通信帧的帧号。
在第一方面的又一种可能的实施方式中,所述方法还包括:
若第二身份信息验证不通过,则断开与第二节点之间的通信连接或向第二节点发送更新失败的信息。
可以看出,若第二身份认证信息验证不通过,表明第二节点的身份不可信,因此第一节点可以断开与第二节点之间的通信连接或向第二节点发送更新失败的信息,便于重新向需要进行密钥更新的节点发起接入请求,从而保证了密钥更新过程中的数据安全性。
在第一方面的又一种可能的实施方式中,所述通过所述第一共享密钥验证所述第二身份认证信息之前,还包括:
对所述第一响应消息进行完整性验证;
若完整性验证通过,则继续执行所述通过所述第一共享密钥验证所述第二身份认证信息这一步骤;
若完整性验证不通过,则断开与第二节点之间的通信连接或向第二节点发送更新失败的信息。
上述方法中在验证身份信息之前,第一节点先对第一响应消息进行完整性验证,确定第一响应消息中的信息没有被篡改。若完整性验证不通过,表明第一响应信息中的数据已经被篡改,不能继续更新密钥,因此第一节点断开与第二节点之间的通信连接或向第二节点发送更新失败的信息,便于第一节点重新接入需要进行密钥更新的节点,也保证了密钥更新过程中的数据安全性。
第二方面,本申请实施例公开了一种密钥更新方法,其特征在于,包括:
接收来自第一节点的第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息;其中,第一身份认证信息可以是根据第一共享密钥通过密码算法生成的。其中,密码算法可以为散列算法(又称为哈希算法),或者认证算法等,如哈希运算消息认证码HMAC算法(包括HMAC安全散列算法HMAC-SHA256、HMAC-SHA3、或者HMA国密算法HMAC-SM3等)。进一步的,密码算法还可以包括末端快速扩增RACE原始完整性校验消息摘要RIPEMD算法。
通过第一共享密钥验证所述第一身份认证信息;其中,第一共享密钥是通信双方的节点中保存的相同的秘密值,可以是主密钥、或者会话密钥、或者预共享密钥PSK等,其中,会话密钥可以用来对节点传输的数据、文件进行加密或完整性保护。另外,第一身份认证信息是根据第一共享密钥通过密码算法生成的,因此第二节点可以根据该第一共享通过密码算法来验证第一身份认证信息。若第一身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥;
向所述第一节点发送第一响应消息,其中,所述第一响应消息包括第二身份认证信息,所述第二身份认证信息是通过所述第一共享密钥生成的;该第二身份认证信息的生成的原理与第一身份认证信息的原理相同,此处不再赘述。
上述方法中,在原有的会话密钥到期之前,第一节点和第二节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一个节点的身份,在身份认证通过后,才根据密钥协商参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
在第二方面的一种可能的实施方式中,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
传统密钥更新过程中,更新密钥的时间是协议中预先定义好的,不能灵活选择。而本申请的密钥更新方法中,第一节点可以自定义第一目标密钥的更新时间和/或第一目标密钥的有效期,并指示给第二节点,有利于按需求来决定何时启用第一目标密钥。
在第二方面的又一种可能的实施方式中,所述第一密钥更新请求中包括第一帧号,所述第一密钥更新请求通过所述第一帧号指示所述第一更新时间。所述第一帧号通过多个比特指示,例如F个比特。可替代的,所述第一密钥更新请求包括媒体接入控制序列号(MAC SN),所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
在第二方面的又一种可能的实施方式中,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
在第二面的又一种可能的实施方式中,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息还包括第二密钥协商算法参数;所述根据所述第一密钥协商参数,确定第一目标密钥,包括:
根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
其中,第一密钥协商算法参数和第二密钥协商算法参数是密钥协商过程中产生的算法参数。而密钥协商是通信双方通过交互一部分参数,从而协商得到密钥的过程。用于密钥协商的算法称为密钥协商算法,也可以称为密钥交换算法。本申请实施例中,第一节点生成第一密钥协商算法参数,第二节点生成第二密钥协商算法参数,通过双方提供的密钥协商算法参数确定第一目标密钥。其中,以DH算法为例,两个节点使用同一个大素数p和生成数g,各自产生的随机数a和b。第一节点将g的a次方mod P产生的数值A发送给第二节点,第二节点将g的b次方mod P产生的数值B发送给第一节点,第一节点再对接收的数值A做a次方运算,第二节点对接收的数值B做a次方运算,由于K=A bmodp=(g amodp) bmodp=g abmodp=(g bmodp) amodp=B amodp,因此第一节点与第二节点生成的密钥K是相同的。
在第二方面的又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;所述根据所述第一密钥协商参数,确定第一目标密钥,包括:
根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
其中,第二目标密钥可以是第一节点与第二节点中的一个共享密钥,包括主密钥、会话密钥和预共享密钥PSK等。另外,根据第二目标密钥和所述新鲜参数,可以通过密钥派生算法KDF生成所述第一目标密钥。例如,通过秘密值Key派生的新密钥DK可以表示为:DK=KDF(Key,fresh)。其中,fresh是新鲜参数,用于更新的参数,可以包括计数器值(counter)、序列号(number)、随机值(rand)、帧号(framenumber)等等。
在第二方面的又一种可能的实施方式中,所述第一目标密钥为主密钥。
主密钥是节点中等级较高的一个秘密值,主要用于对会话密钥等密钥的保护。在一种可选的方案中,会话密钥是根据主密钥通过密钥派生函数(key derivation function,KDF)得到的。可选的,主密钥可以对会话密钥进行加密。
在第二方面的又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;所述根据所述第一密钥协商参数,确定第一目标密钥,包括:
根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标记确定加密密钥或者完整性保护密钥所使用的算法。
在第二方面的又一种可能的实施方式中,所述第一目标密钥为完整性保护密钥或者加密密钥。
在第二方面的又一种可能的实施方式中,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
可以理解,传统的密钥更新方法是在旧密钥(即第二目标密钥)到期时更新密钥,由于第二目标密钥已到期,因此确定新密钥的过程没有进行加密和完整性保护。而本申请实施例中,可以在第二目标密钥到期之前确定第一目标密钥,因此第一密钥更新请求和第一响应消息可以使用根据第二目标密钥确定的密钥进行加密,从而提高了数据安全性。
在第二方面的又一种可能的实施方式中,所述方法还包括:
若第一身份信息验证不通过,则断开与第一节点的连接或向第一节点发送更新指示更新失败的信息。
可以看出,若第一身份认证信息验证不通过,表明第二节点的身份不可信,因此第二节点可以断开与第一节点的连接或向第一节点发送更新指示更新失败的信息,从而停止此次密钥过程,以保证密钥更新过程中第二节点的数据安全性。
在第二方面的又一种可能的实施方式中,所述通过所述第一共享密钥验证所述第一身份认证信息之前,还包括:
对所述第一密钥更新请求进行完整性验证;
若完整性验证通过,则继续执行所述通过所述第一共享密钥验证所述第二身份认证信息这一步骤;
若完整性验证不通过,则断开与第一节点的连接或者向第一节点发送更新指示更新失败的信息。
上述方法中,在验证身份信息之前,第二节点先对第一密钥更新请求进行完整性验证,确定第一密钥更新请求中的信息没有被篡改。若完整性验证不通过,表明第一密钥更新请 求中的数据已经被篡改,不能继续更新密钥,因此第二节点可以断开与第一节点的连接或者向第一节点发送更新指示更新失败的信息,保证了密钥更新过程中的数据安全性。
第三方面,本申请实施例公开一种装置,包括:
发送单元,用于向第二节点发送第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息,所述第一身份认证信息是通过第一共享密钥生成的;
接收单元,用于接收来自所述第二节点的第一响应消息,其中,所述第一响应消息包括第二身份认证信息;
验证单元,用于通过所述第一共享密钥验证所述第二身份认证信息;
确定单元,用于若第二身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥。
在密钥更新过程中,上述节点和第二节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一个节点的身份,在身份认证通过后,才根据密钥协商参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
在第三方面的一种可能的实施方式中,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
传统密钥更新过程中,更新密钥的时间是协议中预先定义好的,不能灵活选择。而本申请提供的所述节点,可以自定义第一目标密钥的更新时间和/或第一目标密钥的有效期,并指示给第二节点,有利于按需求来决定何时启用第一目标密钥。
在第三方面的又一种可能的实施方式中,所述第一密钥更新请求中包括第一帧号,所述第一密钥更新请求通过所述第一帧号指示所述第一更新时间。所述第一帧号通过多个比特指示,例如F个比特。可替代的,所述第一密钥更新请求包括媒体接入控制序列号(MAC SN),所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
在第三方面的又一种可能的实施方式中,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
在第三方面的又一种可能的实施方式中,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息还包括第二密钥协商算法参数;所述确定单元,用于根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
在第三方面的又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;所述确定单元,用于根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
其中,第二目标密钥可以是第一节点与第二节点中的一个共享密钥,包括主密钥、会 话密钥和预共享密钥PSK等。另外,根据第二目标密钥和所述新鲜参数,可以通过密钥派生算法KDF生成所述第一目标密钥。例如,通过秘密值Key派生的新密钥DK可以表示为:DK=KDF(Key,fresh)。其中,fresh是新鲜参数,用于更新的参数,可以包括计数器值(counter)、序列号(number)、随机值(rand)、帧号(framenumber)等等。
在第三方面的又一种可能的实施方式中,所述第一目标密钥为所述节点的主密钥。
在第三方面的又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;所述确定单元,用于根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标记确定加密密钥或者完整性保护密钥所使用的算法。
在第三方面的又一种可能的实施方式中,所述第一目标密钥为所述节点的完整性保护密钥或者加密密钥。
在第三方面的又一种可能的实施方式中,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
可以理解,传统的密钥更新方法是在旧密钥到期时更新密钥,由于第二目标密钥已到期,因此确定新密钥的过程没有进行加密和完整性保护。而本申请实施例提供的所述节点,可以在密钥到期之前确定第一目标密钥,因此第一密钥更新请求和第一响应消息可以使用根据第二目标密钥确定的密钥进行加密,从而提高了数据安全性。
在第三方面的又一种可能的实施方式中,所述发送单元,用于通过第一通信帧向第二节点发送第一密钥更新请求,其中,所述第一通信帧的第二帧号小于上一次更新密钥时用到的密钥更新请求中携带的第三帧号,所述第三帧号用于指示上一次更新的密钥的启动时间,所述第一帧号大于所述第二帧号且小于所述第三帧号。
由于对通信过程中的通信帧进行安全保护时,使用的加密方法可以是根据帧号和上次更新的密钥进行加密的,因此,在帧号重复到上一次更新密钥的帧号之前确定第一目标密钥,从而通过第一目标密钥来加密数据帧,这样可以使得两次相同的帧号的数据帧是通过不同的密钥进行加密的,提高了数据的安全性。在可替代的方案中,所述第一密钥更新请求包括MAC序列号(MAC SN),并非所述第一帧号,所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。那么可替代的,上一次更新密钥时用到的密钥更新请求中携带的第三帧号也可以替代为MAC SN,即用于指示所述第三帧号的多个比特中的部分比特所指示的MAC SN。在该可替代的方案中,第一、第二以及第三帧号之间的大小关系不变。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
在第三方面的又一种可能的实施方式中,所述通信帧包括信令面上行帧、信令面下行帧、用户面上行帧或者用户面下行帧中的至少一项。
在第三方面的又一种可能的实施方式中,若第二身份信息验证不通过,则所述发送单元与所述接收单元断开与第二节点之间的通信连接或向第二节点发送更新失败的信息。
可以看出,若第二身份认证信息验证不通过,表明第二节点的身份不可信,因此上述节点可以断开与第二节点之间的通信连接或向第二节点发送更新失败的信息,便于重新向需要进行密钥更新的节点发起接入请求,从而保证了密钥更新过程中的数据安全性。
在第三方面的又一种可能的实施方式中,所述验证单元还用于对所述第一响应消息进行完整性验证;若完整性验证通过则继续执行所述通过所述第一共享密钥验证所述第二身份认证信息这一步骤;
若完整性验证不通过,则所述发送单元和所述接收单元断开与第二节点之间的通信连接或向第二节点发送更新失败的信息或者通过所述发送单元向第二节点发送更新失败的信息。
所述节点可以在验证身份信息之前,先对第一响应消息进行完整性验证,确定第一响应消息中的信息没有被篡改。若完整性验证不通过,表明第一响应信息中的数据已经被篡改,不能继续更新密钥,因此所述节点断开与第二节点之间的通信连接或向第二节点发送更新失败的信息,便于所述节点重新接入需要进行密钥更新的节点,也保证了密钥更新过程中的数据安全性。
第四方面,本申请实施例公开了一种装置,包括
接收单元,用于接收来自第一节点的第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息;
验证单元,用于通过第一共享密钥验证所述第一身份认证信息;
确定单元,用于若第一身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥;
发送单元,用于向所述第一节点发送第一响应消息,其中,所述第一响应消息包括第二身份认证信息,所述第二身份认证信息是通过所述第一共享密钥生成的。
在原有的会话密钥到期之前,上述节点和第一节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一个节点的身份,在身份认证通过后,才根据密钥协商参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
在第四方面的一种可能的实施方式中,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
传统密钥更新过程中,更新密钥的时间是协议中预先定义好的,不能灵活选择。而本申请的密钥更新方法中,第一节点可以自定义第一目标密钥的更新时间和/或第一目标密钥的有效期,并指示给所述节点,这样有利于按需求来决定何时启用第一目标密钥。
在第四方面的一种可能的实施方式中,所述第一密钥更新请求中包括第一帧号,所述第一密钥更新请求通过所述第一帧号指示所述第一更新时间。所述第一帧号通过多个比特指示,例如F个比特。可替代的,所述第一密钥更新请求包括媒体接入控制序列号(MAC SN),所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部 分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
在第四方面的又一种可能的实施方式中,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
在第四方面的又一种可能的实施方式中,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息包括第二密钥协商算法参数;所述确定单元,用于根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
在第四方面的又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;所述确定单元,用于根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
其中,第二目标密钥可以是第一节点与第二节点中的一个共享密钥,包括主密钥、会话密钥和预共享密钥PSK等。另外,根据第二目标密钥和所述新鲜参数,可以通过密钥派生算法KDF生成所述第一目标密钥。例如,通过秘密值Key派生的新密钥DK可以表示为:DK=KDF(Key,fresh)。其中,fresh是新鲜参数,用于更新的参数,可以包括计数器值(counter)、序列号(number)、随机值(rand)、帧号(framenumber)等等。
在第四方面的又一种可能的实施方式中,所述第一目标密钥为所述节点的主密钥。
在第四方面的又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;所述确定单元,用于根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标识确定所述加密密钥或者所述完整性保护密钥所使用的算法。
在第四方面的又一种可能的实施方式中,所述第一目标密钥为所述第二节点的完整性保护密钥或者加密密钥。在第四方面的又一种可能的实施方式中,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
可以理解,传统的密钥更新方法是在旧密钥到期时更新密钥,由于第二目标密钥已到期,因此确定新密钥的过程没有进行加密和完整性保护。而本申请实施例中,可以在密钥到期之前确定第一目标密钥,因此第一密钥更新请求和第一响应消息可以使用根据第二目标密钥确定的密钥进行加密,从而提高了数据安全性。
在第四方面的又一种可能的实施方式中,若第一身份信息验证不通过,则所述发送单元与所述接收单元断开与第一节点的连接或通过所述发送单元向第一节点发送更新指示更新失败的信息。
可以看出,若第一身份认证信息验证不通过,表明第二节点的身份不可信,因此所述节点可以断开与第一节点的连接或向第一节点发送更新指示更新失败的信息,从而停止此次密钥过程,以保证密钥更新过程中节点的数据安全性。
在第四方面的又一种可能的实施方式中,所述验证单元,还用于对所述第一密钥更新请求进行完整性验证;若完整性验证通过则继续执行所述通过所述第一共享密钥验证所述第二身份认证信息这一步骤;
若完整性验证不通过,则所述节点断开与第一节点的连接或者向通过所述发送单元向 第一节点发送更新指示更新失败的信息。
在验证身份信息之前,上述节点先对第一密钥更新请求进行完整性验证,确定第一密钥更新请求中的信息没有被篡改。若完整性验证不通过,表明第一密钥更新请求中的数据已经被篡改,不能继续更新密钥,因此上述节点可以断开与第一节点的连接或者向第一节点发送更新指示更新失败的信息,保证了密钥更新过程中的数据安全性。
第五方面,本申请实施例公开一种装置,所述节点包括存储器、处理器和通信接口,所述存储器中存储有计算器程序,所述处理器调用所述存储器中存储的计算机程序,用于执行如下操作:
通过所述通信接口向第二节点发送第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息,所述第一身份认证信息是通过第一共享密钥生成的;
通过所述通信接口接收来自所述第二节点的第一响应消息,其中,所述第一响应消息包括第二身份认证信息;
通过所述第一共享密钥验证所述第二身份认证信息;
若第二身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥。
在密钥更新过程中,上述节点和第二节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一个节点的身份,在身份认证通过后,才根据密钥协商参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
在第五方面的一种可能的实施方式中,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
传统密钥更新过程中,更新密钥的时间是协议中预先定义好的,不能灵活选择。而本申请所提供的所述节点,可以自定义第一目标密钥的更新时间和/或第一目标密钥的有效期,并指示给第二节点,有利于按需求来决定何时启用第一目标密钥。
在第五方面的又一种可能的实施方式中,所述第一密钥更新请求中包括第一帧号,所述第一密钥更新请求通过所述第一帧号指示所述第一更新时间。所述第一帧号通过多个比特指示,例如F个比特。可替代的,所述第一密钥更新请求包括媒体接入控制序列号(MAC SN),所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
在第五方面的又一种可能的实施方式中,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
在第五方面的又一种可能的实施方式中,所述第一密钥协商参数包括第一密钥协商算 法参数,所述第一响应消息还包括第二密钥协商算法参数;在根据所述第一密钥协商参数,确定第一目标密钥方面,所述处理器具体用于:
根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
在第五方面的又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;在根据所述第一密钥协商参数,确定第一目标密钥方面,所述处理器具体用于:
根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
其中,第二目标密钥可以是第一节点与第二节点中的一个共享密钥,包括主密钥、会话密钥和预共享密钥PSK等。另外,根据第二目标密钥和所述新鲜参数,可以通过密钥派生算法KDF生成所述第一目标密钥。例如,通过秘密值Key派生的新密钥DK可以表示为:DK=KDF(Key,fresh)。其中,fresh是新鲜参数,用于更新的参数,可以包括计数器值(counter)、序列号(number)、随机值(rand)、帧号(framenumber)等等。
在第五方面的又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;在用于根据所述第一密钥协商参数,确定第一目标密钥方面,所述处理器具体用于:
在第五方面的又一种可能的实施方式中,所述第一目标密钥为所述节点的主密钥。
根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标记确定加密密钥或者完整性保护密钥所使用的算法。
在第五方面的又一种可能的实施方式中,所述第一目标密钥为所述节点的完整性保护密钥或者加密密钥。
在第五方面的又一种可能的实施方式中,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
可以理解,传统的密钥更新方法是在旧密钥到期时更新密钥,由于第二目标密钥已到期,因此确定新密钥的过程没有进行加密和完整性保护。而本申请实施例中,可以在密钥到期之前确定第一目标密钥,因此第一密钥更新请求和第一响应消息可以使用根据第二目标密钥确定的密钥进行加密,从而提高了数据安全性。
在第五方面的又一种可能的实施方式中,所述通信接口通过第一通信帧向第二节点发送第一密钥更新请求,其中,所述第一通信帧的第二帧号小于上一次更新密钥时用到的密钥更新请求中携带的第三帧号,所述第三帧号用于指示上一次更新的密钥的启动时间,所述第一帧号大于所述第二帧号且小于所述第三帧号。
由于对通信过程中的通信帧进行安全保护时,使用的加密方法可以是根据帧号和上次更新的密钥进行加密的,因此,在帧号重复到上一次更新密钥的帧号之前确定第一目标密钥,从而通过第一目标密钥来加密数据帧,这样可以使得两次相同的帧号的数据帧是通过不同的密钥进行加密的,提高了数据的安全性。在可替代的方案中,所述第一密钥更新请求包括MAC序列号(MAC SN),并非所述第一帧号,所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。那么可替代的,上一次更新密钥时用到的密钥更新请求中携带的第三帧号也可以替代为MAC SN,即用于指示所述第三帧 号的多个比特中的部分比特所指示的MAC SN。在该可替代的方案中,第一、第二以及第三帧号之间的大小关系不变。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
在第五方面的又一种可能的实施方式中,所述通信帧包括信令面上行帧、信令面下行帧、用户面上行帧或者用户面下行帧中的至少一项。
在第五方面的又一种可能的实施方式中,所述处理器,还用于若第二身份信息验证不通过,则指示通信接口断开与第二节点之间的通信连接或者通过所述通信接口向第二节点发送更新失败的信息。
可以看出,若第二身份认证信息验证不通过,表明第二节点的身份不可信,因此上述节点可以断开与第二节点之间的通信连接或向第二节点发送更新失败的信息,便于重新向需要进行密钥更新的节点发起接入请求,从而保证了密钥更新过程中的数据安全性。
在第五方面的又一种可能的实施方式中,在接收来自第二节点的第一响应消息之后,所述处理器还用于:对所述第一响应消息进行完整性验证;若完整性验证通过则继续执行所述通过所述第一共享密钥验证所述第二身份认证信息这一步骤;
所述处理器还用于若完整性验证不通过,则指示通信接口断开与第二节点之间的通信连接或者通过所述通信接口向第二节点发送更新失败的信息。
可以看出,完整性验证可以确定信息是否被篡改过,因此在验证身份信息之前,上述节点先对第一响应消息进行完整性验证,确定第一响应消息中的信息没有被篡改。若完整性验证不通过,表明第一响应信息中的数据已经被篡改,不能继续更新密钥,因此所述节点断开与第二节点之间的通信连接或向第二节点发送更新失败的信息,便于所述节点重新接入需要进行密钥更新的节点,也保证了密钥更新过程中的数据安全性。
第六方面,本申请实施例公开一种装置,所述节点包括存储器、处理器和通信接口,所述存储器中存储有计算器程序,所述处理器调用所述存储器中存储的计算机程序,用于执行如下操作:
通过所述通信接口向第二节点发送第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息,所述第一身份认证信息是通过第一共享密钥生成的;
通过所述通信接口接收来自所述第二节点的第一响应消息,其中,所述第一响应消息包括第二身份认证信息;
通过所述第一共享密钥验证所述第二身份认证信息;
若第二身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥。
在原有的会话密钥到期之前,上述节点和第一节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一个节点的身份,在身份认证通过后,才根据密钥协商参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了 中间人攻击,提高了密钥更新过程中的数据安全性。
在第六方面的一种可能的实施方式中,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
传统密钥更新过程中,更新密钥的时间是协议中预先定义好的,不能灵活选择。而本申请中,第一节点可以自定义第一目标密钥的更新时间和/或第一目标密钥的有效期,并指示给所述节点,有利于按需求来决定何时启用第一目标密钥。
在第六方面的又一种可能的实施方式中,所述第一密钥更新请求中包括第一帧号,所述第一密钥更新请求通过所述第一帧号指示所述第一更新时间。所述第一帧号通过多个比特指示,例如F个比特。可替代的,所述第一密钥更新请求包括媒体接入控制序列号(MAC SN),所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
在第六方面的又一种可能的实施方式中,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
在第六方面的又一种可能的实施方式中,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息还包括第二密钥协商算法参数;在根据所述第一密钥协商参数,确定第一目标密钥方面,所述处理器具体用于:
根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
在第六方面的又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;在根据所述第一密钥协商参数,确定第一目标密钥方面,所述处理器具体用于:
根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
其中,第二目标密钥可以是第一节点与第二节点中的一个共享密钥,包括主密钥、会话密钥和预共享密钥PSK等。另外,根据第二目标密钥和所述新鲜参数,可以通过密钥派生算法KDF生成所述第一目标密钥。例如,通过秘密值Key派生的新密钥DK可以表示为:DK=KDF(Key,fresh)。其中,fresh是新鲜参数,用于更新的参数,可以包括计数器值(counter)、序列号(number)、随机值(rand)、帧号(framenumber)等等。
在第六方面的又一种可能的实施方式中,所述第一目标密钥为所述节点的主密钥。
在第六方面的又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;在用于根据所述第一密钥协商参数,确定第一目标密钥方面,所述处理器具体用于:
根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标记确定加密密钥或者完整性保护密钥所使用的算法。
在第六方面的又一种可能的实施方式中,所述第一目标密钥为所述节点的完整性保护密钥或者加密密钥。
在第六方面的又一种可能的实施方式中,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求 和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
可以理解,传统的密钥更新方法是在旧密钥到期时更新密钥,由于第二目标密钥已到期,因此确定新密钥的过程没有进行加密和完整性保护。而本申请实施例中,可以在密钥到期之前确定第一目标密钥,因此第一密钥更新请求和第一响应消息可以使用根据第二目标密钥确定的密钥进行加密,从而提高了数据安全性。
在第六方面的又一种可能的实施方式中,所述处理器,还用于若第一身份信息验证不通过,则指示通信接口断开与第一节点的通信连接或者通过通信接口向第一节点发送指示更新失败的信息。
可以看出,若第一身份认证信息验证不通过,所述节点可以断开与第一节点的连接或向第一节点发送更新指示更新失败的信息,从而停止此次密钥过程,以保证密钥更新过程中节点的数据安全性。
在第六方面的又一种可能的实施方式中,在接收来自第一节点的第一密钥更新请求之后,所述处理器还用于:对所述第一密钥更新请求进行完整性验证;若完整性验证通过则继续执行所述通过所述第一共享密钥验证所述第一身份认证信息这一步骤;
所述处理器,还用于若完整性验证不通过,则指示通信接口断开与第一节点的连接或者通过通信接口向第一节点发送指示更新失败的信息。
在验证身份信息之前,上述节点先对第一密钥更新请求进行完整性验证,确定第一密钥更新请求中的信息没有被篡改。若完整性验证不通过,表明第一密钥更新请求中的数据已经被篡改,不能继续更新密钥,因此上述节点可以断开与第一节点的连接或者向第一节点发送更新指示更新失败的信息,保证了密钥更新过程中的数据安全性。
第七方面,本申请实施例公开了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,当所述计算机程序在一个或多个处理器上运行时,执行第一方面、第一方面的任意一种可能的实施方式、第二方面或者第二方面的任意一种可能的实施方式所述的方法。
第八方面,本申请实施例公开了一种芯片系统,所述芯片系统包括至少一个处理器,存储器和接口电路,所示接口电路用于为所述至少一个处理器提供信息输入/输出,所述至少一个存储器中存储有计算机程序,当所述计算机程序在一个或多个处理器上运行时,执行第一方面、第一方面的任意一种可能的实施方式、第二方面或者第二方面的任意一种可能的实施方式所述的方法。
第九方面,本申请实施例公开了一种车辆,所述车辆包括第一节点(例如,汽车座舱域控制器CDC)。进一步,所述车辆还包括第二节点(例如,摄像头、屏幕、麦克风、音响、雷达、电子钥匙、无钥匙进入或启动系统控制器等模块中的至少一个),其中所述第一节点为上述第三方面或第三方面的任意一种可能的实施方式、或者上述第五方面或上述第五方面的任意一种可能的实施方式所述的节点,所述第二节点为上述第四方面或第四方面的任意一种可能的实施方式、或者上述第六方面或上述第六方面的任意一种可能的实施方式所述的节点。
附图说明
以下对本申请实施例用到的附图进行介绍。
图1是本申请实施例提供的一种DH算法的原理示意图;
图2是本申请实施例提供的一个密钥派生算法的示意图;
图3是本申请实施例提供的一种通信系统的架构示意图;
图4是本申请实施例提供的一种密钥更新方法的使用场景示意图;
图5是本申请实施例提供的一种密钥更新方法的流程示意图;
图6是本申请实施例提供的又一种密钥更新方法的流程示意图;
图7是本申请实施例提供的又一种密钥更新方法的流程示意图;
图8是本申请实施例提供的又一种密钥更新方法的流程示意图;
图9是本申请实施例提供的一种节点的结构示意图;
图10是本申请实施例提供的又一种节点的结构示意图;
图11是本申请实施例提供的又一种节点的结构示意图;
图12是本申请实施例提供的又一种节点的结构示意图。
具体实施方式
下面结合本申请实施例中的附图对本申请实施例进行描述。需要说明的是,本申请中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
下面先对本申请涉及到的相关技术和专业术语进行简单的介绍以方便理解。
一、节点(node)
节点是具有数据收发能力的电子设备。例如,节点可以为汽车座舱(Cockpit Domain)设备,或者汽车座舱设备中的一个模块(座舱域控制器(cockpit domain controller,CDC)、摄像头、屏幕、麦克风、音响、电子钥匙、无钥匙进入或启动系统控制器等模块中的一个或者多个)。在具体实施过程中,节点可以是数据中转设备,例如路由器、中继器、桥接器或交换机,也可以是一个终端设备,例如各种类型的用户设备(user equipment,UE)、手机(mobilephone)、平板电脑(pad)、台式电脑、耳机、音响等,还可以包括机器智能设备如无人驾驶(self-driving)设备、运输安全(transportation safety)设备、虚拟现实(virtualreality,VR)终端设备、增强现实(augmented reality,AR)终端设备、机器类型通信(machine type communication,MTC)设备、工业控制(industrialcontrol)设备、远程医疗(remote medical)设备、智能电网(smartgrid)设备、智慧城市(smart city)设备,还可以包括可穿戴设备(如智能手表,智能手环,计步器等)等等。在某些技术场景中,具备相类似数据收发能力的设备的名称也可能不称为节点,但是为了方便描述,本申请实施例中将具有数据收发能力的电子设备统称为节点。
二、密钥(key)
在通信过程中,数据在通信节点之间传递,如果数据要进行保密,就需要通过密钥进 行加密。由于节点中需要保密的内容的秘密层次和等级有时候不相同,因此,需要通过不同种类的密钥进行加密。常用的密钥种类有会话密钥、主密钥、共享密钥等。
1、会话密钥(session key)
会话密钥包括加密密钥、完整性保护密钥和文件密钥等。其中,加密密钥可以用来对节点传输的数据进行保护,也可称为数据加密密钥;完整性保护密钥可以用来对传输的数据作完整性保护;文件密钥可以用来保护传输的文件。可选的,会话密钥可以预先配置在通信双方的节点中,也可以由通信双方协商得到,也可以通过原有的密钥进行派生,还可以由密钥分配中心(Key Distribution Center,KDC)分配。可选的,会话密钥可以是对称加密算法(symmetric encryption algorithm)的密钥,也可以是非对称加密算法(asymmetric encryption algorithm)的密钥。
2、主密钥(masterkey)
主密钥是节点中等级较高的一个秘密值,可以用于派生会话密钥、次主密钥等。其中,次主密钥是等级介于主密钥和会话密钥中间的密钥,有时也称为中间密钥。
在一些可能的方案中,主密钥可以通过物理或电子隔离的方式受到严格的保护。
3、共享密钥(sharedkey,SK)。
共享密钥是通信双方的节点中保存的相同的秘密值,在一些可选的方案中,节点可以将主密钥、或者会话密钥、或者预共享密钥(pre-shared key,PSK)作为共享密钥。节点中的共享密钥的数量可以有一个也可以有多个。
例如,节点将会话密钥作为共享密钥,如节点A与节点B使用对称加密算法进行通信(即加密和解密使用相同的密钥),节点A使用加密密钥Km对明文消息加密发送给节点B,节点B使用解密密钥Km进行解密。这种情况下,加密密钥Km可以作为两个节点间的共享密钥。
再如,节点可以将预共享密钥作为共享密钥,其中预共享密钥是标识两个节点连接的秘密值。预共享密钥可以是在通信双方的节点中预先配置的,如车辆的座舱域控制器(cockpit domain controller,CDC)与车载雷达设备是可以进行通信的两个节点,CDC和车载雷达在部署时已经预先配置了秘密值,只有该车辆的CDC可以与车顶雷达进行连接或数据传输。预共享密钥也可以是通信双方通过通信获取的,如CDC与手机蓝牙进行连接之前,可以通过确认配对生成预共享密钥。除此之外,预共享密钥还可以是一个可信设备(如KDC)分别发送给第一节点和第二节点的。
三、密钥协商
密钥协商是通信双方通过交互一部分参数,从而协商得到密钥的过程。用于密钥协商的算法称为密钥协商算法,也可以称为密钥交换算法。常用的密钥协商算法有迪菲赫尔曼(Diffie-Hellman,DH)算法、基于椭圆曲线密码(Elliptic Curve Cryptosystems,ECC)的迪菲赫尔曼(ECDH)算法、奥克利(Oakley)算法、国密算法(如SM1、SM2、SM3和SM4)等。
其中,以DH算法为例,两个节点使用同一个素数p和随机数g,各自产生的随机数a和b。第一节点将g的a次方mod P产生的数值发送给第二节点,第二节点将g的b次方mod P产生的数值发送给第一节点,第一节点再对接收的结果做a次方运算,第二节点对接收的结果做a次方运算,最终密码形成,密钥交换完成,其中mod表示模运算。
参见图1,图1是本申请实施例提供的一种DH算法的原理示意图,DH算法交换密钥的步骤如下:
步骤1:第一节点确定素数p,随机数g和随机数a。
步骤2:第一节点生成第一计算值A,其中,A满足下列公式:A=g a mod p。
步骤3:第一节点向第二节点发送素数p,随机数g和第一计算值A。
步骤4:第二节点确定随机数b。
步骤5:第二节点计算得到第二计算值B,其中,B满足例如下列公式:B=g b mod p。
步骤6:第二节点计算协商密钥s=A b mod p。
步骤7:第二节点向第一节点发送第一计算值B。
步骤8:第一节点计算s=B a mod p。
由于K=A bmodp=(g amodp) bmodp=g abmodp=(g bmodp) amodp=B amodp,因此第一节点和第二节点计算出的密钥s是相同的。而由于密钥s没有在网络上传输,且由于实际算法选择的素数p、随机数g、随机数a和随机数b的数值是非常大的,使得根据网络传输的素数p、随机数g、第一计算值A和第二计算值B难以推算出密钥s,因此通过DH算法获取的密钥具有安全性。
四、密钥派生
密钥派生是从一个秘密值中派生出一个或多个密钥,而用于派生密钥的算法称为密钥派生算法(key derivation function,KDF)。例如,通过秘密值Key派生的新密钥DK可以表示为:DK=KDF(Key,fresh)。其中,fresh是新鲜参数(fresh parameter),用于更新的参数,可以包括计数器值(counter)、序列号(number)、随机值(rand)、帧号(framenumber)等等中的至少一个,不同时刻的新鲜参数通常不同。其中,帧号是帧的编号,帧是一种若干比特或字段组成的特定的信息结构,例如时分多址(time division multiple access,TDMA)通信技术把时间分割成周期性的帧,每一帧的帧号从0到2715647周期性变化。
常用的密钥派生算法有基于密码的密钥派生函数(password-based key derivation function,PBKDF)、斯克里普特(scrypt)算法等,其中PBKDF算法又包括第一代PBKDF1和第二代PBKDF2。可选的,一些KDF算法在派生密钥过程中,使用哈希算法对输入的秘密值进行哈希变化,因此KDF函数还可以接收算法标识作为输入,用于指示使用何种哈希算法。
以PBKDF2为例,PBKDF2算法通过秘密值Key派生的新密钥DK可以表示为:DK=PBKDF2(PRF,Key,salt,c,dk_len),其中参数PRF指示使用何种哈希算法的标识;salt是随机生成的盐,可以看作是新鲜参数;c是迭代次数;dk_len是生成的DK的长度,也可以称为块大小,可以缺省。参见图2,图2是本申请实施例提供的一个密钥派生算法的示意图,通过秘密值201、算法标识1和新鲜参数fresh1,可以得到派生密钥1,而通过秘密值201、算法标识1和新鲜参数fresh2,可以得到派生密钥2,其中迭代次数和块大小已经预先设置。
五、密码算法
密码算法可以是用于加密和/或解密的数学函数,也可以称为密码函数。常用的密码算法包括散列算法或者认证算法等。其中,散列算法又称为哈希(Hash)函数、哈希算法, 散列算法可以将任意长度的信息转换为一个标识,且很难找到逆向规律。常用的散列算法包括哈希运算消息认证码(hash-based message authentication code,HMAC)、HMAC国密算法HMAC-SM(如HMAC-SM3)、HMAC-安全散列算法(HMAC-secure hash algorithm,HMAC-SHA),如HMAC-SHA256、HMAC-SHA3等,还可以包括信息摘要(message digest,MD)算法,如MD2、MD4或MD5等。进一步的,密码算法还可以包括末端快速扩增(rapid-amplification of cDNA ends,RACE)原始完整性验证消息摘要(RACE Integrity Primitives Evaluation Message Digest,RIPEMD)算法。
下面对本申请实施例的系统架构和业务场景进行描述。需要说明的是,本申请描述的系统架构及业务场景是为了更加清楚的说明本申请的技术方案,并不构成对于本申请提供的技术方案的限定,本领域普通技术人员可知,随着系统架构的演变和新业务场景的出现,本申请提供的技术方案对于类似的技术问题,同样适用。
请参见图3,图3是本申请实施例提供的一种通信系统的架构示意图,包括第一节点301和第二节点302。第一节点301可以通过数据链路与第二节点302进行通信,为了防止窃听者(或者说攻击者)获取信息的内容,通信的信息可以使用加密密钥进行加密。例如,第一节点301将需要发送的明文消息303通过加密密钥305加密,得到密文消息304。第一节点301向第二节点302发送该密文消息304,相应的,第二节点302接收密文消息304后,可以将密文消息304通过密钥解密得到明文消息303,完成数据的传输。而除了加密密钥,解密密钥外,第一节点301和第二节点302中还可以包括如完整性保护密钥、文件密钥、主密钥等密钥。
需要说明的是,第一节点301和第二节点302可以是不同的设备,例如,请参见图4,图4是本申请实施例提供的一种密钥更新方法的使用场景示意图。CDC401和摄像头402是智能座舱设备中的两个节点,可以将CDC401看作第一节点301,将摄像头402看作第二节点302,摄像头402通过蓝牙将视频数据经过密钥加密后发送给CDC401,CDC401通过蓝牙接收加密的视频数据并进行解密得到拍摄的视频数据。第一节点301和第二节点302也可以是相同种类的节点,例如第一节点301为手机A,第二节点302为手机B,则手机A可以通过网络通话将本端的语音数据经过加密后发送给B端。
可选的,第一节点301与第二节点302传输数据的数据链路可以包括各种类型的连接介质,例如有线链路、无线链路(如WIFI、蓝牙等)或者光纤链路等。
可选的,第一节点301可以是通信的发起方,可以称为主节点,相应的,第二节点302是通信的接收方,可以称为从节点。
为了保证节点中加密的内容不被泄漏,密钥的使用寿命往往是有期限的,因此需要引入密钥更新的机制。例如,以蓝牙连接的CDC401和摄像头402为例,若通过E0加密方式,CDC401和摄像头402需要在2 28个蓝牙时钟(ticks)之内(约23.3小时)更新一次密钥;若通过高级加密标准(advanced encryption standard,AES)加密方算法,CDC401和摄像头402需要在2 38个ticks(约2.72年)更新一次密钥。再如,在包含主密钥和会话密钥的节点中,通过主密钥和计数器值生成会话密钥时,需要在计数器值反转(或者说重新开始新一轮的计数)之前更新主密钥。而更新密钥的过程中,节点间传输的用于更新密钥的消息 容易受到中间人攻击,影响数据安全性。为了解决这个问题,本申请实施例提供如下方法。
请参见图5,图5是本申请实施例提供的一种密钥更新方法的流程示意图,该密钥更新方法可以基于图3所示的架构来实现,该方法包括但不限于如下步骤:
步骤S501:第一节点向第二节点发送第一密钥更新请求。
具体的,第一密钥更新请求中包括第一密钥协商参数和第一身份认证信息。其中,第一密钥协商参数是用于生成第一目标密钥的密钥参数,下面例举几种可选情况:
情况一,第一密钥协商参数可以包括密钥协商算法的参数KEm,为了方便描述,可以称密钥协商算法的参数KEm为第一密钥协商算法参数。
例如,以密钥协商算法为DH算法为例,第一节点中确定的DH算法的参数包括素数p、随机数g、随机数a和计算值A。其中,计算值A满足如下等式:A=g a mod p,而素数p、随机数g还用于第二节点生成DH算法的其他参数。可选的,由于素数p、随机数g和计算值A需要发送给第二节点,因此可以将素数p、随机数g和计算值A看作第一节点的公钥,相应的,由于随机数a没有发送给第二节点,因此可以将随机数a看作第一节点的私钥。可选的,第一节点将计算值A作为第一密钥协商算法参数KEm,而素数p、随机数g在发送第一密钥更新请求之前发送给第二节点,也可以将素数p、随机数g和计算值A作为第一密钥协商算法参数KEm,通过第一密钥更新请求发送给第二节点。
情况二,第一密钥协商参数可以包括新鲜参数(fresh parameter)。
本申请实施例中,第一密钥更新请求中的第一身份认证信息可以是通过第一节点和第二节点之间的共享密钥生成的,为了方便描述,将生成第一密钥更新请求的共享密钥称为第一共享密钥,第一共享密钥可以为主密钥或预共享密钥PSK等密钥。
在一种可选的方案中,第一身份认证信息可以是通过密码算法生成的。以密码算法为HMAC为例,HMAC接收一个或多个字符参数的输入,输出一个标识,该标识可以作为第一身份认证信息。下面以散列函数为HMAC为例,进行举例说明:
案例1,第一节点生成的第一身份认证信息AUTHm可以为HMAC(PSK),即AUTHm=HMAC(PSK)。
案例2,如果第一密钥协商参数表示为S1,第一节点生成的第一身份认证信息AUTHm可以为HMAC(PSK,S1),即AUTHm=HMAC(PSK,S1)。其中,S1可以为上述情况一所述的第一密钥协商算法参数KEm,也可以为上述情况二所述的新鲜参数(如,计数器值、序列号、随机值、帧号等等中的至少一个)。
案例3,在第一密钥更新请求中还包括随机数值(number used once,NONCE),则第一节点生成的第一身份认证信息AUTHm可以为HMAC(PSK,S1,NONCEm),其中NONCEm为第一节点生成的随机数值,即AUTHm=HMAC(PSK,S1,NONCEm)。
本申请实施例中,在第一密钥更新请求中还可以指示第一目标密钥的有效期(expiration)和第一更新时间的信息中的至少一项,其中第一更新时间用于指示启用该第一目标密钥的时间,也可以称为启用时间或者启动时间。
例如,第一密钥更新请求中包括指示第一目标密钥的有效期的第一指示信息,该第一指示信息可以为具体的日期时间,例如,第一指示信息为2020年02月06日的00时52分 50秒,可以指示第一目标密钥有效的日期时间到2020年02月06日的00时52分50秒或者无效的日期时间从2020年02月06日的00时52分50秒后开始;该第一指示信息还可以为指示有效时间或者无效时间的字符串,例如时间戳“1590921570”,指示2020年02月06日的00时52分50秒;该第一指示信息还可以为定时器等,例如第一目标密钥的有效期1000秒,表明第一目标密钥在生成后或启用后的第1000秒之前有效;该第二指示信息还可以包括帧号等。
再如,第一密钥更新请求中包括指示第一更新时间的第二指示信息。该第二指示信息可以为帧号、具体的日期时间、字符串或者定时器等等中的一个或者多个。其中,帧号是通信帧的编号或者索引,而通信帧是第一节点与第二节点进行通信时的一种消息结构。通信帧包括信令面上行帧、信令面下行帧、用户面上行帧或者用户面下行帧中的至少一项。而通信帧的帧号通常在预设的帧号值范围内循环,例如,时分多址TDMA通信技术把时间分割成周期性的帧,每一帧的帧号从0到2715647周期性变化。第一节点可以通过在更新请求中携带的帧号,来指示第一更新时间,为了方便描述,将第一密钥更新请求中携带的帧号称为第一帧号。例如,第一帧号为2345,指示第一目标密钥应用于从帧号2345开始的通信帧后。可选的,所述第一帧号可以为多个帧号,例如第一帧号可以包括用户面下行帧的A帧号和用户面上行帧的B帧号,可以指示在从A帧号及以后的用户面下行帧中应用第一目标密钥,从B帧号及以后的用户面上行帧中应用第一目标密钥。
可选的,在第一密钥更新请求通过第一帧号来指示第一更新时间的情况下,第一帧号可以通过多个比特来指示,例如F个比特。可替代的,所述第一密钥更新请求包括媒体接入控制序列号(media access control serial number,MAC SN),所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特,所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。为了方便描述,本文以第一帧号为例进行阐述,并不旨在限定本发明。
针对第一密钥更新请求还包括有效期和/或第一更新时间的情况,第一身份认证信息还可以存在如下案例:
案例4,如果第一密钥更新请求中包括指示第一目标密钥的有效期的信息expiration,则第一节点生成的身份认证信息AUTHm可以为HMAC(PSK,S1,expiration),即AUTHm=HMAC(PSK,S1,expiration)。
案例5,如果第一密钥更新请求中包括指示第一更新时间的信息timer,第一节点生成的身份认证信息AUTHm可以为HMAC(PSK,S1,timer),即AUTHm=HMAC(PSK,S1,timer)。所述启用时间timer表示启动新密钥的时间。
案例6,如果第一密钥更新请求中包括随机数值NONCEm、指示第一目标密钥的有效期的信息expiration、以及指示第一更新时间的信息timer时,第一节点生成的身份认证信息AUTHm可以为HMAC(PSK,S1,NONCEm,expiration,timer),即AUTHm=HMAC(PSK,S1,NONCEm,expiration,timer)。
当然,生成第一身份认证信息时,除了第一共享密钥之外,还可以包括其他信息(如第一节点的编号、第一节点的地址或第一节点与第二节点的连接标识等等)。需要说明的是,第一密钥更新请求包括随机数值NONCEm、指示第一目标密钥的有效期的信息expiration、以及第一更新时间的信息timer等参数的情况下,第一节点第一生成身份认证信息AUTHm也可以不使用其中的部分或者全部参数。
可选的,第一节点可以通过第一通信帧向第二节点发送第一密钥更新请求,其中,所述第一通信帧的第二帧号小于上一次更新密钥时用到的密钥更新请求中携带的第三帧号,该第三帧号用于指示上一次更新的密钥的启动时间。第一密钥更新请求中携带的第一帧号大于第二帧号且小于第三帧号。例如,第三帧号为2365,表明上一次更新的密钥应用于从帧号为2365开始的通信帧后,第一节点需要在帧号重新到达2365之前确定第一目标密钥,因此第一节点可以在帧号为2345的第一通信帧中发送第一密钥更新请求,第一密钥更新请求中通过第一帧号2355来指示第一目标密钥的启动时间。由于对通信过程中的通信帧进行安全保护时,使用的加密方法可以是根据帧号和上次更新的密钥进行加密的,因此,在帧号重复到上一次更新密钥的帧号之前确定第一目标密钥,从而通过第一目标密钥来加密数据帧,这样可以使得两次相同的帧号的数据帧是通过不同的密钥进行加密的,提高了数据的安全性。
在可替代的方案中,所述第一密钥更新请求包括MAC序列号(MAC SN),并非所述第一帧号,所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。那么可替代的,上一次更新密钥时用到的密钥更新请求中携带的第三帧号也可以替代为MAC SN,即用于指示所述第三帧号的多个比特中的部分比特所指示的MAC SN。在该可替代的方案中,第一、第二以及第三帧号之间的大小关系不变。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
可选的,第一目标密钥与上一次更新的密钥为同一类密钥,例如,第一密钥更新请求中请求更新的第一目标密钥为加密密钥时,第三帧号为上一次更新加密密钥时用到的密钥更新请求中携带的帧号。
可选的,第一节点可以记录通信帧的帧号,当通信帧的帧号与第三帧号小于或者等于第一阈值时,发送第一密钥更新请求。例如,第一节点预设第一阈值为20,若第三帧号为2365时,第一节点可以在记录到帧号为2345的通信帧时,发送第一密钥更新请求。进一步的,第一节点可以记录一个或者多个通信帧的帧号,例如记录信令面上行帧、信令面下行帧、用户面上行帧或者用户面下行帧中的至少两项,若其中一个通信帧的帧号与第三帧号的差值达到第一阈值,则发送第一密钥更新请求。
可选的,若上一次更新密钥的过程中没有携带指示密钥启动时间的信息或者第一节点之前中没有进行过密钥更新,则第一节点可以预先配置目标帧号,若第一节点检测到当前的通信帧号与目标帧号的差值小于或等于第一阈值时,发送第一密钥更新请求。需要说明的是,除了获取上一次更新密钥时携带的第三帧号,第一节点也可以记录上次更新密钥时 发送的密钥更新请求的帧号,或者上一次接收响应消息时的帧号,或者应用上一次更新的密钥第一次进行通信时的通信帧的帧号,用于检测当前密钥是否需要进行更新。
步骤S502:第二节点根据第一共享密钥验证第一身份认证信息。
具体地,第一身份认证信息是第一节点根据第一节点与第二节点之间的第一共享密钥生成的,因此第二节点可以根据该第一共享密钥验证所述第一身份认证信息是否正确。
在一种可选的方案中,根据协议规定,第一节点使用什么参数生成第一身份认证信息,则第二节点也应当使用相同的参数生成用于校验的身份认证信息,如果用于校验的身份认证信息与第一身份认证信息相同,则认为验证通过。例如,第一身份认证信息是通过HMAC生成的,因此第二节点可以通过HMAC生成用于校验的身份认证信息,也称为校验值check1,然后通过用于校验的身份认证信息验证第一身份认证信息是否正确。下面进行举例说明:
例如,若第一身份认证信息AUTHm为HMAC(PSK),则第二节点根据与第一节点之间的预共享秘钥PSK通过HMAC得到校验值check1=HMAC(PSK),若校验值check1与AUTHm相同,则验证通过。
再如,若第一身份认证信息AUTHm为HMAC(PSK,S1),则第二节点根据与第一节点之间的预共享秘钥PSK和第一密钥协商参数S1通过HMAC得到校验值check1=HMAC(PSK,S1),若校验值check1与AUTHm相同,则验证通过。其中第一密钥协商参数S1可以参照步骤S501中的相应描述。
可选的,若第一身份信息验证不通过,表明第一节点的身份不可信,因此第二节点可以不执行之后的密钥更新步骤。在这种情况下,第二节点可以断开与第一节点之间的通信连接,或者第二节点向第一节点发送指示更新失败的信息,或者第二节点丢弃该第一密钥更新请求不做响应,以保证第二节点的数据安全性。
可选的,第二节点可以验证第一密钥更新请求的消息完整性,以防止第一密钥更新请求中的信息被其他设备所篡改。第一密钥更新请求中可以包括完整性保护验证标识,第二节点通过该完整性保护验证标识验证第一密钥更新请求的消息完整性,若验证通过,则继续执行验证第一身份认证信息的步骤;若验证不通过,第二节点可断开与第一节点之间的通信连接,或者向第一节点发送指示更新失败的信息,或者第二节点丢弃该第一密钥更新请求不做响应,以保证第二节点的数据安全性。
步骤S503:若第一身份认证信息验证通过,第二节点根据第一密钥协商参数确定第一目标密钥。
具体的,第二节点根据第一密钥更新请求中的第一密钥协商参数确定第一目标密钥,至少包括以下四种可选方法:
方法1,第一密钥协商参数满足上述情况一,即第一密钥协商参数包括第一密钥协商算法参数KEm,第二节点可以确定该密钥协商算法的第二密钥协商算法参数KEs。第二节点可以根据第一密钥协商算法参数KEm和第二密钥协商算法参数KEs,生成第一目标密钥。
例如,以密钥协商算法为DH算法为例,第二节点接收来自第一节点的DH算法的参数可以包括素数p、随机数g和第一计算值A,而第二节点可以确定的DH算法的参数包括随机数b和计算值B,即第二密钥协商算法参数KEs,其中B满足如下等式:B=g b mod p。第二节点根据随机数b,计算值A与素数p可以确定第一目标密钥K1,其中K1满足如下 等式:K1=A b mod p。
可选的,第二节点确定的DH算法的参数中,随机数b用于第二节点生成第一目标密钥,因此可以将随机数b看作是第二节点的私钥,而计算值B用于发送给第一节点,因此可以将计算值B看作是第二节点的公钥。
方法2,第一密钥协商参数满足上述情况二,即第一密钥协商参数包括新鲜参数,则第二节点可以根据第二目标密钥和新鲜参数,生成第一目标密钥。其中,第二目标密钥可以为第一节点与第二节点之间的共享密钥。
可选的,第二节点可以通过KDF生成第一目标密钥。
例如,第二节点根据第二目标密钥K2、新鲜参数fresh,通过KDF算法确定的第一目标密钥K1为:K1=KDF(K2,fresh)。
方法3,第一密钥协商参数满足上述情况二,即第一密钥协商参数包括新鲜参数,在第二节点中获取有算法标识tag的情况下,第二节点可以根据第二目标密钥K2、新鲜参数fresh和算法标识tag通过KDF算法确定的第一目标密钥K1,即:K1=KDF(K2,fresh,tag)。
其中,算法标识可以用于指示生成第一目标密钥所使用的算法,如使用字符串“encryption”指示用于生成加密密钥的算法,再如使用字符串“integrity”指示用于生成完整性保护密钥的算法。算法标识也可以用于指示使用某种哈希算法的标识,例如,使用字符串“SHA256”指示确定第一目标密钥的算法为SHA256算法。算法标识还可以使用算法标识还可以使用数值表示,比如01表示AES加密算法,10表示基于消息认证的AES算法(AES-cypher-based message authentication code,AES-CMAC)完整性算法。
算法标识可以是第一节点和第二节点间预先设置的,也可以是由第一节点确定后发送给第二节点的。
方法4,第一密钥协商参数满足上述情况二,即第一密钥协商参数包括新鲜参数,在第二节点中获取有算法标识tag、算法类型type的情况下,第二节点可以根据第二目标密钥K2、新鲜参数fresh、算法标识tag以及密钥类型type确定第一目标密钥K1,即K1=KDF(K2,fresh,tag,type)。其中type表示密钥类型,如使用字符串“encryption”指示用于生成加密密钥,再如使用字符串“integrity”指示用于生成完整性保护密钥。算法标识用于指示生成第一目标密钥所使用的算法。
密钥类型可以是在第一密钥更新请求中指示的,也可以是第一节点与第二节点在生成第一目标密钥之前预先协商的。
可选的,在上述方法2、方法3、方法4任一个或多个所示方法的确定第一目标密钥的过程中,第二节点可以先根据第一目标密钥K2、新鲜参数fresh确定中间密钥,再根据中间密钥通过算法标识tag、密钥类型type中的至少一项来确定第一目标密钥K1。例如,第二节点通过密钥派生函数KDF1得到中间密钥Kmid:Kmid=KDF1(K2,fresh),再根据中间密钥Kmid通过密钥派生函数KDF2确定第一目标密钥K1:K1=KDF2(Kmid,tag,type)。其中,KDF1和KDF2可以是相同的密钥派生函数,也可以是不同的密钥派生函数。在这种情况下,第一节点只需要在确定中间密钥Kmid时生成新的新鲜参数,而不需要在每次确定第一目标时都生成新的新鲜参数,减少了生成新鲜参数的次数,更方便管理生成的新鲜参数。需要说明的是,这里是为了更清楚的阐述方案以两个步骤的方式解释如何得到第 一目标密钥,在实际的处理中,也可以是通过一个步骤完成,中间密钥Kmid只是一个中间的结果,即确定第一目标的方式满足:K1=KDF2(KDF1(K2,fresh),tag,type)。
可选的,在第一密钥更新请求中携带指示第一更新时间的信息时,第二节点中生成的第一目标密钥应用于从第一更新时间开始的时间后。可选的,在第一更新时间通过第一帧号来指示的情况下,第一目标密钥应用于从第一更新时间开始的通信帧后。
可选的,第二节点可以获取上一次更新密钥时的密钥更新请求中携带的第三帧号(或者,也可以是第三帧号对应的MAC序列号),若第二节点检测到通信帧的帧号反转(或者说重新开始新一轮的计数)过一次,且当前通信帧的帧号等于或者大于第三帧号(或者第三帧号对应的MAC序列号),而此时还没有接收到密钥更新请求或者还没有应用新密钥,则第二节点可以断开与第一节点的连接,进一步的,还可以删除安全上下文,便于重新发起与对方的连接,保证通信过程中的安全性。其中,安全上下文包括共享密钥、密钥有效期、密钥更新时间等安全信息中的至少一项。
可选的,第二节点还可以获取应用上一次更新的密钥第一次进行通信时的通信帧的帧号,若第二节点检测到通信帧的帧号反转过一次,且当前通信帧的帧号等于或者大于应用上一次更新的密钥第一次进行通信时的通信帧的帧号,而此时还没有接收到密钥更新请求或者还没有应用新密钥,则第二节点可以断开与第一节点的连接,进一步的,还可以删除安全上下文,保证通信过程中的安全性。
步骤S504:第二节点向第一节点发送第一响应消息。
具体的,第一响应消息中包括第二身份认证信息,用于认证第二节点的身份。在第二节点通过方法1生成第一目标密钥的情况下,第一响应消息中还包括第二密钥协商算法参数KEs。可选的,第一响应消息中还包括第二节点生成的随机数值NONCEs。
本申请实施例中,第二身份认证信息可以是第二节点基于第一节点和第二节点之间的第一共享密钥生成的。
在一种可选的方案中,第二身份认证信息可以是通过密码算法生成的。以密码算法为HMAC为例,HMAC接收一个或多个字符参数的输入,输出一个标识,该标识可以作为身份认证信息。下面以密码算法为HMAC为例,进行举例说明:
案例1,第二节点生成的第二身份认证信息AUTHs可以为HMAC(PSK),即AUTHs=HMAC(PSK)。
案例2,在第一响应消息中还包括第二密钥协商参数KEs的情况下,第二节点生成的第二身份认证信息AUTHs可以为HMAC(PSK,KEs),即AUTHs=HMAC(PSK,KEs)。
案例3,在第一响应消息中还包括第二节点生成的随机数值NONCEs的情况下,第二节点生成的身份认证信息AUTHs可以为HMAC(PSK,KEs,NONCEs),即AUTHs=HMAC(PSK,K1,NONCEs)。
当然,用于生成第二身份认证信息的参数中,除了第一共享密钥之外,还可以包括其他参数(如第二节点的编号、第二节点的地址或第二节点与第一节点的连接标识等等)。在第一响应消息中包括第二密钥协商参数KEs和/或随机数值NONCEs等参数的情况下,第二节点生成身份认证信息AUTHs也可以不使用这些参数。
可选的,所述第一响应消息为所述第二节点根据所述第一密钥协商参数和第一共享密 钥对所述第一身份认证信息认证通过后发送的响应消息。
步骤S505:第一节点通过第一共享密钥验证第二身份认证信息。
具体地,第二身份信息是第二节点根据第一节点与第二节点之间的第一共享密钥生成的,因此第一节点可以根据该第一共享密钥验证第二身份认证信息是否正确。
在一种可选的方案中,根据协议规定,第二节点使用什么参数生成第二身份认证信息,则第一节点也应当使用相同的参数生成用于校验的身份认证信息,如果用于校验的身份认证信息与第二身份认证信息相同,则认为验证通过。
例如,第二身份认证信息可以是通过HMAC生成的,因此第一节点可以通过HMAC生成用于校验的身份认证信息,也称为校验值check2,然后通过用于校验的身份认证信息验证第二身份认证信息是否正确。下面进行举例说明:
例如,若第二身份认证信息AUTHs为HMAC(PSK),则第一节点根据与第二节点之间的预共享密钥PSK通过HMAC得到校验值check2=HMAC(PSK),若校验值check2与AUTHs相同,则验证通过。
再如,若第一身份认证信息AUTHs为HMAC(PSK,KEs),则第一节点根据与第二节点之间的预共享密钥PSK和第一响应消息中的第二密钥协商参数KEs,通过HMAC得到校验值check2=HMAC(PSK,KEs),若校验值check2与AUTHs相同,则验证通过。
可选的,若第二身份认证信息验证不通过,表明第二节点的身份不可信,因此第一节点可以断开与第二节点之间的连接,或者向第二节点发送指示更新失败的信息,或者丢弃该第一响应消息不做响应,以保证数据更新过程中的数据安全性,也便于与需要进行密钥更新的节点进行连接。
可选的,第一节点可以验证第一响应消息的消息完整性,以防止第一响应消息中的信息被其他设备所篡改。第二节点可以在第一响应消息中添加完整性保护验证标识,第一节点通过该完整性保护验证标识验证第一响应消息的消息完整性,若验证通过,则继续执行验证第二身份认证信息的步骤;若验证不通过,第一节点可以断开与第二节点之间的连接,或者向第二节点发送指示更新失败的信息,或者丢弃该第一响应消息不做响应,以保证数据更新过程中的数据安全性。
步骤S506:若第二身份认证信息验证通过,第一节点根据第一密钥协商参数确定第一目标密钥。
具体的,第一节点根据第一密钥协商参数确定第一目标密钥,至少有以下几种可选方法:
方法1,第一密钥协商参数满足上述情况一,即第一密钥协商参数包括密钥协商算法的参数,第一响应消息中包括第二密钥协商参数KEs。第一节点可以根据第一密钥协商算法参数KEm和第二密钥协商算法参数KEs,生成第一目标密钥。
例如,以密钥协商算法为DH算法为例,第一节点中产生的DH算法的参数包括素数p、随机数g,随机数a和第一计算值A,第一节点接收来自第二节点的DH算法的参数包括第一计算值B,第一节点根据随机数a,计算B与素数p可以确定第一目标密钥K1,其中K1满足如下等式:K1=B a mod p。由于K1=A bmodp=(g amodp) bmodp=g abmodp=(g bmodp) a=B amodp,因此第一节点和第二节点确定的 第一目标密钥K1是相同的。
方法2,第一密钥协商参数满足上述情况二,即第一密钥协商参数包括新鲜参数,第一节点根据第二目标密钥和新鲜参数,生成第一目标密钥。
可选的,第一节点可以通过KDF生成第一目标密钥。
例如,第一节点根据第二目标密钥K2、新鲜参数fresh,通过KDF确定的第一目标密钥K1为:K1=KDF(K2,fresh)。
方法3,第一密钥协商参数满足上述情况二,即第一密钥协商参数包括新鲜参数,在第一节点中获取有算法标识tag的情况下,第一节点可以根据第二目标密钥K2、新鲜参数fresh和算法标识tag通过KDF算法可以确定第一目标密钥K1,即:K1=KDF(K2,fresh,tag)。
其中,算法标识可以用于指示生成第一目标密钥所使用的算法,如使用字符串“encryption”指示用于生成加密密钥的算法,再如使用字符串“integrity”指示用于生成完整性保护密钥的算法。算法标识也可以用于指示使用某种哈希算法的标识,例如,使用字符串“SHA256”指示确定第一目标密钥的算法为SHA256算法。算法标识还可以使用算法标识还可以使用数值表示,比如01表示AES加密算法,10表示基于消息认证的AES算法(AES-cypher-based message authentication code,AES-CMAC)完整性算法。
其中,算法标识可以是第一节点和第二节点间预先设置的,也可以是由第一节点确定的。
方法4,第一密钥协商参数满足上述情况二,即第一密钥协商参数包括新鲜参数,在第一节点中获取有算法标识tag、算法类型type的情况下,第一节点可以根据第二目标密钥K2、新鲜参数fresh、算法标识tag以及密钥类型type确定第一目标密钥K1,即K1=KDF(K2,fresh,tag,type)。其中type表示密钥类型,如使用字符串“encryption”指示用于生成加密密钥,再如使用字符串“integrity”指示用于生成完整性保护密钥。算法标识用于指示生成第一目标密钥所使用的算法。
密钥类型可以是在第一密钥更新请求中指示的,也可以是第一节点与第二节点在生成第一目标密钥之前预先协商的。
可选的,在上述方法2、方法3、方法4所示方法的任一个或多个确定第一目标密钥的过程中,第一节点可以先根据第一目标密钥K2、新鲜参数fresh确定中间密钥,再根据中间密钥通过算法标识tag、密钥类型type中的至少一项来确定第一目标密钥K1。例如,第一节点通过密钥派生函数KDF1得到中间密钥Kmid:Kmid=KDF1(K2,fresh),再根据中间密钥Kmid通过密钥派生函数KDF2确定第一目标密钥:K1=KDF2(Kmid,tag,type)。其中,KDF1和KDF2可以是相同的密钥派生函数,也可以是不同的密钥派生函数。这里是为了更清楚的阐述方案以两个步骤的方式解释如何得到第一目标密钥,在实际的处理中,也可以是通过一个步骤完成,中间密钥Kmid只是一个中间的结果,即确定第一目标的方式满足:K1=KDF2(KDF1(K2,fresh),tag,type)。
可选的,第一目标密钥可以应用为第一节点与第二节点之间的共享密钥,包括主密钥、会话密钥等。
可选的,在第一密钥更新请求指示了第一更新时间的情况下,第一目标目标密钥可以 应用于从第一更新时间开始的时间内。例如,第一目标密钥是主密钥,第一密钥更新请求中包括的指示第一密保密钥的信息为时间戳“1590921570”,指示启用第一目标密钥的时间为为2020年02月06日的00时52分50秒,则第一节点和第二节点从2020年02月06日的00时52分50秒开始的时间后使用第一目标密钥作为主密钥。
可选的,在第一密钥更新请求指示了第一目标密钥的有效期的情况下,第一目标目标密钥可以应用于第一目标密钥的有效期内。例如,第一目标密钥是主密钥,第一密钥更新请求中包括的指示第一密保密钥的信息为时间戳“1590952447”,指示第一目标密钥的有效期为2020年02月06日的09时28分26秒内,则第一节点和第二节点在2020年02月06日的09时28分26秒可以使用第一目标密钥作为主密钥。
可选的,第二节点还可以检测第一目标密钥的有效期,便于在第一目标密钥的有效期之前确定新的目标密钥。
可以理解的是,在第一密钥更新请求指示了第一更新时间和第一目标密钥的有效期时,则第一目标密钥应用于从第一更新时间开始的第一目标密钥的有效期内。
可选的,第二目标密钥可以是加密密钥,这种情况下,第一密钥更新请求可以经过第二目标密钥加密,相应的,第二节点接收来第一密钥更新请求后,可以使用第二目标目标解密。同理,第一响应请求可以经过第二目标密钥加密,相应的,第一节点接收第一响应消息后,可以使用第二目标目标解密。
可选的,第二目标密钥可以是完整性保护密钥,这种情况下,第一密钥更新请求可以经过第二目标密钥进行完整性保护。相应的,第二节点接收来自第一节点的第一密钥更新请求后,可以使用第二目标密钥检查数据的完整性。同理,第一响应请求可以经过第二目标密钥进行完整性保护,相应的,第一节点接收第一响应消息后,可以使用第二目标密钥检查数据的完整性。传统密钥更新过程中,更新密钥的时间是配置的,因此在更新新密钥时,由于旧密钥已经到期,因此更新密钥时需要先终止加密过程,待密钥更新完成后再恢复加密过程,但是终止加密过程和恢复加密过程会影响密钥更新效率,且终止加密过程会影响安全性。而本申请的密钥更新方法,在旧密钥到期前更新密钥,由于旧密钥还没有到期,不需要终止加密过程,提高了密钥更新的效率,提升了数据安全性。
可选的,第二目标密钥可以是主密钥,这种情况下,第二目标密钥可以用于确定加密密钥或者完整性保护密钥,因此第一密钥更新请求可以经过根据第二目标密钥确定的加密密钥进行加密,和/或,经过根据第二目标密钥确定的完整性保护密钥进行完整性保护。相应的,第二节点接收第一密钥更新请求后,可以使用根据第二目标密钥确定的加密密钥解密第一密钥更新请求,和/或,经过根据第二目标密钥确定的完整性保护密钥可以使用根据第二目标密钥确定的完整性保护密钥检查数据的完整性。同理,第一响应请求可以经过根据第二目标密钥确定的加密密钥进行加密,和/或,经过根据第二目标密钥确定的完整性保护密钥进行完整性保护。相应的,第一节点接收第一响应消息后,可以使用根据第二目标密钥确定的加密密钥解密第一响应消息,和/或,经过根据第二目标密钥确定的完整性保护密钥可以使用根据第二目标密钥确定的完整性保护密钥检查数据的完整性。
可选的,在通过方法2和方法3确定第一目标密钥的情况下,若第一目标密钥是会话密钥,则第一响应消息也可以是通过第一目标密钥进行加密的或者进行完整性保护。
可选的,在第一节点通过主密钥和计数器值更新会话密钥的情况下,第一节点检测计数器值是否发生了反转(或者说重新开始新一轮的计数),在计数器值发生反转之前,向第二节点发送第一密钥更新请求,确定的第一目标密钥为主密钥。可选的,若第一节点在计数器值反转之前还未发送第一密钥更新请求,则第一节点可以断开与第二节点的通信连接,便于重新接入第二节点,保证与第二节点通信过程的安全性。
可选的,第一节点可以获取上一次更新密钥时的密钥更新请求中携带的第三帧号(或者,也可以是第三帧号对应的MAC序列号),若第一节点检测到通信帧的帧号反转过一次,且当前通信帧的帧号等于或者大于第三帧号(或者第三帧号对应的MAC序列号),而此时还没有发送密钥更新请求或者还没有应用新密钥,则第一节点可以断开与第二节点的连接,进一步的,还可以删除安全上下文,便于重新发起与对方的连接,保证通信过程中的安全性。
在图5所描述的方法中,在密钥更新过程中,第一节点和第二节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一个节点的身份,在身份认证通过后,才根据第一密钥协商参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
以上图5所示的方法实施例中包含了很多可能的实现方案,下面分别结合图6、图7、图8对其中的部分实现方案进行举例说明,需要说明的是,图6、图7、图8未解释到的相关概念或者操作或者逻辑关系可以参照图5所示实施例中的相应描述,因此不再赘述。
参见图6,图6是本申请实施例提供的又一种密钥更新方法,该方法至少包括如下步骤:
步骤S601:第一节点向第二节点发送第一密钥更新请求。
本申请实施例中,第一密钥更新请求可以通过根据第二目标密钥确定的加密密钥来加密和/或通过根据第二目标密钥确定的完整性密钥来进行完整性保护,第二目标密钥是第一节点与第二节点之间的共享密钥。
本申请实施例中第一密钥更新请求中包括第一密钥协商参数和第一身份认证信息。其中,该第一秘钥协商参数可以为第一密钥协商算法参数KEm。可选的,第一密钥更新请求中还可以包括随机数值NONCEm、指示第一更新时间的信息timer和指示第一目标密钥的有效期的信息expiration中的至少一项。
本申请实施例中,第一密钥更新请求中的第一身份认证信息可以是通过第一节点和第二节点之间的第一共享密钥生成的,其中第一共享密钥可以包括主密钥、预共享密钥PSK等。
可选的,生成第一身份认证信息的函数可以是密码算法,以密码算法为HMAC为例,以第一共享密钥为预共享密钥PSK为例,生成的第一身份认证信息AUTHm可以表示为:AUTHm=HMAC(PSK,KEm,NONCEm,expiration,timer),其中,各个参数的顺序可以有所不同。当然,在第一密钥更新请求包括第一密钥协商算法参数KEm、随机数值NONCEm、指示第一目标密钥的有效期的信息expiration、或第一更新时间的信息timer等 参数时,第一节点生成第一身份认证信息AUTHm时也可以不使用其中的部分或者全部参数。
可选的,第一节点可以通过第一通信帧向第二节点发送第一密钥更新请求,其中,所述第一通信帧的第二帧号小于上一次更新密钥时用到的密钥更新请求中携带的第三帧号,该第三帧号用于指示上一次更新的密钥的启动时间。第一密钥更新请求中携带的第一帧号大于第二帧号且小于第三帧号。例如,第三帧号为2365,表明上一次更新的密钥应用于从帧号为2365开始的通信帧后,第一节点需要在帧号重新到达2365之前确定第一目标密钥,因此第一节点可以在帧号为2345的第一通信帧中发送第一密钥更新请求,第一密钥更新请求中通过第一帧号2355来指示第一目标密钥的启动时间。由于对通信过程中的通信帧进行安全保护时,使用的加密方法可以是根据帧号和上次更新的密钥进行加密的,因此,在帧号重复到上一次更新密钥的帧号之前确定第一目标密钥,从而通过第一目标密钥来加密数据帧,这样可以使得两次相同的帧号的数据帧是通过不同的密钥进行加密的,提高了数据的安全性。
可选的,若上一次更新密钥的过程中没有携带指示密钥启动时间的信息或者第一节点之前中没有进行过密钥更新,则第一节点可以预先配置目标帧号,若第一节点检测到当前的通信帧号与目标帧号的差值小于或等于第一阈值时,发送第一密钥更新请求。
步骤S602:第二节点解密第一密钥更新请求。
具体的,第二节点可以使用根据第二目标密钥确定的加密密钥来解密第一密钥更新请求。
步骤S603:第二节点验证第一密钥更新请求的消息完整性。
可选的,若验证不通过,第二节点可以断开与第一节点之间的通信连接,或者第二节点向第一节点发送指示更新失败的信息,或者第二节点可以丢弃该第一密钥更新请求。
可选的,图6所示实施例中,第二节点也可以不执行步骤S603。在这种情况下,第二节点在执行步骤S602以后,可以继续执行步骤S604以及步骤S604之后的步骤。
步骤S604:第二节点验证第一身份认证信息。
具体地,第一身份认证信息是第一节点根据第一节点与第二节点之间的第一共享密钥生成的,因此第二节点可以根据该第一共享密钥验证所述第一身份认证信息是否正确。
在一种可选的方案中,根据协议规定,第一节点使用什么参数生成第一身份认证信息,则第二节点也应当使用相同的参数生成用于校验的身份认证信息,如果用于校验的身份认证信息与第一身份认证信息相同,则认为验证通过。例如,第一身份认证信息是通过HMAC生成的,因此第二节点可以通过HMAC生成用于校验的身份认证信息,也称为校验值check1,然后通过用于校验的身份认证信息验证第一身份认证信息是否正确。下面进行举例说明:
例如,若第一身份认证信息AUTHm为HMAC(PSK),则第二节点根据与第一节点之间的预共享秘钥PSK通过HMAC得到校验值check1=HMAC(PSK),若校验值check1与AUTHm相同,则验证通过。
再如,若第一身份认证信息AUTHm为HMAC(PSK,KEm),则第二节点根据与第一节点之间的预共享秘钥PSK和第一密钥协商参数KEm通过HMAC得到校验值check1=HMAC(PSK,KEm),若校验值check1与AUTHm相同,则验证通过。
可选的,若第一身份信息验证不通过,第二节点可以断开与第一节点之间的通信连接,或者第二节点向第一节点发送指示更新失败的信息,或者第二节点丢弃该第一密钥更新请求。
可选的,第二节点也可以先执行步骤S604的操作再执行步骤S603的操作。
步骤S605:若第一身份认证信息验证通过,第二节点根据第一密钥协商算法参数和第二密钥协商算法参数生成第一目标密钥。
具体的,第二节点可以确定密钥协商算法的第二密钥协商算法参数KEs。第二节点根据第一密钥协商算法参数KEm和第二密钥协商算法参数KEs,生成第一目标密钥。
例如,以密钥协商算法为DH算法为例,第二节点接收来自第一节点的DH算法的参数包括素数p、随机数g和第一计算值A,而第二节点可以确定的DH算法的参数包括随机数b和计算值B,即第二密钥协商算法参数KEs,其中B满足如下等式:B=g b mod p。第二节点根据随机数b,计算值A与素数p可以确定第一目标密钥K1,其中K1满足如下等式:K1=A b mod p。
步骤S606:第二节点向第一节点发送第一响应消息。
本申请实施例中,第一响应消息可以通过根据第二目标密钥确定的加密密钥来加密和/或通过根据第二目标密钥确定的完整性密钥来进行完整性保护,第二目标密钥是第二节点与第一节点之间的共享密钥。
第一响应消息中包括第二身份认证信息和第二密钥协商算法参数KEs,其中第二身份认证信息用于验证第二节点的身份,可以是通过第一节点和第二节点之间的第一共享密钥生成的。可选的,第一响应消息中还可以包括随机数值NONCEs。
本申请实施例中,第二身份认证信息可以是通过密码算法生成的。以密码算法为HMAC为例,生成的第二身份认证信息AUTHs可以表示为:AUTHs=HMAC(PSK,KEs,NONCEs),其中,各个参数的顺序可以有所不同。当然,在第一密钥更新请求包括第二密钥协商算法参数KEs、随机数值NONCEs等参数时,第二节点生成第二身份认证信息AUTHs也可以不使用其中的部分或者全部参数。
可选的,第二节点也可以先执行步骤S606的操作再执行步骤S605的操作。
步骤S607:第一节点解密第一响应消息。
具体的,第一节点可以使用根据第二目标密钥确定的加密密钥来解密第一响应消息。
可选的,第一节点也可以先执行步骤S607的操作再执行步骤S606的操作。
步骤S608:第一节点验证第一响应消息的消息完整性。
可选的,若消息完整性验证不通过,第一节点可以断开与第二节点之间的连接,或者向第二节点发送指示更新失败的信息,或者丢弃该第一响应消息。
可选的,图6所示实施例中,第一节点也可以不执行步骤S608。在这种情况下,第一节点在执行步骤S607后,可以继续执行步骤S609以及步骤S609之后的步骤。
步骤S609:第一节点验证第二身份认证信息。
具体地,第二身份信息是第二节点根据第一节点与第二节点之间的第一共享密钥生成的,因此第一节点可以根据该第一共享密钥验证第二身份认证信息是否正确。
在一种可选的方案中,根据协议规定,第二节点使用什么参数生成第二身份认证信息, 则第一节点也应当使用相同的参数生成用于校验的身份认证信息,如果用于校验的身份认证信息与第二身份认证信息相同,则认为验证通过。
例如,第二身份认证信息可以是通过HMAC生成的,因此第一节点可以通过HMAC生成用于校验的身份认证信息,也称为校验值check2,然后通过用于校验的身份认证信息验证第二身份认证信息是否正确。下面进行举例说明:
例如,若第二身份认证信息AUTHs为HMAC(PSK),则第一节点根据与第二节点之间的预共享密钥PSK通过HMAC得到校验值check2=HMAC(PSK),若校验值check2与AUTHs相同,则验证通过。
再如,若第一身份认证信息AUTHs为HMAC(PSK,KEs),则第一节点根据与第二节点之间的预共享密钥PSK和第一响应消息中的第二密钥协商参数KEs,通过HMAC得到校验值check2=HMAC(PSK,KEs),若校验值check2与AUTHs相同,则验证通过。
可选的,若第二身份认证信息验证不通过,第一节点可以断开与第二节点之间的连接,或者向第二节点发送指示更新失败的信息,或者丢弃该第一响应消息。
可选的,第一节点也可以先执行步骤S609的操作再执行步骤S608的操作。
步骤S610:若第二身份认证信息验证通过,第一节点根据第一密钥协商算法参数和第二密钥协商算法参数生成第一目标密钥。
具体的,由于第一响应消息中包括第二密钥协商算法参数KEs,第一节点根据第一密钥协商算法参数KEm和第二密钥协商算法参数KEs生成第一目标密钥。
例如,以密钥协商算法为DH算法为例,第一节点中产生的DH算法的参数包括素数p、随机数g,随机数a和第一计算值A,第一节点接收来自第二节点的DH算法的参数包括第一计算值B,第一节点根据随机数a,计算B与素数p可以确定第一目标密钥K1,其中K1满足如下等式:K1=B a mod p。由于K1=A bmod p=(g amod p) bmod p=g abmod p=(g bmod p) amod p=B amod p,因此第一节点和第二节点确定的第一目标密钥K1是相同的。
可选的,第一目标密钥可以应用为第一节点与第二节点之间的共享密钥,也可以应用于主密钥或者会话密钥。
在图6所描述的方法中,在密钥更新过程中,第一节点和第二节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一个节点的身份,在身份认证通过后,才根据第一密钥协商参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
参见图7,图7是本申请实施例提供的又一种密钥更新方法,该方法至少包括如下步骤:
步骤S701:第一节点向第二节点发送第一密钥更新请求。
本申请实施例中,第一密钥更新请求可以通过根据第二目标密钥确定的加密密钥来加密和/或通过根据第二目标密钥确定的完整性密钥来进行完整性保护,第二目标密钥是第二节点与第一节点之间的共享密钥。
本申请实施例中,第一密钥更新请求中包括第一密钥协商参数和第一身份认证信息。 其中,该第一密钥协商参数可以为新鲜参数fresh。可选的,第一密钥请求中还可以包括随机数值NONCEm、指示第一更新时间的信息timer和指示第一目标密钥的有效期的信息expiration中的至少一项。
本申请实施例中,第一密钥更新请求中的第一身份认证信息可以是通过第一节点和第二节点之间的第一共享密钥生成的,其中第一共享密钥可以包括主密钥、预共享密钥PSK等。
可选的,生成第一身份认证信息的函数可以是密码算法。以密码算法为HMAC为例,以第一共享密钥为预共享密钥PSK为例,生成的第一身份认证信息AUTHm可以表示为:AUTHm=HMAC(PSK,fresh,NONCEm,expiration,timer),其中,各个参数的顺序可以有所不同。当然,在第一密钥更新请求包括新鲜参数fresh、随机数值NONCEm、指示第一目标密钥的有效期的信息expiration、或第一更新时间的信息timer等信息时,第一节点生成第一身份认证信息AUTHm是也可以不使用其中的部分或者全部参数。
可选的,第一节点可以通过第一通信帧向第二节点发送第一密钥更新请求,其中,所述第一通信帧的第二帧号小于上一次更新密钥时用到的密钥更新请求中携带的第三帧号,该第三帧号用于指示上一次更新的密钥的启动时间。第一密钥更新请求中携带的第一帧号大于第二帧号且小于第三帧号。例如,第三帧号为2365,表明上一次更新的密钥应用于从帧号为2365开始的通信帧后,第一节点需要在帧号重新到达2365之前确定第一目标密钥,因此第一节点可以在帧号为2345的第一通信帧中发送第一密钥更新请求,第一密钥更新请求中通过第一帧号2355来指示第一目标密钥的启动时间。由于对通信过程中的通信帧进行安全保护时,使用的加密方法可以是根据帧号和上次更新的密钥进行加密的,因此,在帧号重复到上一次更新密钥的帧号之前确定第一目标密钥,从而通过第一目标密钥来加密数据帧,这样可以使得两次相同的帧号的数据帧是通过不同的密钥进行加密的,提高了数据的安全性。
可选的,若上一次更新密钥的过程中没有携带指示密钥启动时间的信息或者第一节点之前中没有进行过密钥更新,则第一节点可以预先配置目标帧号,若第一节点检测到当前的通信帧号与目标帧号的差值小于或等于第一阈值时,发送第一密钥更新请求。
步骤S702:第二节点解密第一密钥更新请求。
具体的,第二节点可以使用根据第二目标密钥确定的加密密钥来解密第一密钥更新请求。
步骤S703:第二节点验证第一密钥更新请求的消息完整性。
可选的,若消息完整性验证不通过,第二节点可以断开与第一节点之间的通信连接,或者第二节点向第一节点发送指示更新失败的信息,或者第二节点可以丢弃该第一密钥更新请求。
可选的,图7所示实施例中,第二节点也可以不执行步骤S703。在这种情况下,第二节点在执行步骤S702以后,可以继续执行步骤S704以及步骤S704之后的步骤。
步骤S704:第二节点验证第一身份认证信息。
具体地,第一身份认证信息是第一节点根据第一节点与第二节点之间的第一共享密钥生成的,因此第二节点可以根据该第一共享密钥验证所述第一身份认证信息是否正确。
在一种可选的方案中,根据协议规定,第一节点使用什么参数生成第一身份认证信息,则第二节点也应当使用相同的参数生成用于校验的身份认证信息,如果用于校验的身份认证信息与第一身份认证信息相同,则认为验证通过。例如,第一身份认证信息是通过HMAC生成的,因此第二节点可以通过HMAC生成用于校验的身份认证信息,也称为校验值check1,然后通过用于校验的身份认证信息验证第一身份认证信息是否正确。下面进行举例说明:
例如,若第一身份认证信息AUTHm为HMAC(PSK),则第二节点根据与第一节点之间的预共享秘钥PSK通过HMAC得到校验值check1=HMAC(PSK),若校验值check1与AUTHm相同,则验证通过。
再如,在第一密钥协商参数包括新鲜参数fresh的情况下,若第一身份认证信息AUTHm为HMAC(PSK,fresh),则第二节点根据与第一节点之间的预共享秘钥PSK和新鲜参数fresh通过HMAC得到校验值check1=HMAC(PSK,fresh),若校验值check1与AUTHm相同,则验证通过。
可选的,若第一身份信息验证不通过,第二节点可以断开与第一节点之间的通信连接,或者第二节点向第一节点发送指示更新失败的信息,或者第二节点丢弃该第一密钥更新请求。
可选的,具体实施过程中,第二节点也可以先执行步骤S704的操作再执行步骤S703的操作。
步骤S705:若第一身份认证信息验证通过,第二节点根据第二目标密钥和新鲜参数生成第一目标密钥。
可选的,若第一身份信息验证不通过,第二节点可以断开与第一节点之间的通信连接,或者第二节点向第一节点发送指示更新失败的信息,或者第二节点丢弃该第一密钥更新请求。
具体的,第二节点可以根据第二目标密钥和新鲜参数通过生成第一目标密钥,例如,第二节点根据第二目标密钥K2、新鲜参数fresh,可以确定第一目标密钥K1为:K1=KDF(K2,fresh)。
步骤S706:第二节点向第一节点发送第一响应消息。
本申请实施例中,第一密钥更新请求可以通过根据第二目标密钥确定的加密密钥来加密和/或通过根据第二目标密钥确定的完整性密钥来进行完整性保护,第二目标密钥是第二节点与第一节点之间的共享密钥。
第一响应消息中包括第二身份认证信息,其中第二身份认证信息用于验证第二节点的身份,可以是通过第一节点和第二节点之间的第一共享密钥生成的。可选的,第一响应消息中还可以包括随机数值NONCEs。
本申请实施例中,生成第二身份认证信息的算法可以是密码算法。以密码算法为HMAC为例,生成的第二身份认证信息AUTHs可以表示为:AUTHs=HMAC(PSK,NONCEs),其中,各个参数的顺序可以有所不同。当然,在第一响应消息包括随机数值NONCEs等参数时,第二节点生成第二身份认证信息AUTHs也可以不使用这些参数。
可选的,具体实施过程中,第二节点也可以先执行步骤S706的操作再执行步骤S705的操作。
步骤S707:第一节点解密第一响应消息。
具体的,第一节点可以使用根据第二目标密钥确定的加密密钥来解密第一响应消息。
步骤S708:第一节点验证第一响应消息的消息完整性。
可选的,若消息完整性验证不通过,第一节点第一节点可以断开与第二节点之间的连接,或者向第二节点发送指示更新失败的信息,或者丢弃该或者丢弃该第一响应消息。
可选的,图7所示实施例中,第一节点也可以不执行步骤S708。在这种情况下,第一节点在执行步骤S707后,可以继续执行步骤S709以及步骤S709之后的步骤。
步骤S709:第一节点验证第二身份认证信息。
具体地,第二身份信息是第二节点根据第一节点与第二节点之间的第一共享密钥生成的,因此第一节点可以根据该第一共享密钥验证第二身份认证信息是否正确。
在一种可选的方案中,根据协议规定,第二节点使用什么参数生成第二身份认证信息,则第一节点也应当使用相同的参数生成用于校验的身份认证信息,如果用于校验的身份认证信息与第二身份认证信息相同,则认为验证通过。
例如,第二身份认证信息可以是通过HMAC生成的,因此第一节点可以通过HMAC生成用于校验的身份认证信息,也称为校验值check2,然后通过用于校验的身份认证信息验证第二身份认证信息是否正确。下面进行举例说明:
例如,若第二身份认证信息AUTHs为HMAC(PSK),则第一节点根据与第二节点之间的预共享密钥PSK通过HMAC得到校验值check2=HMAC(PSK),若校验值check2与AUTHs相同,则验证通过。
再如,若第一身份认证信息AUTHs为HMAC(PSK,NONCEs),则第一节点根据与第二节点之间的预共享密钥PSK和第一响应消息中的随机数值NONCEs,通过HMAC得到校验值check2=HMAC(PSK,NONCEs),若校验值check2与AUTHs相同,则验证通过。
可选的,若第二身份认证信息验证不通过,第一节点可以断开与第二节点之间的通信连接,或者向第二节点发送指示更新失败的信息,或者丢弃该第一响应消息。
可选的,具体实施过程中,第一节点也可以先执行步骤S709的操作再执行步骤S708的操作。
步骤S710:若第二身份认证信息验证通过,第一节点根据第二目标密钥和新鲜参数生成第一目标密钥。
具体的,第一节点可以点根据第二目标密钥和新鲜参数通过密钥派生函数生成第一目标密钥,例如第二节点根据第二目标密钥K2、新鲜参数fresh,可以确定第一目标密钥K1为:K1=KDF(K2,fresh)。
可选的,第一目标密钥可以应用为第一节点与第二节点之间的共享密钥,包括主密钥、者会话密钥等。
在图7所描述的方法中,在密钥更新过程中,第一节点和第二节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一个节点的身份,在身份认证通过后,才根据第二目标密钥和新鲜参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪 造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
参见图8,图8是本申请实施例提供的又一种密钥更新方法,该方法包括但不限于如下步骤:
步骤S801:第一节点向第二节点发送第一密钥更新请求。
本申请实施例中,第一密钥更新请求可以通过根据第二目标密钥确定的加密密钥来加密和/或通过根据第二目标密钥确定的完整性密钥来进行完整性保护,第二目标密钥是第二节点与第一节点之间的共享密钥。
本申请实施例中,第一密钥更新请求中包括第一密钥协商参数和新鲜参数fresh和第一身份认证信息。其中,该第一密钥协商参数可以为新鲜参数fresh。可选的,第一密钥请求中还可以包括随机数值NONCEm、指示第一更新时间的信息timer和指示第一目标密钥的有效期的信息expiration中的至少一项。
本申请实施例中,第一密钥更新请求中的第一身份认证信息可以是通过第一节点和第二节点之间的第一共享密钥生成的,其中第一共享密钥可以包括主密钥、预共享密钥PSK等。
可选的,生成第一身份认证信息算法可以是密码算法。以密码算法为HMAC为例,生成的第一身份认证信息AUTHm可以表示为:AUTHm=HMAC(PSK,fresh,NONCEm,expiration,timer),其中,各个参数的顺序可以有所不同。当然,在第一密钥更新请求包括新鲜参数fresh、随机数值NONCEm、指示第一目标密钥的有效期的信息expiration、或第一更新时间的信息timer等信息时,第一节点生成第一身份认证信息AUTHm也可以不使用其中的部分或者全部参数。
可选的,第一节点可以通过第一通信帧向第二节点发送第一密钥更新请求,其中,所述第一通信帧的第二帧号小于上一次更新密钥时用到的密钥更新请求中携带的第三帧号,该第三帧号用于指示上一次更新的密钥的启动时间。第一密钥更新请求中携带的第一帧号大于第二帧号且小于第三帧号。例如,第三帧号为2365,表明上一次更新的密钥应用于从帧号为2365开始的通信帧后,第一节点需要在帧号重新到达2365之前确定第一目标密钥,因此第一节点可以在帧号为2345的第一通信帧中发送第一密钥更新请求,第一密钥更新请求中通过第一帧号2355来指示第一目标密钥的启动时间。由于对通信过程中的通信帧进行安全保护时,使用的加密方法可以是根据帧号和上次更新的密钥进行加密的,因此,在帧号重复到上一次更新密钥的帧号之前确定第一目标密钥,从而通过第一目标密钥来加密数据帧,这样可以使得两次相同的帧号的数据帧是通过不同的密钥进行加密的,提高了数据的安全性。
可选的,若上一次更新密钥的过程中没有携带指示密钥启动时间的信息或者第一节点之前中没有进行过密钥更新,则第一节点可以预先配置目标帧号,若第一节点检测到当前的通信帧号与目标帧号的差值小于或等于第一阈值时,发送第一密钥更新请求。
步骤S802:第二节点解密第一密钥更新请求。
具体的,第二节点可以使用根据第二目标密钥确定的加密密钥来解密第一密钥更新请求。
步骤S803:第二节点验证第一密钥更新请求的消息完整性。
可选的,若消息完整性验证不通过,第二节点可以断开与第一节点之间的通信连接,或者第二节点向第一节点发送指示更新失败的信息,或者第二节点丢弃该第一密钥更新请求不做响应。
可选的,图8所示实施例中,第二节点也可以不执行步骤S803。在这种情况下,第二节点在执行步骤S802以后,可以继续执行步骤S804以及步骤S804之后的步骤。
步骤S804:第二节点验证第一身份认证信息。
可选的,若第一身份信息验证不通过,第二节点可以断开与第一节点之间的通信连接,或者第二节点向第一节点发送指示更新失败的信息,或者第二节点丢弃该第一密钥更新请求。
可选的,具体实施过程中,第二节点也可以先执行步骤S804的操作再执行步骤S803的操作。
步骤S805:若第一身份认证信息验证通过,第二节点根据第二目标密钥、新鲜参数和算法标识生成第一目标密钥。
具体的,算法标识可以用于指示生成密钥的算法。算法标识可以用于指示生成主密钥、加密密钥或者完整性保护密钥等密钥的算法的标识,如使用字符串“encryption”指示生成加密密钥,再如使用字符串“integrity”指示生成完整性保护密钥。算法标识也可以用于指示使用某种哈希算法的标识等等,例如,使用字符串“SHA256”指示确定第一目标密钥的算法为SHA256算法。算法标识可以是第一节点和第二节点间预先设置的,也可以是由第一节点确定后发送给第二节点的。
第二节点根据第二目标密钥K2、新鲜参数fresh和算法标识tag可以确定第一目标密钥K1。
例如,第二节点根据第二目标密钥K2、新鲜参数fresh和算法标识tag,通过密钥派生函数KDF确定第一目标密钥K1,即:K1=KDF(K2,fresh,tag)。
可选的,第二节点还可以根据第二目标密钥K2、新鲜参数fresh、算法标识tag以及密钥类型type,通过密钥派生函数KDF确定第一目标密钥K1,即K1=KDF(K2,fresh,tag,type)。其中type表示密钥类型,如使用字符串“encryption”指示用于生成加密密钥,再如使用字符串“integrity”指示用于生成完整性保护密钥。
可选的,第二节点可以先根据第一目标密钥K2、新鲜参数fresh确定中间密钥,再根据中间密钥通过算法标识tag、密钥类型type中的至少一项来确定第一目标密钥K1。例如,第二节点通过密钥派生函数KDF1得到中间密钥Kmid:Kmid=KDF1(K2,fresh),再根据中间密钥Kmid通过密钥派生函数KDF2确定第一目标密钥:K1=KDF2(Kmid,tag,type)。需要说明的是,这里是为了更清楚的阐述方案以两个步骤的方式解释如何得到第一目标密钥,在实际的处理中,也可以是通过一个步骤完成,中间密钥Kmid只是一个中间的结果,即确定第一目标的方式满足:K1=KDF2(KDF1(K2,fresh),tag,type)。
步骤S806:第二节点向第一节点发送第一响应消息。
本申请实施例中,第一响应消息可以通过根据第二目标密钥确定的加密密钥来加密和/或通过根据第二目标密钥确定的完整性密钥来进行完整性保护,第二目标密钥是第二节点 与第一节点之间的共享密钥。
第一响应消息中包括第二身份认证信息,其中第二身份认证信息用于认证第二节点的身份。可选的,第二身份认证信息可以是通过第一节点和第二节点之间的第一共享密钥生成的。可选的,第一响应消息中还包括随机数值NONCEs。
本申请实施例中,生成第二身份认证信息的算法可以是密码算法。以密码算法为HMAC为例,生成的第二身份认证信息AUTHs可以表示为:AUTHs=HMAC(PSK,NONCEs),其中,各个参数的顺序可以有所不同。当然,在第一响应消息包括随机数值NONCEs等参数时,第二节点生成第二身份认证信息AUTHs也可以不使用这些参数。
可选的,具体实施过程中,第二节点也可以先执行步骤S806的操作再执行步骤S805的操作。
步骤S807:第一节点解密第一响应消息。
具体的,第一节点可以使用根据第二目标密钥确定的加密密钥来解密第一响应消息。
步骤S808:第一节点验证第一响应消息的消息完整性。
具体地,第一身份认证信息是第一节点根据第一节点与第二节点之间的第一共享密钥生成的,因此第二节点可以根据该第一共享密钥验证所述第一身份认证信息是否正确。
可选的,图8所示实施例中,第一节点也可以不执行步骤S808。在这种情况下,第一节点在执行步骤S807后,可以继续执行步骤S809以及步骤S809之后的步骤。
步骤S809:第一节点验证第二身份认证信息。
具体地,第二身份信息是第二节点根据第一节点与第二节点之间的第一共享密钥生成的,因此第一节点可以根据该第一共享密钥验证第二身份认证信息是否正确。
在一种可选的方案中,根据协议规定,第一节点使用什么参数生成第一身份认证信息,则第二节点也应当使用相同的参数生成用于校验的身份认证信息,如果用于校验的身份认证信息与第一身份认证信息相同,则认为验证通过。例如,第一身份认证信息是通过HMAC生成的,因此第二节点可以通过HMAC生成用于校验的身份认证信息,也称为校验值check1,然后通过用于校验的身份认证信息验证第一身份认证信息是否正确。下面进行举例说明:
例如,若第一身份认证信息AUTHm为HMAC(PSK),则第二节点根据与第一节点之间的预共享秘钥PSK通过HMAC得到校验值check1=HMAC(PSK),若校验值check1与AUTHm相同,则验证通过。
再如,在第一密钥协商参数包括新鲜参数fresh的情况下,若第一身份认证信息AUTHm为HMAC(PSK,fresh),则第二节点根据与第一节点之间的预共享秘钥PSK和新鲜参数fresh通过HMAC得到校验值check1=HMAC(PSK,fresh),若校验值check1与AUTHm相同,则验证通过。
可选的,若消息完整性验证不通过,表明第二节点的身份不可信,因此第一节点可以断开与第二节点之间的连接,或者向第二节点发送指示更新失败的信息,或者丢弃该第一响应消息。
步骤S809:第一节点通过第一共享密钥验证第二身份认证信息。
具体地,第二身份信息是第二节点根据第一节点与第二节点之间的第一共享密钥生成的,因此第一节点可以根据该第一共享密钥验证第二身份认证信息是否正确。
在一种可选的方案中,根据协议规定,第二节点使用什么参数生成第二身份认证信息,则第一节点也应当使用相同的参数生成用于校验的身份认证信息,如果用于校验的身份认证信息与第二身份认证信息相同,则认为验证通过。
例如,第二身份认证信息可以是通过HMAC生成的,因此第一节点可以通过HMAC生成用于校验的身份认证信息,也称为校验值check2,然后通过用于校验的身份认证信息验证第二身份认证信息是否正确。下面进行举例说明:
例如,若第二身份认证信息AUTHs为HMAC(PSK),则第一节点根据与第二节点之间的预共享密钥PSK通过HMAC得到校验值check2=HMAC(PSK),若校验值check2与AUTHs相同,则验证通过。
再如,若第一身份认证信息AUTHs为HMAC(PSK,NONCEs),则第一节点根据与第二节点之间的预共享密钥PSK和第一响应消息中的随机数值NONCEs,通过HMAC得到校验值check2=HMAC(PSK,NONCEs),若校验值check2与AUTHs相同,则验证通过。
可选的,若第二身份认证信息验证不通过,第一节点可以断开与第二节点之间的连接,或者向第二节点发送指示更新失败的信息,或者丢弃该第一响应消息。
可选的,具体实施过程中,第一节点也可以先执行步骤S809的操作再执行步骤S808的操作。
步骤S810:若第二身份认证信息验证通过,第一节点根据第二目标密钥和新鲜参数生成第一目标密钥。
具体的,算法标识可以用于指示生成密钥的算法。算法标识可以用于指示生成主密钥、加密密钥或者完整性保护密钥等密钥的算法的标识,如使用字符串“encryption”指示生成加密密钥,再如使用字符串“integrity”指示生成完整性保护密钥。算法标识也可以用于指示使用某种哈希算法的标识等等,例如,使用字符串“SHA256”指示确定第一目标密钥的算法为SHA256算法。算法标识可以是第一节点和第二节点间预先设置的,也可以是由第一节点确定的。
第一节点根据第二目标密钥K2、新鲜参数fresh和算法标识tag通过KDF算法可以确定第一目标密钥K1,即:K1=KDF(K2,fresh,tag)。
可选的,第一节点可以先根据第一目标密钥K2、新鲜参数fresh确定中间密钥,再根据中间密钥通过算法标识tag、密钥类型type中的至少一项来确定第一目标密钥K1。例如,第一节点通过密钥派生函数KDF1得到中间密钥Kmid:Kmid=KDF1(K2,fresh),再根据中间密钥Kmid通过密钥派生函数KDF2确定第一目标密钥:K1=KDF2(Kmid,tag,type)。其中,KDF1和KDF2可以是相同的密钥派生函数,也可以是不同的密钥派生函数。需要说明的是,这里是为了更清楚的阐述方案以两个步骤的方式解释如何得到第一目标密钥,在实际的处理中,也可以是通过一个步骤完成,中间密钥Kmid只是一个中间的结果,即确定第一目标的方式满足:K1=KDF2(KDF1(K2,fresh),tag,type)。
可选的,第一目标密钥可以应用为第一节点与第二节点之间的共享密钥,包括主密钥、者会话密钥等。在图8所描述的方法中,在密钥更新过程中,第一节点和第二节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份 认证信息确定另一个节点的身份,在身份认证通过后,才根据第二目标密钥、新鲜参数和算法标识进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
可选的,在图6、图7或者图8所示的实施例中,第一节点发送的第一密钥更新请求中可以不携带第一身份认证信息,相应的,第二节点可以不执行验证第一身份信息的过程。同理,第一响应消息中也可以不携带第二身份认证信息,相应的,第二节点可以不执行验证第二身份认证信息的过程。在这种情况下,第一密钥更新请求通过第二目标密钥(或者第二目标密钥派生出来的会话密钥)进行加密,也可以达到认证双方身份的目的。
在一种可能的方案中,在第一节点与第二节点中包括主密钥和会话密钥,会话密钥是根据主密钥确定的密钥的情况下,当主密钥到期时,可以通过图6或图7所示的密钥更新方法更新主密钥,由于主密钥更新,使得根据主密钥确定的会话密钥也需要更新,因此第一节点与第二节点可以再使用图8所示的密钥更新方法的方法更新会话密钥。
上述详细阐述了本申请实施例的方法,下面提供了本申请实施例的装置。
请参见图9,图9是本申请实施例提供的一种装置90的结构示意图,该装置90可以为带有数据收发能力的电子设备,也可以为带有数据收发能力的电子设备中的一个器件,例如芯片或者集成电路等,该装置90可以包括发送单元901、接收单元902、验证单元903和确定单元904,其中,各个单元的描述如下:
发送单元901,用于向第二节点发送第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息,所述第一身份认证信息是通过第一共享密钥生成的;
接收单元902,用于接收来自所述第二节点的第一响应消息,其中,所述第一响应消息包括第二身份认证信息;
验证单元903,用于通过所述第一共享密钥验证所述第二身份认证信息;
确定单元904,用于若第二身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥。
在密钥更新过程中,上述装置90和第二节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一个节点的身份,在身份认证通过后,才根据密钥协商参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
这里需要说明的是,上述多个单元的划分仅是一种根据功能进行的逻辑划分,不作为对装置90具体的结构的限定。在具体实现中,其中部分功能模块可能被细分为更多细小的功能模块,部分功能模块也可能组合成一个功能模块,但无论这些功能模块是进行了细分还是组合,装置90在密钥更新的过程中所执行的大致流程是相同的。例如,上述多个单元 也可以简化为通信单元以及处理单元,所述通信单元用于实现发送单元901和接收单元902中的一个或多个的功能,所述处理单元用于实现验证单元903和确定单元904中的一个或多个的功能。通常,每个单元都对应有各自的程序代码(或者说程序指令),这些单元各自对应的程序代码在处理器上运行时,使得该单元执行相应的流程从而实现相应功能。
在一种可能的实施方式中,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
传统密钥更新过程中,更新密钥的时间是协议中预先定义好的,不能灵活选择。而本申请提供的所述装置90,可以自定义第一目标密钥的更新时间和/或第一目标密钥的有效期,并指示给第二节点,有利于按需求来决定何时启用第一目标密钥。
在又一种可能的实施方式中,所述第一密钥更新请求包括第一帧号,所述第一密钥更新请求通过所述第一帧号指示所述第一更新时间。所述第一帧号通过多个比特指示,例如F个比特。可替代的,所述第一密钥更新请求包括媒体接入控制序列号(MAC SN),所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
例如,第一密钥更新请求中携带的第一帧号为2345,该第一帧号可以指示第一目标密钥应用于从帧号2345开始的通信帧后。
在又一种可能的实施方式中,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
传统密钥更新过程中,更新密钥的时间是配置的,因此在旧密钥到期时更新新密钥,由于旧密钥已经到期,因此更新密钥时需要先终止加密过程,待密钥更新完成后再恢复加密过程,但是终止加密过程和恢复加密过程会影响密钥更新效率,且终止加密过程会影响安全性。而本申请的装置90,在更新密钥时,由于旧密钥还没有到期,不需要终止加密过程,提高了密钥更新的效率,提升了数据安全性。
在又一种可能的实施方式中,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息还包括第二密钥协商算法参数;所述确定单元904,用于根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
在又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;所述确定单元904,用于根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
其中,第二目标密钥可以是第一节点与第二节点中的一个共享密钥,包括主密钥、会话密钥和预共享密钥PSK等。另外,根据第二目标密钥和所述新鲜参数,可以通过密钥派生算法KDF生成所述第一目标密钥。例如,通过秘密值Key派生的新密钥DK可以表示为:DK=KDF(Key,fresh)。其中,fresh是新鲜参数,用于更新的参数,可以包括计数器值(counter)、序列号(number)、随机值(rand)、帧号(framenumber)等等。
在又一种可能的实施方式中,所述第一目标密钥为所述装置90的主密钥。
在又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;所述确定单元904, 用于根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标记确定加密密钥或者完整性保护密钥所使用的算法。
在又一种可能的实施方式中,所述第一目标密钥为所述装置90的完整性保护密钥或者加密密钥。
在又一种可能的实施方式中,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
可以理解,传统的密钥更新方法是在旧密钥到期时更新密钥,由于第二目标密钥已到期,因此确定新密钥的过程没有进行加密和完整性保护。而本申请实施例提供的所述装置90,可以在密钥到期之前确定第一目标密钥,因此第一密钥更新请求和第一响应消息可以使用根据第二目标密钥确定的密钥进行加密,从而提高了数据安全性。
在又一种可能的实施方式中,所述发送单元901,用于通过第一通信帧向第二节点发送第一密钥更新请求,其中,所述第一通信帧的第二帧号小于上一次更新密钥时用到的密钥更新请求中携带的第三帧号,所述第三帧号用于指示上一次更新的密钥的启动时间,所述第一帧号大于所述第二帧号且小于所述第三帧号。
由于对通信过程中的通信帧进行安全保护时,使用的加密方法可以是根据帧号和上次更新的密钥进行加密的,因此,在帧号重复到上一次更新密钥的帧号之前确定第一目标密钥,从而通过第一目标密钥来加密数据帧,这样可以使得两次相同的帧号的数据帧是通过不同的密钥进行加密的,提高了数据的安全性。在可替代的方案中,所述第一密钥更新请求包括MAC序列号(MAC SN),并非所述第一帧号,所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。那么可替代的,上一次更新密钥时用到的密钥更新请求中携带的第三帧号也可以替代为MAC SN,即用于指示所述第三帧号的多个比特中的部分比特所指示的MAC SN。在该可替代的方案中,第一、第二以及第三帧号之间的大小关系不变。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
在又一种可能的实施方式中,所述通信帧包括信令面上行帧、信令面下行帧、用户面上行帧或者用户面下行帧中的至少一项。
在又一种可能的实施方式中,若第二身份信息验证不通过,则所述发送单元901和接收单元902断开与第二节点之间的通信连接或通过发送单元901向第二节点发送更新失败的信息。
可以看出,若第二身份认证信息验证不通过,表明第二节点的身份不可信,因此上述装置90可以断开与第二节点之间的通信连接或向第二节点发送更新失败的信息,便于重新向需要进行密钥更新的节点发起接入请求,从而保证了密钥更新过程中的数据安全性。
在又一种可能的实施方式中,所述验证单元903还用于对所述第一响应消息进行完整性验证;若完整性验证通过则继续执行所述通过所述第一共享密钥验证所述第二身份认证信息这一步骤;
若完整性验证不通过,则发送单元901和接收单元902断开与第二节点之间的通信连接或向第二节点发送更新失败的信息或者通过发送单元901向第二节点发送更新失败的信息。
所述装置90可以在验证身份信息之前,先对第一响应消息进行完整性验证,确定第一响应消息中的信息没有被篡改。若完整性验证不通过,表明第一响应信息中的数据已经被篡改,不能继续更新密钥,因此所述装置90断开与第二节点之间的通信连接或向第二节点发送更新失败的信息,便于所述装置90重新接入需要进行密钥更新的节点,也保证了密钥更新过程中的数据安全性。
需要说明的是,各个单元的实现还可以对应参照图5、图6、图7或图8所示的任意一个实施例的相应描述。该装置90为图5、图6、图7或图8所示的任意一个实施例中的第一节点。
请参见图10,图10是本申请实施例提供的一种装置100的结构示意图,该装置100可以为带有数据收发能力的电子设备,也可以为带有数据收发能力的电子设备中的一个器件,例如芯片或者集成电路等,该装置100可以包括接收单元1001、验证单元1002、确定单元1003和发送单元1004,其中,各个单元的描述如下:
接收单元1001,用于接收来自第一节点的第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息;
验证单元1002,用于通过第一共享密钥验证所述第一身份认证信息;
确定单元1003,用于若第一身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥;
发送单元1004,用于向所述第一节点发送第一响应消息,其中,所述第一响应消息包括第二身份认证信息,所述第二身份认证信息是通过所述第一共享密钥生成的。
在原有的会话密钥到期之前,上述装置100和第一节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一个节点的身份,在身份认证通过后,才根据密钥协商参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
这里需要说明的是,上述多个单元的划分仅是一种根据功能进行的逻辑划分,不作为对装置100具体的结构的限定。在具体实现中,其中部分功能模块可能被细分为更多细小的功能模块,部分功能模块也可能组合成一个功能模块,但无论这些功能模块是进行了细分还是组合,装置100在密钥更新的过程中所执行的大致流程是相同的。例如,上述多个单元也可以简化为通信单元以及处理单元,所述通信单元用于实现接收单元1001和发送单元1004的功能,所述处理单元用于实现验证单元1002和确定单元1003中的一个或多个的功能。通常,每个单元都对应有各自的程序代码(或者说程序指令),这些单元各自对应的程序代码在处理器上运行时,使得该单元执行相应的流程从而实现相应功能。
在一种可能的实施方式中,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
传统密钥更新过程中,更新密钥的时间是协议中预先定义好的,不能灵活选择。而本申请的密钥更新方法中,第一节点可以自定义第一目标密钥的更新时间和/或第一目标密钥的有效期,并指示给所述装置100,有利于按需求来决定何时启用第一目标密钥。
在又一种可能的实施方式中,所述第一密钥更新请求包括第一帧号,所述第一密钥更新请求通过所述第一帧号指示所述第一更新时间。所述第一帧号通过多个比特指示,例如F个比特。可替代的,所述第一密钥更新请求包括媒体接入控制序列号(MAC SN),所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
例如,第一密钥更新请求中携带的第一帧号为2345,该第一帧号可以指示第一目标密钥应用于从帧号2345开始的通信帧后。
在又一种可能的实施方式中,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
在又一种可能的实施方式中,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息包括第二密钥协商算法参数;所述确定单元1003,用于根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
在又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;所述确定单元1003,用于根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
其中,第二目标密钥可以是第一节点与第二节点中的一个共享密钥,包括主密钥、会话密钥和预共享密钥PSK等。另外,根据第二目标密钥和所述新鲜参数,可以通过密钥派生算法KDF生成所述第一目标密钥。例如,通过秘密值Key派生的新密钥DK可以表示为:DK=KDF(Key,fresh)。其中,fresh是新鲜参数,用于更新的参数,可以包括计数器值(counter)、序列号(number)、随机值(rand)、帧号(framenumber)等等。
在又一种可能的实施方式中,所述第一目标密钥为所述装置100的主密钥。
在又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;所述确定单元1003,用于根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标识确定所述加密密钥或者所述完整性保护密钥所使用的算法。
在又一种可能的实施方式中,所述第一目标密钥为所述装置100的完整性保护密钥或者加密密钥。
在又一种可能的实施方式中,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
可以理解,传统的密钥更新方法是在旧密钥到期时更新密钥,由于第二目标密钥已到期,因此确定新密钥的过程没有进行加密和完整性保护。而本申请实施例中,装置100可以在密钥到期之前确定第一目标密钥,因此第一密钥更新请求和第一响应消息可以使用根据第二目标密钥确定的密钥进行加密,从而提高了数据安全性。
在又一种可能的实施方式中,所述发送单元1004,还用于若第一身份信息验证不通过,则所述装置100断开与所述第一节点的通信连接或向第一节点发送指示更新失败的信息。
可以看出,若第一身份认证信息验证不通过,表明第二节点的身份不可信,因此所述装置100可以断开与第一节点的连接或向第一节点发送更新指示更新失败的信息,从而停止此次密钥过程,以保证密钥更新过程中装置100的数据安全性。
在又一种可能的实施方式中,所述验证单元1002,还用于对所述第一响应消息进行完整性验证;若完整性验证通过则继续执行所述通过所述第一共享密钥验证所述第二身份认证信息这一步骤;
所述发送单元1004,还用于若完整性验证不通过,则所述装置100断开与所述第一节点的通信连接或向第一节点发送指示更新失败的信息。
在验证身份信息之前,上述装置100先对第一密钥更新请求进行完整性验证,确定第一密钥更新请求中的信息没有被篡改。若完整性验证不通过,表明第一密钥更新请求中的数据已经被篡改,不能继续更新密钥,因此上述装置100可以断开与第一节点的连接或者向第一节点发送更新指示更新失败的信息,保证了密钥更新过程中的数据安全性。
需要说明的是,各个单元的实现还可以对应参照图5、图6、图7或图8所示的任意一个实施例的相应描述。该装置100为图5、图6、图7或图8所示的任意一个实施例中的第二节点。
请参见图11,图11是本申请实施例提供的一种装置110的结构示意图,该装置110可以为带有数据收发能力的电子设备,也可以为带有数据收发能力的电子设备中的一个器件,例如芯片或者集成电路等。该装置110可以包括存储器1101、处理器1102和通信接口1103。进一步可选的,还可以包含总线1104,其中,存储器1101、处理器1102和通信接口1103通过总线1104相连。
其中,存储器1101用于提供存储空间,存储空间中可以存储操作系统和计算机程序等数据。存储器1101包括但不限于是随机存储记忆体(random access memory,RAM)、只读存储器(read-only memory,ROM)、可擦除可编程只读存储器(erasable programmable read only memory,EPROM)、或便携式只读存储器(compact disc read-only memory,CD-ROM)。
处理器1102是进行算术运算和逻辑运算的模块,可以是中央处理器(central processing unit,CPU)、显卡处理器(graphics processing unit,GPU)或微处理器(microprocessor unit,MPU)等处理模块中的一种或者多种的组合。
通信接口1103用于接收外部发送的数据和/或向外部发送数据,可以为包括诸如以太网电缆等的有线链路接口,也可以是无线链路(WIFI、蓝牙等)接口。可选的,通信接口还可以包括与接口耦合的发射器(如射频发射器等),或者接收器等。
该装置110中的处理器1102用于读取所述存储器1101中存储的计算机程序代码,执行以下操作:
通过通信接口1103向第二节点发送第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息,所述第一身份认证信息是通过第一共享密钥生成的;
通过通信接口1104接收来自所述第二节点的第一响应消息,其中,所述第一响应消息包括第二身份认证信息;
通过所述第一共享密钥验证所述第二身份认证信息;
若第二身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥。
在密钥更新过程中,上述装置110和第二节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一个节点的身份,在身份认证通过后,才根据密钥协商参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
在一种可能的实施方式中,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
传统密钥更新过程中,更新密钥的时间是协议中预先定义好的,不能灵活选择。而本申请所提供的所述装置110,可以自定义第一目标密钥的更新时间和/或第一目标密钥的有效期,并指示给第二节点,有利于按需求来决定何时启用第一目标密钥。
在又一种可能的实施方式中,所述第一密钥更新请求包括第一帧号,所述第一密钥更新请求通过所述第一帧号指示所述第一更新时间。所述第一帧号通过多个比特指示,例如F个比特。可替代的,所述第一密钥更新请求包括媒体接入控制序列号(MAC SN),所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
例如,第一密钥更新请求中携带的第一帧号为2345,该第一帧号可以指示第一目标密钥应用于从帧号2345开始的通信帧后。
在又一种可能的实施方式中,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
传统密钥更新过程中,更新密钥的时间是配置的,因此在旧密钥到期时更新新密钥,由于旧密钥已经到期,因此更新密钥时需要先终止加密过程,待密钥更新完成后再恢复加密过程,但是终止加密过程和恢复加密过程会影响密钥更新效率,且终止加密过程会影响安全性。而本申请的提供的装置110,在更新密钥时,由于旧密钥还没有到期,不需要终止加密过程,提高了密钥更新的效率,提升了数据安全性。
在又一种可能的实施方式中,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息还包括第二密钥协商算法参数;在根据所述第一密钥协商参数,确定第一目标密钥方面,所述处理器1102具体用于:根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
在又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;在根据所述第一密钥协商参数,确定第一目标密钥方面,所述处理器1102具体用于:
根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
其中,第二目标密钥可以是第一节点与第二节点中的一个共享密钥,包括主密钥、会话密钥和预共享密钥PSK等。另外,根据第二目标密钥和所述新鲜参数,可以通过密钥派生算法生成所述第一目标密钥。例如,通过秘密值Key派生的新密钥DK可以表示为:DK=KDF(Key,fresh)。其中,fresh是新鲜参数,用于更新的参数,可以包括计数器值(counter)、序列号(number)、随机值(rand)、帧号(framenumber)等等。
在又一种可能的实施方式中,所述第一目标密钥为所述装置110的主密钥。
在又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;在用于根据所述第一密钥协商参数,确定第一目标密钥方面,所述处理器1102具体用于:
根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标记确定加密密钥或者完整性保护密钥所使用的算法。
在又一种可能的实施方式中,所述第一目标密钥为所述装置110的完整性保护密钥或者加密密钥。
在又一种可能的实施方式中,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
可以理解,传统的密钥更新方法是在旧密钥到期时更新密钥,由于第二目标密钥已到期,因此确定新密钥的过程没有进行加密和完整性保护。而本申请实施例中,装置110可以在密钥到期之前确定第一目标密钥,因此第一密钥更新请求和第一响应消息可以使用根据第二目标密钥确定的密钥进行加密,从而提高了数据安全性。
在又一种可能的实施方式中,通过所述通信接口1103通过第一通信帧向第二节点发送第一密钥更新请求,其中,所述第一通信帧的第二帧号小于上一次更新密钥时用到的密钥更新请求中携带的第三帧号,所述第三帧号用于指示上一次更新的密钥的启动时间,所述第一帧号大于所述第二帧号且小于所述第三帧号。
由于对通信过程中的通信帧进行安全保护时,使用的加密方法可以是根据帧号和上次更新的密钥进行加密的,因此,在帧号重复到上一次更新密钥的帧号之前确定第一目标密钥,从而通过第一目标密钥来加密数据帧,这样可以使得两次相同的帧号的数据帧是通过不同的密钥进行加密的,提高了数据的安全性。
在可替代的方案中,所述第一密钥更新请求包括MAC序列号(MAC SN),并非所述第一帧号,所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。那么可替代的,上一次更新密钥时用到的密钥更新请求中携带的第三帧号也可以替代为MAC SN,即用于指示所述第三帧号的多个比特中的部分比特所指示的MAC SN。在该可替代的方案中,第一、第二以及第三帧号之间的大小关系不变。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
在又一种可能的实施方式中,所述通信帧包括信令面上行帧、信令面下行帧、用户面上行帧或者用户面下行帧中的至少一项。
在又一种可能的实施方式中,所述处理器1102,还用于若第二身份信息验证不通过,则指示通信接口1103断开与第二节点之间的通信连接或者通过所述通信接口1103向第二节点发送更新失败的信息。
可以看出,若第二身份认证信息验证不通过,表明第二节点的身份不可信,因此上述装置110可以断开与第二节点之间的通信连接或向第二节点发送更新失败的信息,便于重新向需要进行密钥更新的节点发起接入请求,从而保证了密钥更新过程中的数据安全性。
在又一种可能的实施方式中,在接收来自第二节点的第一响应消息之后,所述处理器1102还用于:对所述第一响应消息进行完整性验证;若完整性验证通过则继续执行所述通过所述第一共享密钥验证所述第二身份认证信息这一步骤;
所述处理器1102还用于若完整性验证不通过,则指示通信接口1103断开与第二节点之间的通信连接或者通过所述通信接口1103向第二节点发送更新失败的信息。
可以看出,完整性验证可以确定信息是否被篡改过,因此在验证身份信息之前,上述装置110先对第一响应消息进行完整性验证,确定第一响应消息中的信息没有被篡改。若完整性验证不通过,表明第一响应信息中的数据已经被篡改,不能继续更新密钥,因此所述装置110断开与第二节点之间的通信连接或向第二节点发送更新失败的信息,便于所述装置110重新接入需要进行密钥更新的节点,也保证了密钥更新过程中的数据安全性。
需要说明的是,各个单元的实现还可以对应参照图5、图6、图7或图8所示的任意一个实施例的相应描述。该节点10为图5、图6、图7或图8所示的任意一个实施例中的第一节点。
请参见图12,图12是本申请实施例提供的一种装置120的结构示意图,该装置120可以为带有数据收发能力的电子设备,也可以为带有数据收发能力的电子设备中的一个器件,例如芯片或者集成电路等。该装置120可以包括存储器1201、处理器1202和通信接口1203。进一步可选的,还可以包含总线1204,其中,存储器1201、处理器1202和通信接口1203通过总线1204相连。
其中,存储器1201用于提供存储空间,存储空间中可以存储操作系统和计算机程序等数据。存储器1201包括但不限于是随机存储记忆体(random access memory,RAM)、只读存储器(read-only memory,ROM)、可擦除可编程只读存储器(erasable programmable read only memory,EPROM)、或便携式只读存储器(compact disc read-only memory,CD-ROM)。
处理器1202是进行算术运算和逻辑运算的模块,可以是中央处理器(central processing unit,CPU)、显卡处理器(graphics processing unit,GPU)或微处理器(microprocessor unit,MPU)等处理模块中的一种或者多种的组合。
通信接口1203用于接收外部发送的数据和/或向外部发送数据,可以为包括诸如以太网电缆等的有线链路接口,也可以是无线链路(WIFI、蓝牙等)接口。可选的,通信接口还可以包括与接口耦合的发射器(如射频发射器等),或者接收器等。
该设备120中的处理器1202用于读取所述存储器1201中存储的计算机程序代码,执行以下操作:
通过所述通信接口1203向第二节点发送第一密钥更新请求,其中,所述第一密钥更新 请求包括第一密钥协商参数和第一身份认证信息,所述第一身份认证信息是通过第一共享密钥生成的;
通过所述通信接口1203接收来自所述第二节点的第一响应消息,其中,所述第一响应消息包括第二身份认证信息;
通过所述第一共享密钥验证所述第二身份认证信息;
若第二身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥。
在原有的会话密钥到期之前,上述装置120和第一节点根据第一共享密钥生成身份认证信息,其中一个节点在接收来自另一个节点的消息后先通过身份认证信息确定另一个节点的身份,在身份认证通过后,才根据密钥协商参数进行密钥更新,得到第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了密钥更新过程中的数据安全性。
在一种可能的实施方式中,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
传统密钥更新过程中,更新密钥的时间是协议中预先定义好的,不能灵活选择。而本申请中,第一节点可以自定义第一目标密钥的更新时间和/或第一目标密钥的有效期,并指示给所述装置120,有利于按需求来决定何时启用第一目标密钥。
在又一种可能的实施方式中,所述第一密钥更新请求中包括第一帧号,所述第一密钥更新请求通过所述第一帧号指示所述第一更新时间。所述第一帧号通过多个比特指示,例如F个比特。可替代的,所述第一密钥更新请求包括媒体接入控制序列号(MAC SN),所述MAC SN通过M个比特指示,所述M个比特为所述F个比特中的部分比特,M小于F。具体的,用于指示所述第一帧号的多个比特包含两个部分:高位部分和低位部分,其中所述低位部分为用于指示所述MAC SN的M个比特。所述高位部分通过N个比特指示。可选的,所述N个比特为用于指示超帧号的多个比特。通过该可替代的方式,可以在密钥更新请求中携带尽可能少的信息,减少信令消耗,提供通信效率。
例如,第一密钥更新请求中携带的第一帧号为2345,该第一帧号可以指示第一目标密钥应用于从帧号2345开始的通信帧后。
在又一种可能的实施方式中,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
传统密钥更新过程中,更新密钥的时间是配置的,因此在旧密钥到期时更新新密钥,由于旧密钥已经到期,因此更新密钥时需要先终止加密过程,待密钥更新完成后再恢复加密过程,但是终止加密过程和恢复加密过程会影响密钥更新效率,且终止加密过程会影响安全性。而本申请所提供的装置120,在更新密钥时,由于旧密钥还没有到期,不需要终止加密过程,提高了密钥更新的效率,提升了数据安全性。
在又一种可能的实施方式中,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息还包括第二密钥协商算法参数;在根据所述第一密钥协商参数,确定第一目标密钥方面,所述处理器1202具体用于:
根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
在又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;在根据所述第一密钥协商参数,确定第一目标密钥方面,所述处理器1202具体用于:
根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
其中,第二目标密钥可以是第一节点与第二节点中的一个共享密钥,包括主密钥、会话密钥和预共享密钥PSK等。另外,根据第二目标密钥和所述新鲜参数,可以通过密钥派生算法KDF生成所述第一目标密钥。例如,通过秘密值Key派生的新密钥DK可以表示为:DK=KDF(Key,fresh)。其中,fresh是新鲜参数,用于更新的参数,可以包括计数器值(counter)、序列号(number)、随机值(rand)、帧号(framenumber)等等。
在又一种可能的实施方式中,所述第一目标密钥为所述装置120的主密钥。
在又一种可能的实施方式中,所述第一密钥协商参数包括新鲜参数;在用于根据所述第一密钥协商参数,确定第一目标密钥方面,所述处理器1202具体用于:
根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标记确定加密密钥或者完整性保护密钥所使用的算法。
在又一种可能的实施方式中,所述第一目标密钥为所述装置120的完整性保护密钥或者加密密钥。
在又一种可能的实施方式中,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
可以理解,传统的密钥更新方法是在旧密钥到期时更新密钥,由于第二目标密钥已到期,因此确定新密钥的过程没有进行加密和完整性保护。而本申请实施例中,可以在密钥到期之前确定第一目标密钥,因此第一密钥更新请求和第一响应消息可以使用根据第二目标密钥确定的密钥进行加密,从而提高了数据安全性。
在又一种可能的实施方式中,所述处理器1202,还用于若第一身份信息验证不通过,则指示通信接口1203断开与第一节点的通信连接或者通过通信接口1203向第一节点发送指示更新失败的信息。
可以看出,若第一身份认证信息验证不通过,所述装置120可以断开与第一节点的连接或向第一节点发送更新指示更新失败的信息,从而停止此次密钥过程,以保证密钥更新过程中节点的数据安全性。
在又一种可能的实施方式中,在接收来自第一节点的第一密钥更新请求之后,所述处理器1202还用于:对所述第一密钥更新请求进行完整性验证;若完整性验证通过则继续执行所述通过所述第一共享密钥验证所述第一身份认证信息这一步骤;
所述处理器1202,还用于若完整性验证不通过,则指示通信接口1203断开与第一节点的连接或者通过通信接口1203向第一节点发送指示更新失败的信息。
在验证身份信息之前,上述装置120先对第一密钥更新请求进行完整性验证,确定第一密钥更新请求中的信息没有被篡改。若完整性验证不通过,表明第一密钥更新请求中的数据已经被篡改,不能继续更新密钥,因此上述装置120可以断开与第一节点的连接或者向第一节点发送更新指示更新失败的信息,保证了密钥更新过程中的数据安全性。
需要说明的是,各个单元的实现还可以对应参照图5、图6、图7或图8所示的任意一 个实施例的相应描述。该装置120为图5、图6、图7或图8所示的任意一个实施例中的第一节点。
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,当所述计算机程序在一个或多个处理器上运行时,执行图5、图6、图7或图8所示任意一种实施例所述的方法。
本申请实施例还提供了一种芯片系统,所述芯片系统包括至少一个处理器,存储器和接口电路,所示接口电路用于为所述至少一个处理器提供信息输入/输出,所述至少一个存储器中存储有计算机程序,当所述计算机程序在一个或多个处理器上运行时,执行图5、图6、图7或图8所示任意一种实施例所述的密钥更新方法。
本申请实施例还提供一种智能座舱产品,所述智能座舱产品包括第一节点(例如,汽车座舱域控制器CDC),所述第一节点为图5、图6、图7或图8所示任意一种实施例中的第一节点。进一步的,所述车辆还包括第二节点(例如,摄像头、屏幕、麦克风、音响、雷达、电子钥匙、无钥匙进入及启动系统控制器等模块中的至少一个),所述第二节点为图5、图6、图7或图8所示任意一种实施例中的第二节点。
本申请实施例还提供一种车辆,所述车辆包括第一节点(例如,汽车座舱域控制器CDC)。进一步的,所述车辆还包括第二节点(例如,摄像头、屏幕、麦克风、音响、雷达、电子钥匙、无钥匙进入或启动系统控制器等模块中的至少一个),其中所述第一节点为图5、图6、图7或图8所示任意一种实施例中的第一节点,所述第二节点为图5、图6、图7或图8所示任意一种实施例中的第二节点。本申请实施例还提供一种计算机程序产品,当所述计算机程序产品在一个或多个处理器上运行时,可以执行如图5、图6、图7或图8所示任意一种实施例所述的密钥更新方法。
综上所述,本申请实施例提供的密钥更新方法,在密钥更新前,通信双方的节点需要根据第一共享密钥生成身份认证信息,节点在接收来自另一节点消息后先通过身份认证信息确定通信另一节点的身份,在身份认证通过后,再根据密钥协商参数确定第一目标密钥,在这种情况下,即便窃听者已经攻破了原有的会话密钥,仍然无法伪造身份信息,从而避免了中间人攻击,提高了数据更新过程中的数据安全性。
需要说明的是,对于前述的各个方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某一些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。
本申请实施例方法中的步骤可以根据实际需要进行顺序调整、合并和删减。
本申请实施例装置中的模块可以根据实际需要进行合并、划分和删减。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过 程序来指令相关的硬件来完成,该程序可以存储于计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random Access Memory,RAM)、磁盘或光盘等。
以上所揭露的仅为本申请较佳实施例,本领域普通技术人员可以理解实现上述实施例的全部或部分流程,并依本申请权利要求所作的等同变化,仍属于发明所涵盖的范围。

Claims (39)

  1. 一种密钥更新方法,其特征在于,包括:
    向第二节点发送第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息,所述第一身份认证信息是通过第一共享密钥生成的;
    接收来自所述第二节点的第一响应消息,其中,所述第一响应消息包括第二身份认证信息;
    通过所述第一共享密钥验证所述第二身份认证信息;
    若第二身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥。
  2. 根据权利要求1所述的方法,其特征在于,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
  3. 根据权利要求2所述的方法,其特征在于,所述第一密钥更新请求包括第一帧号或者第一媒体接入控制MAC序列号,所述第一密钥更新请求用于通过所述第一帧号或者所述第一MAC序列号指示所述第一更新时间。
  4. 根据权利要求2所述的方法,其特征在于,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息还包括第二密钥协商算法参数;所述根据所述第一密钥协商参数,确定第一目标密钥,包括:
    根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
  6. 根据权利要求1-4任一项所述的方法,其特征在于,所述第一密钥协商参数包括新鲜参数;所述根据所述第一密钥协商参数,确定第一目标密钥,包括:
    根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
  7. 根据权利要求1-4任一项所述的方法,其特征在于,所述第一密钥协商参数包括新鲜参数;所述根据所述第一密钥协商参数,确定第一目标密钥,包括:
    根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标记确定加密密钥或者完整性保护密钥所使用的算法。
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性 保护密钥进行完整性保护。
  9. 根据权利要求1-8任一项所述的方法,其特征在于,所述第一密钥更新请求中包括所述第一帧号,所述第一帧号用于指示所述第一目标密钥的更新时间;所述向第二节点发送第一密钥更新请求,包括:
    通过第一通信帧向第二节点发送第一密钥更新请求,其中,所述第一通信帧的第二帧号小于上一次更新密钥时用到的密钥更新请求中携带的第三帧号,所述第三帧号用于指示上一次更新的密钥的启动时间,所述第一帧号大于所述第二帧号且小于所述第三帧号。
  10. 根据权利要求9所述的方法,其特征在于,所述通信帧包括信令面上行帧、信令面下行帧、用户面上行帧或者用户面下行帧中的至少一项。
  11. 一种密钥更新方法,其特征在于,所述方法包括:
    接收来自第一节点的第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息;
    通过第一共享密钥验证所述第一身份认证信息;
    若第一身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥;
    向所述第一节点发送第一响应消息,其中,所述第一响应消息包括第二身份认证信息,所述第二身份认证信息是通过所述第一共享密钥生成的。
  12. 根据权利要求11所述的方法,其特征在于,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
  13. 根据权利要求12所述的方法,其特征在于,所述第一密钥更新请求包括第一帧号或者第一媒体接入控制MAC序列号,所述第一密钥更新请求用于通过所述第一帧号或者所述第一MAC序列号指示所述第一更新时间。
  14. 根据权利要求12所述的方法,其特征在于,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
  15. 根据权利要求11-14任一项所述的方法,其特征在于,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息包括第二密钥协商算法参数;所述根据所述第一密钥协商参数,确定第一目标密钥,包括:
    根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
  16. 根据权利要求11-14任一项所述的方法,其特征在于,所述第一密钥协商参数包括新鲜参数;所述根据所述第一密钥协商参数,确定第一目标密钥,包括:
    根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
  17. 根据权利要求11-14任一项所述的方法,其特征在于,所述第一密钥协商参数包括新鲜参数;所述根据所述第一密钥协商参数,确定第一目标密钥,包括:
    根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标识确定所述加密密钥或者所述完整性保护密钥所使用的算法。
  18. 根据权利要求11-17任一项所述的方法,其特征在于,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
  19. 一种装置,其特征在于,包括:
    发送单元,用于向第二节点发送第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息,所述第一身份认证信息是通过第一共享密钥生成的;
    接收单元,用于接收来自所述第二节点的第一响应消息,其中,所述第一响应消息包括第二身份认证信息;
    验证单元,用于通过所述第一共享密钥验证所述第二身份认证信息;
    确定单元,用于若第二身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥。
  20. 根据权利要求19所述的装置,其特征在于,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
  21. 根据权利要求19所述的装置,其特征在于,所述第一密钥更新请求包括第一帧号或者第一媒体接入控制MAC序列号,所述第一密钥更新请求用于通过所述第一帧号或者所述第一MAC序列号指示所述第一更新时间。
  22. 根据权利要求20所述的装置,其特征在于,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
  23. 根据权利要求19-22任一项所述的装置,其特征在于,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息还包括第二密钥协商算法参数;所述确定单元,用于根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
  24. 根据权利要求19-22任一项所述的装置,其特征在于,所述第一密钥协商参数包 括新鲜参数;所述确定单元,用于根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
  25. 根据权利要求19-22任一项所述的装置,其特征在于,所述第一密钥协商参数包括新鲜参数;所述确定单元,用于根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标记确定加密密钥或者完整性保护密钥所使用的算法。
  26. 根据权利要求19-25任一项所述的装置,其特征在于,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
  27. 根据权利要求19-26任一项所述的装置,其特征在于,所述第一密钥更新请求中包括所述第一帧号,所述第一帧号用于指示所述第一目标密钥的更新时间;所述发送单元,用于通过第一通信帧向第二节点发送第一密钥更新请求,其中,所述第一通信帧的第二帧号小于上一次更新密钥时用到的密钥更新请求中携带的第三帧号,所述第三帧号用于指示上一次更新的密钥的启动时间,所述第一帧号大于所述第二帧号且小于所述第三帧号。
  28. 根据权利要求27所述的装置,其特征在于,所述通信帧包括信令面上行帧、信令面下行帧、用户面上行帧或者用户面下行帧中的至少一项。
  29. 一种装置,其特征在于,包括:
    接收单元,用于接收来自第一节点的第一密钥更新请求,其中,所述第一密钥更新请求包括第一密钥协商参数和第一身份认证信息;
    验证单元,用于通过第一共享密钥验证所述第一身份认证信息;
    确定单元,用于若第一身份认证信息验证通过,根据所述第一密钥协商参数,确定第一目标密钥;
    发送单元,用于向所述第一节点发送第一响应消息,其中,所述第一响应消息包括第二身份认证信息,所述第二身份认证信息是通过所述第一共享密钥生成的。
  30. 根据权利要求29所述的装置,其特征在于,所述第一密钥更新请求用于指示第一更新时间和第一目标密钥的有效期中的至少一项。
  31. 根据权利要求30所述的装置,其特征在于,所述第一密钥更新请求包括第一帧号或者第一媒体接入控制MAC序列号,所述第一密钥更新请求用于通过所述第一帧号或者所述第一MAC序列号指示所述第一更新时间。
  32. 根据权利要求30所述的装置,其特征在于,所述第一目标密钥应用于从所述第一更新时间开始的所述第一目标密钥的有效期内。
  33. 根据权利要求30-32任一项所述的装置,其特征在于,所述第一密钥协商参数包括第一密钥协商算法参数,所述第一响应消息包括第二密钥协商算法参数;所述确定单元,用于根据所述第一密钥协商算法参数和所述第二密钥协商算法参数,生成所述第一目标密钥。
  34. 根据权利要求30-32任一项所述的装置,其特征在于,所述第一密钥协商参数包括新鲜参数;所述确定单元,用于根据第二目标密钥和所述新鲜参数,生成所述第一目标密钥。
  35. 根据权利要求30-32任一项所述的装置,其特征在于,所述第一密钥协商参数包括新鲜参数;所述确定单元,用于根据第二目标密钥、所述新鲜参数和算法标识,生成所述第一目标密钥,所述算法标识用于标识确定所述加密密钥或者所述完整性保护密钥所使用的算法。
  36. 根据权利要求30-32任一项所述的装置,其特征在于,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据第二目标密钥确定的加密密钥加密,和/或,所述第一密钥更新请求和所述第一响应消息中的至少一个通过根据所述第二目标密钥确定的完整性保护密钥进行完整性保护。
  37. 一种装置,其特征在于,所述装置包括至少一个处理器和通信接口,所述至少一个处理器用于调用至少一个存储器中存储的计算机程序,以使得所述装置实现如权利要求1-10中任一项所述的方法。
  38. 一种装置,其特征在于,所述装置包括至少一个处理器和通信接口,所述至少一个处理器用于调用至少一个存储器中存储的计算机程序,以使得所述装置实现如权利要求11-18中任一项所述的方法。
  39. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序,当所述计算机程序在一个或多个处理器上运行时,执行如权利要求1-18中任一项所述的方法。
PCT/CN2020/077353 2020-02-29 2020-02-29 一种密钥更新方法及相关装置 WO2021168860A1 (zh)

Priority Applications (7)

Application Number Priority Date Filing Date Title
JP2022550128A JP7451738B2 (ja) 2020-02-29 2020-02-29 鍵更新方法および関連装置
KR1020227032169A KR20220137124A (ko) 2020-02-29 2020-02-29 키 업데이트 방법 및 관련 장치
CN202080096273.4A CN115104282B (zh) 2020-02-29 2020-02-29 一种密钥更新方法及相关装置
PCT/CN2020/077353 WO2021168860A1 (zh) 2020-02-29 2020-02-29 一种密钥更新方法及相关装置
CN202311240730.4A CN117201014A (zh) 2020-02-29 2020-02-29 一种密钥更新方法及相关装置
EP20920962.6A EP4099615A4 (en) 2020-02-29 2020-02-29 PROCEDURE FOR UPDATING A KEY AND ASSOCIATED DEVICE
US17/895,707 US20220417015A1 (en) 2020-02-29 2022-08-25 Key update method and related apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/077353 WO2021168860A1 (zh) 2020-02-29 2020-02-29 一种密钥更新方法及相关装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/895,707 Continuation US20220417015A1 (en) 2020-02-29 2022-08-25 Key update method and related apparatus

Publications (1)

Publication Number Publication Date
WO2021168860A1 true WO2021168860A1 (zh) 2021-09-02

Family

ID=77490551

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/077353 WO2021168860A1 (zh) 2020-02-29 2020-02-29 一种密钥更新方法及相关装置

Country Status (6)

Country Link
US (1) US20220417015A1 (zh)
EP (1) EP4099615A4 (zh)
JP (1) JP7451738B2 (zh)
KR (1) KR20220137124A (zh)
CN (2) CN115104282B (zh)
WO (1) WO2021168860A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023130980A1 (zh) * 2022-01-05 2023-07-13 西安西电捷通无线网络通信股份有限公司 安全通道休眠唤醒方法、装置及设备

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116155491B (zh) * 2023-02-02 2024-03-08 广州万协通信息技术有限公司 安全芯片的对称密钥同步方法及安全芯片装置
CN116761167B (zh) * 2023-08-21 2023-11-03 北京领创医谷科技发展有限责任公司 一种数据加密传输方法、系统、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101047978A (zh) * 2006-03-27 2007-10-03 华为技术有限公司 对用户设备中的密钥进行更新的方法
CN101420694A (zh) * 2008-12-16 2009-04-29 天津工业大学 一种wapi-xg1接入及快速切换认证方法
CN101425897A (zh) * 2007-10-29 2009-05-06 上海交通大学 一种用户认证方法、系统、服务器和用户节点
US20140122888A1 (en) * 2012-10-31 2014-05-01 Industry-Academia Cooperation Group Of Sejong University Method for password based authentication and apparatus executing the method

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4713745B2 (ja) 2000-01-14 2011-06-29 パナソニック株式会社 認証通信装置及び認証通信システム
JP4691244B2 (ja) 2000-11-10 2011-06-01 株式会社東芝 限定受信システムの限定受信装置及びセキュリティモジュール、限定受信システム、限定受信装置認証方法及び暗号通信方法
US7596225B2 (en) * 2005-06-30 2009-09-29 Alcatl-Lucent Usa Inc. Method for refreshing a pairwise master key
CN1832397B (zh) * 2005-11-28 2010-09-29 四川长虹电器股份有限公司 电子设备接口间基于公钥证书的认证密钥协商和更新方法
JP2009141767A (ja) 2007-12-07 2009-06-25 Kyoichi Shibuya 暗号鍵の生成システム、暗号鍵の生成方法、暗号化認証システム及び暗号化通信システム
US8560848B2 (en) * 2009-09-02 2013-10-15 Marvell World Trade Ltd. Galois/counter mode encryption in a wireless network
JP5414558B2 (ja) 2010-01-29 2014-02-12 Kddi株式会社 鍵交換システム、鍵交換方法及び鍵交換プログラム
JP6018511B2 (ja) * 2013-01-31 2016-11-02 株式会社東芝 サーバ装置、グループ鍵通知方法及びそのプログラム
CN106712932B (zh) * 2016-07-20 2019-03-19 腾讯科技(深圳)有限公司 密钥管理方法、装置及系统
JP6918582B2 (ja) 2017-06-02 2021-08-11 パナソニック株式会社 乱数性検証システム及び乱数性検証方法
CN108572642B (zh) * 2017-12-15 2022-02-18 蔚来(安徽)控股有限公司 一种自动驾驶系统及其横向控制方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101047978A (zh) * 2006-03-27 2007-10-03 华为技术有限公司 对用户设备中的密钥进行更新的方法
CN101425897A (zh) * 2007-10-29 2009-05-06 上海交通大学 一种用户认证方法、系统、服务器和用户节点
CN101420694A (zh) * 2008-12-16 2009-04-29 天津工业大学 一种wapi-xg1接入及快速切换认证方法
US20140122888A1 (en) * 2012-10-31 2014-05-01 Industry-Academia Cooperation Group Of Sejong University Method for password based authentication and apparatus executing the method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023130980A1 (zh) * 2022-01-05 2023-07-13 西安西电捷通无线网络通信股份有限公司 安全通道休眠唤醒方法、装置及设备

Also Published As

Publication number Publication date
JP2023515104A (ja) 2023-04-12
KR20220137124A (ko) 2022-10-11
CN115104282B (zh) 2023-08-22
CN117201014A (zh) 2023-12-08
US20220417015A1 (en) 2022-12-29
JP7451738B2 (ja) 2024-03-18
CN115104282A (zh) 2022-09-23
EP4099615A4 (en) 2023-02-01
EP4099615A1 (en) 2022-12-07

Similar Documents

Publication Publication Date Title
US10931445B2 (en) Method and system for session key generation with diffie-hellman procedure
CN112740733B (zh) 一种安全接入方法及装置
WO2021168860A1 (zh) 一种密钥更新方法及相关装置
US20150341178A1 (en) Certificate issuing system, client terminal, server device, certificate acquisition method, and certificate issuing method
CN112753203B (zh) 一种安全通信方法及装置
JP7237200B2 (ja) パラメータ送信方法及び装置
WO2022110083A1 (zh) 一种通信方法及装置
KR20180006664A (ko) 의료 기기, 게이트웨이 기기 및 이를 이용한 프로토콜 보안 방법
TW202142011A (zh) 一種防止加密用戶識別符被重播攻擊的方法
CN111835691B (zh) 一种认证信息处理方法、终端和网络设备
CN111836260B (zh) 一种认证信息处理方法、终端和网络设备
KR20210126319A (ko) 키 관리 장치 및 방법
TWI761243B (zh) 群組即時通訊的加密系統和加密方法
CN102739660A (zh) 一种单点登录系统的密钥交换方法
WO2018126783A1 (zh) 一种密钥传输方法及装置、计算机存储介质
EP4270866A1 (en) Identity authentication method and apparatus, device, chip, storage medium, and program
WO2020140929A1 (zh) 一种密钥生成方法、ue及网络设备
JP2024081663A (ja) 鍵更新方法および関連装置
US20230099065A1 (en) Key obtaining method and related apparatus
CN117279119B (zh) 用于设备间无线通信的方法和通信装置
Zhang Authenticated Key Exchange Protocols with Unbalanced Computational Requirements
CN115885496B (zh) 一种通信方法及相关装置
WO2022135386A1 (zh) 一种身份鉴别方法和装置
TW201808028A (zh) 一種存取認證方法、ue和存取設備
CN116347432A (zh) 网络认证方法、装置、终端及网络侧设备

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: 20920962

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022550128

Country of ref document: JP

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 2020920962

Country of ref document: EP

Effective date: 20220831

ENP Entry into the national phase

Ref document number: 20227032169

Country of ref document: KR

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE