WO2022188027A1 - 安全通信的方法和装置 - Google Patents

安全通信的方法和装置 Download PDF

Info

Publication number
WO2022188027A1
WO2022188027A1 PCT/CN2021/079720 CN2021079720W WO2022188027A1 WO 2022188027 A1 WO2022188027 A1 WO 2022188027A1 CN 2021079720 W CN2021079720 W CN 2021079720W WO 2022188027 A1 WO2022188027 A1 WO 2022188027A1
Authority
WO
WIPO (PCT)
Prior art keywords
key
terminal
update
message
identification information
Prior art date
Application number
PCT/CN2021/079720
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 CN202180000454.7A priority Critical patent/CN113170291B/zh
Priority to PCT/CN2021/079720 priority patent/WO2022188027A1/zh
Publication of WO2022188027A1 publication Critical patent/WO2022188027A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/30Services specially adapted for particular environments, situations or purposes
    • H04W4/40Services specially adapted for particular environments, situations or purposes for vehicles, e.g. vehicle-to-pedestrians [V2P]

Definitions

  • the present application relates to the field of communication, and in particular, to a method and apparatus for secure communication.
  • each terminal has its own communication key, and multiple terminals in communication need to encrypt and decrypt messages based on the same version of the communication key to achieve successful message transmission.
  • V2X vehicle-to-everything
  • a vehicle also referred to as a vehicle-to-everything terminal
  • V2X broadcast message at any time. historical track.
  • it is necessary to encrypt and protect the coordinate data in the above V2X broadcast messages.
  • it is necessary to periodically update the message encryption key.
  • the terminal there are two main ways for the terminal to obtain the communication key: one is that all terminals temporarily obtain the communication key from the cloud key management platform during the communication process to ensure that the key identifiers of both parties are consistent; the other is that the cloud The key management platform regularly issues updated communication keys to multiple terminals to ensure that the key identifiers between multiple terminals are consistent.
  • the above method requires the terminal to have networking capability at any time, and has strict requirements on the terminal networking.
  • the terminal cannot connect to the cloud key management platform (for example, the terminal is located in a mountainous area, bridge hole, etc. without network environment), the communication key cannot be updated, and the communication will not proceed normally.
  • the present application provides a method and device for secure communication, which can update the communication key when the terminal cannot connect to the cloud key management platform, ensure the matching of the communication key identifiers of both parties in communication, and effectively improve the communication efficiency .
  • a method for secure communication including: a second terminal receiving a first message from a first terminal, where the first message includes identification information of a first key; obtaining a first result, the first result Used to indicate whether the identification information of the first key matches the identification information of the second key of the second terminal; according to the first result, send a second message, the second message includes the first key update information, The first key update information is used to update the key of the first terminal or the key of the second terminal.
  • first message also includes the first encrypted message, the certificate of the first terminal (including the public key of the first terminal), the signature of the first terminal or other information, which is not limited in this application.
  • the first encrypted message is encrypted by using the first key.
  • the first encrypted message may include vehicle historical trajectory information, vehicle location coordinates, or other private information, and the like.
  • first message and second message may be transmitted in a broadcast manner, but this is not limited in this embodiment of the present application.
  • the key identifier is checked through the message interaction between the terminal and the terminal, so that the key update process between the terminal and the terminal is carried out based on the check result, and the whole process is based on the
  • the message does not depend on the connection between the terminal and the network, and can update the communication key when the terminal cannot be connected to the network side (such as the above-mentioned cloud key management platform). matching, effectively improving the communication efficiency.
  • the first key when the second value corresponding to the identification information of the second key is greater than the first value corresponding to the identification information of the first key, the first key The update information is used to update the key of the first terminal.
  • first value and the second value in this embodiment of the present application may be the identification size of the key, the size of the version number, or the sequence of time, etc.
  • first value may be 20210228
  • second value may be Can be 20210305. This application does not limit this.
  • the first key update information includes the identification information of the second key, the identification of the first terminal, and the first update key that is not less than the first update key corresponding to the second value. key and the identification information of the first update key.
  • the method before sending the second message according to the above-mentioned first result, the method further includes: the second terminal uses the public key of the first terminal's certificate to pair the above-mentioned first terminal Update the key for encryption.
  • the secure transmission of the first update key can be further ensured.
  • the above-mentioned first update key information further includes a temporary public key; before sending the second message according to the above-mentioned first result, the method further includes: a second terminal Randomly generate a temporary private key pair and the above-mentioned temporary public key; the second terminal uses the temporary private key and the public key of the certificate of the first terminal to generate a first temporary encryption key; the second terminal adopts the first temporary encryption key to the above-mentioned temporary encryption key The first update key is encrypted.
  • the above-mentioned first temporary encryption key and second temporary encryption key may be calculated by using a key agreement algorithm.
  • the decryption algorithm needs to correspond to the encryption algorithm to complete the decryption operation.
  • the encryption algorithm is public key encryption
  • the decryption algorithm is private key decryption.
  • the update key in the embodiment of the present application is encrypted by using the temporary encryption key calculated by both terminals, and has forward security. Even if an attacker intercepts the first message and cracks the private key of the certificate of the first terminal, he cannot decrypt it. The updated key is obtained, which further improves the security of the system.
  • the method further includes: the second terminal receives a third message from the first terminal, the third message The identification information of the second key is included.
  • the second message when the second value corresponding to the identification information of the second key is smaller than the first value corresponding to the identification information of the first key, the second message includes The second encrypted message and the first key update information, where the first key update information is used to update the key of the second terminal.
  • the above-mentioned first key update information includes identification information of any key stored locally in the second terminal; before sending the second message according to the first result , the method further includes: the second terminal determines whether there is a key that is the same as the first value in the locally stored key; if there is no key that is the same as the first value in the locally stored key, the second terminal Any key is selected from the locally stored keys; the second terminal encrypts the above-mentioned second encrypted message by using the selected one of the keys.
  • the second terminal if the second terminal encrypts the second message by using the key with the highest identifier stored locally, it can be avoided that the update key obtained by the second terminal is the same as the key stored locally by the second terminal. Key identification, effectively reducing resource overhead.
  • the method further includes: the second terminal receives a fourth message from the first terminal, the fourth message including second key update information, wherein the second key update information includes the identification information of the first key, the identification of the second terminal, the second update key not less than the first value corresponding to the second key, and the second key
  • the identification information of the key is updated; the second terminal updates the key of the second terminal according to the above-mentioned second key update information.
  • the above-mentioned first terminal will verify the validity of the message.
  • the verification process includes verifying the validity and validity of the certificate of the second terminal and verifying the correctness of the signature in the first message according to the public key of the second terminal.
  • the above key update manner may be to replace the key stored locally by the second terminal with the first update key.
  • the first update key may also be added on the basis of the key stored locally by the second terminal.
  • the specific update method is not limited in this application.
  • the above-mentioned second update key is encrypted by using the public key of the certificate of the second terminal or the third temporary encryption key, wherein the third temporary encryption key is generated by the first terminal using the temporary private key randomly generated by the first terminal and the public key of the certificate of the second terminal; the method further includes: the second terminal adopts the private key of the certificate of the second terminal or the fourth temporary encryption key. key to decrypt the second update key, wherein the fourth temporary encryption key is generated by the second terminal using the temporary public key randomly generated by the first terminal and the private key of the certificate of the second terminal.
  • the key identifier is checked through the message exchange between the terminal and the terminal, and once the used key identifier is found to be mismatched, the key update between the terminal and the terminal is performed.
  • the whole process is based on the message interaction between the terminal and the terminal (that is, the key update information is carried in the interactive message), does not depend on the connection between the terminal and the network, and can be used when the terminal cannot connect to the network side (for example, the above-mentioned cloud In the case of the key management platform), the update of the communication key is realized, which ensures the matching of the communication key identifiers of both parties in the communication, and effectively improves the communication efficiency.
  • another method for secure communication including: a first terminal sending a first message, the first message including a version of a first key; the first terminal receiving a second message from the second terminal, The second message is determined according to a first result, where the first result is used to indicate whether the identification information of the first key matches the identification information of the second key of the second terminal, and the second message includes the first Key update information, where the first key update information is used to update the key of the first terminal or the key of the second terminal.
  • the first key when the second value corresponding to the identification information of the second key is greater than the first value corresponding to the identification information of the first key, the first key The update information is used to update the key of the first terminal.
  • the above-mentioned first key update information includes the identification information of the second key, the identification of the first terminal, and the first update corresponding to not less than the above-mentioned second value. key and identification information of the first update key.
  • the above-mentioned first update key is encrypted by using the public key of the certificate of the above-mentioned first terminal; the method further includes: the first terminal uses the first terminal's public key The private key of the certificate decrypts the first update key.
  • the above-mentioned first update key is encrypted using a first temporary encryption key, and the first temporary encryption key is randomly generated by the second terminal using the second terminal.
  • the first update key information also includes the temporary public key; the method further includes: the first terminal uses the temporary public key and the certificate of the first terminal.
  • the private key generates a second temporary encryption key; the first terminal uses the second temporary encryption key to decrypt the first update key.
  • the method further includes: the first terminal, according to the first key update information, A key of a terminal is updated; the first terminal sends a third message, where the third message includes the identification information of the second key.
  • the second value corresponding to the identification information of the second key is smaller than the first value corresponding to the identification information of the first key
  • the first key is used to update the key of the second terminal.
  • the first key update information includes identification information of any key stored locally by the second terminal.
  • the method further includes: obtaining a second result, where the second result is the first The first value corresponding to the identification information of the key is greater than the third value corresponding to the identification information of any of the above keys; the first terminal sends a fourth message, and the fourth message includes the second key update information, wherein the second The key update information includes the identification information of the first key, the identification of the second terminal, the second update key corresponding to not less than the first value, and the identification information of the second update key.
  • the second update key is encrypted by using the public key of the certificate of the second terminal or the third temporary encryption key, wherein the third temporary encryption key is encrypted.
  • the key is generated by the first terminal using the temporary private key randomly generated by the first terminal and the public key of the certificate of the second terminal; the method further includes: the second terminal adopts the private key or the fourth terminal of the certificate of the second terminal.
  • the temporary encryption key decrypts the second update key, wherein the fourth temporary encryption key is generated by the second terminal using the temporary public key randomly generated by the first terminal and the private key of the certificate of the second terminal.
  • an apparatus for secure communication comprising: performing the method in any possible implementation manner of the above-mentioned first aspect.
  • the apparatus includes a module for executing the method in any one of the possible implementation manners of the first aspect above.
  • the apparatus may include modules corresponding to one-to-one execution of the methods/operations/steps/actions described in the first aspect, and the modules may be hardware circuits, software, or a combination of hardware circuits Software Implementation.
  • the device is a communication chip, which may include an input circuit or interface for sending information or data, and an output circuit or interface for receiving information or data.
  • the apparatus is a communication device that may include a transmitter for transmitting information or data and a receiver for receiving information or data.
  • the apparatus is configured to execute the method in the first aspect or any possible implementation manner of the first aspect, the apparatus may be configured in a second terminal, or the communication apparatus itself is the second terminal described above .
  • another apparatus for secure communication comprising: performing the method in any possible implementation manner of the second aspect above.
  • the communication apparatus includes a module for executing the method in any of the possible implementation manners of the second aspect above.
  • the apparatus may include modules corresponding to one-to-one execution of the methods/operations/steps/actions described in the second aspect, and the modules may be hardware circuits, software, or a combination of hardware circuits Software Implementation.
  • the device is a communication chip, which may include an input circuit or interface for sending information or data, and an output circuit or interface for receiving information or data.
  • the apparatus is a communication device that may include a transmitter for transmitting information or data and a receiver for receiving information or data.
  • the apparatus is configured to execute the method in the second aspect or any possible implementation manner of the second aspect
  • the communication apparatus may be configured in the first terminal, or the apparatus itself is the first terminal described above .
  • another device for secure communication including a processor and a memory, where the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the device executes any of the above A method in any of the possible implementations of an aspect.
  • processors there are one or more processors and one or more memories.
  • the memory may be integrated with the processor, or the memory may be provided separately from the processor.
  • the apparatus further includes a transmitter (transmitter) and a receiver (receiver).
  • the transmitter and the receiver can be set separately or integrated together, which is called a transceiver (transceiver).
  • a communication system including a device for implementing the above-mentioned first aspect or any possible implementation method of the first aspect, and a device for implementing any of the above-mentioned second aspect or the second aspect Apparatus for possible implementation of the method.
  • the communication system may further include other devices that interact with the first terminal and/or the second terminal in the solutions provided in the embodiments of the present application.
  • a computer program product comprising: a computer program (also referred to as code, or instructions), which, when the computer program is executed, causes a computer to execute any one of the above aspects.
  • a computer program also referred to as code, or instructions
  • a computer-readable storage medium stores a computer program (which may also be referred to as code, or instructions), when it runs on a computer, causing the computer to perform any of the above-mentioned aspects. method in any of the possible implementations.
  • the present application provides a system-on-a-chip
  • the system-on-a-chip includes at least one processor configured to support implementing the functions involved in any one of the first to second aspects above, such as receiving or Process the data and/or information involved in the above methods.
  • the chip system further includes a memory for storing program instructions and data, and the memory is located inside the processor or outside the processor.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • FIG. 1 is a schematic diagram of a communication scenario provided by the present application.
  • FIG. 2 is a schematic diagram of an encrypted communication scenario provided by the present application.
  • FIG. 3 is a schematic flowchart of a method for secure communication provided by an embodiment of the present application.
  • Fig. 4 is a kind of V2X message format of the embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a method for secure communication provided by an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of another method for secure communication provided by an embodiment of the present application.
  • FIG. 7 is a schematic block diagram of an apparatus for secure communication provided by an embodiment of the present application.
  • FIG. 8 is a schematic block diagram of another apparatus for secure communication provided by an embodiment of the present application.
  • FIG. 9 is a schematic block diagram of still another apparatus for secure communication provided by an embodiment of the present application.
  • LTE long term evolution
  • FDD frequency division duplex
  • TDD time division duplex
  • UMTS universal mobile telecommunication system
  • 5th generation, 5G new radio
  • new radio new radio, NR
  • the terminal in the embodiments of the present application may also be referred to as: user equipment (user equipment, UE), mobile station (mobile station, MS), mobile terminal (mobile terminal, MT), access terminal, subscriber unit, subscriber station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user equipment, etc.
  • user equipment user equipment
  • MS mobile station
  • MT mobile terminal
  • access terminal subscriber unit, subscriber station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user equipment, etc.
  • a terminal may be a device that provides voice/data connectivity to a user, eg, a handheld device with wireless connectivity, a vehicle-mounted device, and the like.
  • some examples of terminals are: mobile phone (mobile phone), tablet computer, notebook computer, PDA, mobile internet device (MID), wearable device, virtual reality (virtual reality, VR) device, augmented reality (augmented reality, AR) equipment, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, and smart grids wireless terminal in transportation safety, wireless terminal in smart city, wireless terminal in smart home, cellular phone, cordless phone, session initiation protocol , SIP) telephones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to wireless modems, automotive A device, a wearable device, a terminal in a 5G network, or a terminal in a future evolved public land mobile network (public land mobile network, PLMN), etc., are not limited in this
  • the terminal may also be a wearable device.
  • Wearable devices can also be called wearable smart devices, which are the general term for the intelligent design of daily wear and the development of wearable devices using wearable technology, such as glasses, gloves, watches, clothing and shoes.
  • a wearable device is a portable device that is worn directly on the body or integrated into the user's clothing or accessories. Wearable device is not only a hardware device, but also realizes powerful functions through software support, data interaction, and cloud interaction.
  • wearable smart devices include full-featured, large-scale, complete or partial functions without relying on smart phones, such as smart watches or smart glasses, and only focus on a certain type of application function, which needs to cooperate with other devices such as smart phones.
  • the terminal may also be a terminal in an internet of things (IoT) system.
  • IoT internet of things
  • the terminal of the present application may also be an on-board module, on-board module, on-board component, on-board chip or on-board unit built into the vehicle as one or more components or units.
  • a component, on-board chip or on-board unit may implement the method of the present application. Therefore, the embodiments of the present application can be applied to the Internet of Vehicles, such as vehicle-to-everything (V2X), long term evolution-vehicle (LTE-V), vehicle-to-vehicle (V2X) , V2V) and so on.
  • V2X vehicle-to-everything
  • LTE-V long term evolution-vehicle
  • V2X vehicle-to-vehicle
  • V2V vehicle-to-vehicle
  • V2V vehicle-to-vehicle
  • V2V vehicle-to-vehicle
  • V2V vehicle-to-vehicle
  • V2V vehicle-to-vehicle
  • V2V vehicle-to-veh
  • the terminal includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer.
  • This hardware layer includes hardware such as central processing unit (CPU), memory management unit (MMU), and memory (also called main memory).
  • the operating system may be any one or more computer operating systems that implement business processing through processes, such as a Linux operating system, a Unix operating system, an Android operating system, an iOS operating system, or a Windows operating system.
  • the application layer includes applications such as browsers, address books, word processing software, and instant messaging software.
  • the embodiments of the present application do not specifically limit the specific structure of the execution body of the methods provided by the embodiments of the present application, as long as the program that records the codes of the methods provided by the embodiments of the present application can be executed to provide the methods provided by the embodiments of the present application.
  • the execution body of the method provided by the embodiment of the present application may be a terminal, or a functional module in the terminal that can call and execute a program.
  • various aspects or features of the present application may be implemented as a method, apparatus, or article of manufacture using standard programming and/or engineering techniques.
  • article of manufacture encompasses a computer program accessible from any computer readable device, carrier or medium.
  • computer readable media may include, but are not limited to, magnetic storage devices (eg, hard disks, floppy disks, or magnetic tapes, etc.), optical disks (eg, compact discs (CDs), digital versatile discs (DVDs) etc.), smart cards and flash memory devices (eg, erasable programmable read-only memory (EPROM), card, stick or key drives, etc.).
  • various storage media described herein can represent one or more devices and/or other machine-readable media for storing information.
  • the term "machine-readable medium” may include, but is not limited to, wireless channels and various other media capable of storing, containing, and/or carrying instructions and/or data.
  • V2X Vehicle-to-everything
  • the Internet of Vehicles is a vehicle communication system that includes other types of communication.
  • Other communications include vehicle-to-infrastructure (V2I) communication, vehicle-to-network communication (V2N), vehicle-to-vehicle (V2N).
  • V2V vehicle-to-vehicle
  • V2P vehicle-to-pedestrian
  • V2D vehicle-to-device
  • V2X message interactive information in the communication process of the Internet of Vehicles.
  • the V2X message may be a broadcast message in the V2V or V2I process.
  • Roadside unit a device installed on the roadside, using dedicated short-range communication technology to communicate with the vehicle-mounted communication unit, to realize vehicle identification, electronic deduction and other services.
  • RSU is composed of high-gain directional beam control read-write antenna and radio frequency controller.
  • the high-gain directional beam control read-write antenna is a microwave transceiver module, responsible for signal and data transmission/reception, modulation/demodulation, encoding/decoding, encryption/decryption; the radio frequency controller is used to control the transmission and reception of data and the processing of the upper computer.
  • Diffie-Hellman key exchange (DH) protocol It is a security protocol. It allows two parties to create a key through an insecure channel without any prior information about the other party. This key can be used as a symmetric key to encrypt communication content in subsequent communication.
  • Elliptic curve Diffie-Hellman key exchange (ECDH) protocol uses elliptic curve cryptographic algorithm to complete the interaction process similar to DH protocol and create keys.
  • ECC Elliptic curve cryptography
  • SM2 algorithm It is a public key cryptographic algorithm, based on a more secure and advanced elliptic curve cryptography mechanism, independently developed and designed on the basis of the international standard ECC elliptic curve cryptography theory, with the performance characteristics of the ECC algorithm and optimized and improved.
  • KDF Key derivation functions
  • FIG. 1 shows a communication scenario 100 provided by the present application.
  • the first terminal 110 and the second terminal 120 may communicate through wireless communication technology.
  • the wireless communication technology may be the above-mentioned 4G or 5G, etc., which is not limited in this embodiment of the present application.
  • the distance between the first terminal 110 and the second terminal 120 is short.
  • the communication link between the first terminal 110 and the second terminal 120 may be called a sidelink (sidelink, SL) or other names, which are not limited in this embodiment of the present application.
  • the first terminal 110 and the second terminal 120 in the foregoing FIG. 1 may both be in-vehicle devices (also may be vehicle or vehicle networking terminals), and the corresponding communication may be called V2V communication.
  • the first terminal 110 in FIG. 1 may be an in-vehicle device (or a vehicle or a connected vehicle terminal), the second terminal 120 may be an RSU, and the corresponding communication may be called V2I communication .
  • FIG. 1 is only a simplified schematic diagram for easy understanding, and in other possible scenarios, the communication scenario may also include other devices, which are not shown in FIG. 1 .
  • the first terminal 110 and the second terminal 120 may Encrypted transmission of transmission messages. Therefore, the first terminal 110 and the second terminal 120 need to obtain the communication key from the cloud key management platform, the sender of the message uses the communication key to encrypt and send the message, and the receiver of the message needs to use the same version of the key Decrypt the message to obtain the content of the message and complete the communication.
  • FIG. 2 shows an encrypted communication scenario 200 provided by the present application.
  • the scenario 200 includes a first terminal, a second terminal, and a cloud key management platform.
  • the cloud key management platform is responsible for the unified management of the keys for each communication terminal to perform message encryption communication.
  • the cloud key management platform may periodically issue the communication key (or update the communication key) to the first terminal and the second terminal, or the cloud key management platform may receive the encryption key sent by the first terminal and/or the second terminal.
  • the communication key is issued (or the communication key is updated) to the first terminal and/or the second terminal.
  • the communication key can be stored locally, and part of the information can be encrypted and protected by using the communication key in the subsequent encrypted communication process (for example, , coordinates, historical track and other information in the V2X message).
  • the above-mentioned cloud key management platform may be a server, and the first terminal and the second terminal have networking capabilities and can be connected to the cloud key management platform through the Internet. This embodiment of the present application does not limit this.
  • a vehicle also referred to as an Internet of Vehicles terminal
  • a vehicle needs to broadcast its own position coordinates and the historical trajectory of the vehicle based on a certain reference point through V2X broadcast messages at any time, so that the vehicle can determine the
  • the relative position between other vehicles combined with the perception and positioning of vehicle sensors on the lane and surrounding objects, can realize forward collision warning, blind spot/lane change assist, emergency braking warning, reverse overtaking collision warning, intersection collision warning, Left turn assist and many other functions.
  • these location coordinate information needs to be encrypted and protected.
  • the vehicle historical trajectory information data belongs to the user's personal privacy data.
  • terminals there are two main ways for terminals to obtain communication keys: one is that all terminals temporarily obtain communication keys from the cloud key management platform during the communication process to ensure that the key identifiers of both parties are consistent and complete the communication between terminals. Normal communication; the other is that the cloud key management platform regularly issues updated communication keys for multiple terminals to ensure that the key identifiers between multiple terminals are consistent and complete normal communication between terminals.
  • the above two methods both require the terminal to have networking capability at any time, and have strict requirements on the terminal networking.
  • the terminal cannot connect to the cloud key management platform (for example, the terminal is located in a mountainous area, bridge hole, etc. without network environment), the communication key cannot be updated, and the communication will not proceed normally.
  • the present application provides a method and device for secure communication, checking the identification of the key through message interaction between the terminal and the terminal, and once it is found that the identification of the key used does not match, the terminal-terminal communication
  • the key update process between the two is based on the message between the terminal and the terminal, and does not depend on the connection between the terminal and the network.
  • the update of the communication key is realized, the matching of the communication key identifiers of both parties in the communication is ensured, and the communication efficiency is effectively improved.
  • the first, the second, and various numeral numbers are only for the convenience of description, and are not used to limit the scope of the embodiments of the present application. For example, distinguish between different messages, distinguish between different key identifiers, and so on. It should be noted that ordinal numbers such as “first” and "second” are used in the embodiments of the present application to distinguish multiple objects, and are not used to limit the order, sequence, priority or importance of multiple objects. For example, the first message, the second message, etc., are only for distinguishing different message types, but do not indicate that the two kinds of messages are different in structure and importance.
  • At least one means one or more, and “plurality” means two or more.
  • And/or which describes the association relationship of the associated objects, indicates that there can be three kinds of relationships, for example, A and/or B, which can indicate: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A, B can be singular or plural.
  • the character “/” generally indicates that the associated objects are an “or” relationship.
  • At least one item(s) below” or similar expressions thereof refer to any combination of these items, including any combination of single item(s) or plural items(s).
  • At least one (a) of a, b and c may represent: a, or b, or c, or a and b, or a and c, or b and c, or a, b and c, wherein a, b, c can be single or multiple.
  • the method 300 for secure communication provided by the embodiment of the present application will be described in detail below with reference to FIG. 3 .
  • the method 300 can be applied to the communication scenario 100 shown in FIG. 1 , can also be applied to the communication scenario 200 shown in FIG. 2 , and can also be applied to other communication scenarios, but the embodiments of the present application are not limited thereto.
  • the terminal before performing the method for end-to-end secure communication, the terminal may perform the cloud registration process or the cloud key update process in a networked manner, and obtain the communication key from the cloud key management platform, which is used for subsequent messages. Encrypted communication.
  • the number of keys acquired by the terminal from the cloud key management platform may be one or more, which is not limited in this application.
  • each of the above communication keys corresponds to a key identifier
  • each identifier has a unique corresponding value
  • the value corresponding to the identifier may be called an identifier
  • each key has a certain validity period.
  • the terminal needs to replace it with a new key for subsequent message communication.
  • the value corresponding to the identifier of the communication key currently used by the terminal is N
  • the value corresponding to the identifier used by the terminal is N+1 key as the new communication key.
  • the key identification number is simply referred to as the identification of the key.
  • the identification of the key may also be referred to as a version of the key, or an index of the key, etc., for indicating a unique communication key, and the embodiments of the present application only take the identification of the key as an example for description.
  • FIG. 3 is a schematic flowchart of a method 300 for secure communication provided by an embodiment of the present application. As shown in Figure 3, the method 300 includes the following steps:
  • the first terminal sends a first message, where the first message includes identification information of the first key. Accordingly, the second terminal receives the first message.
  • first message also includes the first encrypted message, the certificate of the first terminal (including the public key of the first terminal), the signature of the first terminal or other information, which is not limited in this application.
  • the first encrypted message is encrypted by using the first key.
  • the first encrypted message may include vehicle historical trajectory information, vehicle location coordinates, or other private information, and the like.
  • the above-mentioned second terminal can verify the validity of the message.
  • the verification process may include verifying the validity and validity of the certificate of the first terminal and verifying the correctness of the signature in the first message according to the public key of the first terminal.
  • the second terminal reads the identifier of the first key in the first message (denoted as N), and the identifier of the first key is associated with the current state of the second terminal.
  • the identifier of the used second key (marked as M) is compared to obtain the comparison result.
  • the obtained comparison result is referred to as the first result in the examples of the present application.
  • the second terminal sends a second message according to the first result, where the second message includes first key update information, where the first key update information is used to update the key of the first terminal or the key of the second terminal key. Accordingly, the first terminal receives the second message.
  • the second terminal may determine whether to update the key by the first terminal or the second terminal according to the above comparison result, and the specific update process will be described in detail later.
  • first message and second message may be transmitted in a broadcast manner, but this is not limited in this embodiment of the present application.
  • the key identifier is checked through the message interaction between the terminal and the terminal, so that the key update process between the terminal and the terminal is carried out based on the check result, and the whole process is based on the
  • the message does not depend on the connection between the terminal and the network, and can update the communication key when the terminal cannot be connected to the network side (such as the above-mentioned cloud key management platform). matching, effectively improving the communication efficiency.
  • the information included in the above-mentioned first key update information is determined according to the first result in the above-mentioned S302.
  • the first result has the following three possible cases.
  • the encrypted information in the message is decrypted, so as to carry out subsequent communication, and it is not necessary to perform S303.
  • the first value and the second value in this embodiment of the present application may be the identification size of the key, the size of the version number, or the sequence of time, etc.
  • Case 2 The second value corresponding to the identification information of the second key is greater than the first value corresponding to the identification information of the first key, that is, M>N, then the first key update information includes the second key The identification information of the first terminal, the identification of the first terminal, the update key corresponding to the identification not lower than the second key, and the identification of the update key.
  • the update key corresponding to the identifier not smaller than the second key is collectively referred to as the first update key, and the identifier of the first update key is referred to as the identifier of the first update key.
  • first update key may be one or multiple, which is not limited in this application.
  • the above-mentioned first key update information includes the identification information M of the second key, the identification of the first terminal, the key identification stored locally of the second terminal is not less than M communication keys (one or more, the key identifications are respectively is M, M+1, ..., M+T) and M, M+1, ..., M+T.
  • T is an integer greater than or equal to 0, and M+T is the identifier of the highest key stored locally by the second terminal.
  • the second message sent by the two terminals may also include a communication key whose key identifier is smaller than M, which is not limited here.
  • the identifier of the first terminal may be data capable of identifying the first terminal, such as a certificate serial number of the first terminal, a vehicle identification number, or the like.
  • the second terminal when the second value corresponding to the identification information of the second key is greater than the first value corresponding to the identification information of the first key, before the second terminal sends the second message,
  • the above-mentioned first update key may be encrypted to further ensure safe transmission of the first update key.
  • the first terminal may decrypt the first update key after receiving the second message sent by the second terminal.
  • the embodiment of the present application shows two ways of encrypting and decrypting the above-mentioned first update key.
  • the second terminal may use the public key of the certificate of the first terminal to encrypt the first update key.
  • the first terminal may use the private key of the certificate of the first terminal to decrypt the first update key.
  • the second terminal may use the first temporary encryption key to encrypt the above-mentioned first update key. If the second terminal uses the first temporary encryption key to encrypt the first update key, the first update key information further includes a temporary public key randomly generated by the second terminal. Correspondingly, the first terminal may decrypt the first update key by using the second temporary encryption key.
  • the first temporary encryption key is generated by using a temporary private key randomly generated by the second terminal and the public key of the certificate of the first terminal; the second temporary encryption key is generated by the first terminal according to the temporary public key received by the first terminal. and the private key of the certificate of the first terminal.
  • temporary public key and temporary private key are a pair of keys, which may be referred to as a temporary public-private key pair.
  • the above-mentioned first temporary encryption key and second temporary encryption key may be calculated by using a key agreement algorithm.
  • a key agreement algorithm For example, DH algorithm and ECDH algorithm.
  • the following takes the ECDH algorithm as an example to describe the calculation process of the temporary encryption key K in detail.
  • the second terminal randomly generates a temporary private key (priKeyB), and generates a corresponding public key (pubKeyB) according to a public key algorithm (eg, SM2 algorithm) defined in the first terminal.
  • the second terminal calculates the first temporary encryption key:
  • K1 KDF(priKeyB*pubKeyA)
  • KDF is a key derivation function
  • * represents an elliptic curve point multiplication operation
  • pubKeyA is the public key of the certificate of the first terminal (included in the certificate of the first terminal).
  • the second terminal uses the encryption key K1 to perform encryption calculation on the locally stored first update key:
  • Enc_key Enc(KeyM
  • Enc is the encryption operation of the symmetric cryptographic algorithm.
  • the first terminal calculates the second temporary encryption key:
  • K2 KDF(priKeyA*pubKeyB)
  • KDF is a key derivation function
  • * represents an elliptic curve point multiplication operation
  • priKeyA is the private key of the certificate of the first terminal
  • pubKeyB is included in the first update key information.
  • the first terminal decrypts the Enc_key using K2 to obtain the updated key: KeyM
  • KeyM+T Dec(Enc_key, K2), where Dec is the decryption operation of the symmetric encryption algorithm.
  • the decryption algorithm needs to correspond to the encryption algorithm to complete the decryption operation.
  • the encryption algorithm is public key encryption
  • the decryption algorithm is private key decryption.
  • the update key is encrypted by using the temporary encryption key calculated by both parties of the terminal, which has forward security. Even if an attacker intercepts the first message and cracks the private key of the certificate of the first terminal, he cannot decrypt it. The updated key is obtained, which further improves the security of the system.
  • the first terminal when the second value corresponding to the identification information of the second key is greater than the first value corresponding to the identification information of the first key, that is, M>N, the first terminal receives After the second message from the second terminal, the method further includes: the first terminal updates the key of the first terminal according to the first key update information. The first terminal sends a third message, where the third message includes the identification information of the second key. Accordingly, the second terminal receives the third message.
  • the above-mentioned second message also includes the second encrypted message, the certificate of the second terminal (including the public key of the first terminal), the signature of the second terminal or other information, which is not limited in this application.
  • the second encrypted message is encrypted by using the second key.
  • the second encrypted message may include vehicle historical trajectory information, vehicle location coordinates, or other private information, and the like.
  • the above-mentioned first terminal can verify the validity of the message.
  • the verification process may include verifying the validity and validity of the certificate of the second terminal, and verifying the correctness of the signature in the first message according to the public key of the second terminal.
  • first terminal updates the key of the first terminal according to the first key update information
  • it may mean that the first terminal replaces the key stored locally by the first terminal with the first update key, or It may mean that the first terminal stores the first update key on the basis of the key stored locally by the first terminal.
  • This embodiment of the present application does not limit the specific key update manner.
  • the first terminal after the first terminal receives the second message, it searches for the identification information in the second message, and if it finds its own identification, it uses the private key corresponding to its own certificate or the second temporary encryption key to encrypt the first update. key to decrypt. After the decryption is completed, the first terminal may update the locally stored key update, and determine the second key (ie, the key identified as M above) as the currently used key. The first terminal may use the second key to re-encrypt and send part of the information in the first message (that is, the above-mentioned third message).
  • the secure communication method provided by the embodiment of the present application completes the key update process through message communication between terminals, and can realize the communication encryption when the terminal cannot connect to the network side (for example, the above-mentioned cloud key management platform).
  • the update of the key ensures the matching of the communication key identifiers of the two communication parties, and effectively improves the communication efficiency.
  • Case 3 The second value corresponding to the identification information of the second key is smaller than the first value corresponding to the identification information of the first key, that is, M ⁇ N, then the first key update information includes the local information of the second terminal. The identity of any key stored.
  • the method further includes: the second terminal determining whether a key identical to the first value exists in the locally stored key.
  • the locally stored key of the second terminal contains the same key as the first value, then the second terminal can use the same key as the first value to decrypt the above-mentioned first message, thereby For subsequent normal communication, there is no need to execute S303.
  • a key identical to the identifier of the first key does not exist in the locally stored key of the second terminal, and the second terminal may select any key from the locally stored keys , and encrypt the above-mentioned second encrypted message by using the arbitrary key.
  • the second terminal may start from M, and compare the key identifiers larger than M in increments one by one (no incremental comparison is performed when M is the highest identifier), that is, compare M+1 and N, if N>M +1, continue to compare M+2 and N. If there is an identifier equal to N, the comparison is stopped, the key of the identifier is used to decrypt the first message, and the key of the identifier is used as the current key for communication. If there is no key with an identifier equal to N until the highest locally stored identifier M' is compared, it indicates that the key of the second terminal needs to be updated.
  • any one of the above keys is the key with the highest identification stored locally in the second terminal. If the second terminal encrypts the second message by using the key of the highest identifier (ie M') stored locally, it can be avoided that the update key obtained by the second terminal contains the same key as the key stored locally by the second terminal. key identification, effectively reducing the resource overhead.
  • the first terminal receives the second value from the second terminal.
  • the method further includes: obtaining a second result, where the second result is that the first value corresponding to the identification information of the first key is greater than the third value corresponding to the identification information of any key.
  • the above-mentioned first terminal sends a fourth message, where the fourth message includes second key update information, wherein the second key update information includes identification information of the first key, an identification of the second terminal, and a value not less than or equal to the first key.
  • the identity of the key corresponds to the update key and the identity information of the update key.
  • the second terminal receives the fourth message from the first terminal, and updates the key of the second terminal according to the second key update information.
  • the update key corresponding to the identifier not smaller than the first key stored locally by the first terminal is referred to as the second update key
  • the identifier of the update key is referred to as the identifier of the second update key
  • the above-mentioned fourth message also includes a fourth encrypted message, a certificate of the first terminal (including the public key of the first terminal), a signature of the first terminal or other information, which is not limited in this application.
  • the fourth encrypted message is encrypted by using the first key.
  • the first terminal may update the key for the second key Encryption is performed to further ensure secure transmission of the second update key.
  • the above-mentioned second update key can be encrypted by using the public key of the certificate of the second terminal or the third temporary encryption key, wherein the third temporary encryption key is the temporary private key and the third temporary encryption key randomly generated by the first terminal using the first terminal.
  • the public key of the certificate of the second terminal is generated.
  • the second terminal decrypts the above-mentioned second update key by using the private key of the certificate of the second terminal or the fourth temporary encryption key, wherein the fourth temporary encryption key is a temporary random generated by the second terminal using the first terminal.
  • the public key and the private key of the certificate of the second terminal are generated.
  • the temporary private key in the temporary public-private key pair is randomly generated by the first terminal, and the temporary public key in the temporary public-private key pair is generated by the first terminal according to a public key algorithm defined in the second terminal.
  • the temporary private key in the temporary public-private key pair is generated by the first terminal according to a public key algorithm defined in the second terminal.
  • the temporary private key in the temporary public-private key pair is generated by the first terminal according to a public key algorithm defined in the second terminal.
  • the first terminal and the second terminal are Internet of Vehicles terminals
  • the first message and the second message are V2X messages.
  • the V2X message in the embodiment of the present application adds a related field to carry the key update information mentioned in the above method.
  • the format of the V2X message in the embodiment of the present application will be described in detail with reference to FIG. 4 .
  • FIG. 4 shows a V2X message format according to an embodiment of the present application.
  • the current key version and key update information are newly added fields in the data field to be signed in the application, and the remaining fields are all fields of the existing V2X message.
  • the certificate field and the signature value field are used for message validity verification.
  • the newly added current key version field is used to carry the key version number (ie, the version of the first key, the version of the second key, and the version of any key) used for the current V2X message data encryption.
  • the above newly added key update information field is used to carry the relevant information required for the key update on the terminal side. It should be understood that the relevant information required for the key update on the terminal side may be the relevant information required for the above-mentioned first terminal key update, or may be the above-mentioned relevant information required for the key update of the second terminal.
  • Update target used to identify the subject corresponding to the update key (that is, the identifier of the first terminal or the identifier of the second terminal).
  • Update key version used to carry the version number corresponding to the update key (that is, the version of the first update key or the version of the second update key).
  • Update key encapsulation used to carry an encryption-protected update key (ie, the above-mentioned first update key or the above-mentioned second update key).
  • the identification information of the key is described by taking the version of the key as an example.
  • the terminal A may be the above-mentioned first terminal
  • the terminal B may be the above-mentioned second terminal.
  • terminal A and terminal B perform cloud registration process or cloud key update process through networking. Repeat.
  • FIG. 5 is a schematic flowchart of a method 500 for secure communication provided by an embodiment of the present application.
  • the method 500 may be applied to the communication scenario 100 shown in FIG. 1 , may also be applied to the communication scenario 200 shown in FIG. 2 , and may also be applied to other communication scenarios, but the embodiments of the present application are not limited thereto.
  • the specific process shown in Figure 5 is as follows:
  • the terminal A After the terminal A encrypts the information in the V2X message by using the key of the current version (equivalent to the above-mentioned first key), the version number of the current key is written into the V2X message (equivalent to the above-mentioned first message), Denote the current version number as N.
  • Terminal A broadcasts and sends a V2X message including version number N to the outside world.
  • the V2X message carries the certificate of terminal A (including the public key of terminal A) and the signature of terminal A.
  • terminal B After receiving the V2X message, terminal B first verifies the validity of the message, and the verification process includes verifying the validity and validity of the certificate of terminal A, and verifying the correctness of the signature in the V2X message according to the public key of terminal A. After all verifications are passed, perform the following steps.
  • Terminal B encapsulates all locally stored communication keys with key versions not less than M (one or more, the key versions are M, M+1, ..., M+T respectively) with the public key of terminal A Protect.
  • the specific encapsulation algorithm may be a public key encryption algorithm or a digital envelope algorithm.
  • the above-mentioned method for encapsulating all communication keys whose key versions are not less than M one or more, the key versions are M, M+1, .
  • the temporary encryption key randomly generated by terminal B performs encryption.
  • the terminal B After the terminal B encrypts the information in the V2X message using the key of the current version (M), writes M into the V2X message (equivalent to the second message above), and at the same time writes the identifier of the terminal A into the V2X message Information (which can be data that can identify terminal A, such as the certificate serial number of terminal A, vehicle identification number, etc.), the version number of the update key (M, M+1, ..., M+T) (equivalent to the above-mentioned first update key key version) and the encapsulated and protected communication key (equivalent to the above encrypted first update key).
  • M the key of the current version
  • Terminal B broadcasts and sends a V2X message to the outside world (including the version number M, the identification information of terminal A, the version number of the update key, and the update key after encapsulation and protection). At the same time, the V2X message carries the information of terminal B. Certificate (containing Terminal B's public key) and Terminal B's signature.
  • terminal A After receiving the V2X message, terminal A first verifies the validity of the message, and the verification process includes verifying the validity and validity of the certificate of terminal B, and verifying the correctness of the signature in the V2X message according to the public key of terminal B. After all verifications are passed, perform the next steps.
  • Terminal A searches for the identification information in the V2X message, and if it finds its own identification, it decapsulates the encapsulated update key by using the private key corresponding to its own certificate. After the decapsulation is completed, the locally stored V2X communication key is updated, and the currently used key version number is switched to M.
  • the manner in which the terminal A decapsulates the encapsulated update key in S505 can also use the temporary encryption key to decrypt.
  • the temporary encryption key used for the decryption operation reference may be made to the above-mentioned related descriptions, which will not be repeated here.
  • the key version is checked through the message exchange between the terminal and the terminal.
  • the receiving end ie, terminal B
  • the update key is encrypted and transmitted, which further ensures the safe transmission of the update key. Since the entire key update process is completed based on the messages between the terminals, it does not depend on the connection between the terminals and the network. Therefore, the method can realize the update of the communication key when the terminal cannot be connected to the network side (for example, the above-mentioned cloud key management platform), which ensures the matching of the communication key versions of the two parties in communication, and effectively improves the communication efficiency.
  • the network side for example, the above-mentioned cloud key management platform
  • FIG. 6 is a schematic flowchart of another method 600 for secure communication provided by an embodiment of the present application.
  • the method 600 may be applied to the communication scenario 100 shown in FIG. 1 , may also be applied to the communication scenario 200 shown in FIG. 2 , and may also be applied to other communication scenarios, but the embodiments of the present application are not limited thereto.
  • the specific process shown in Figure 6 is as follows:
  • S601 to S603 are the same as S501 to S503 in the foregoing method 500, and are not repeated here.
  • terminal B After passing the validity verification of the V2X message (equivalent to the above-mentioned first message), terminal B reads the key version (equivalent to the above-mentioned first key version) number N in the V2X message, which is the same as the currently used key.
  • the key version (equivalent to the version of the second key) number M is compared. If N>M, terminal B can start from M, and compare the key versions larger than M one by one (the incremental comparison is not performed when M is the highest version), that is, compare M+1 and N, if N>M +1, continue to compare M+2 and N.
  • terminal B starts to execute the subsequent steps.
  • terminal B reads the key version number N in the V2X message and compares it with the currently used key version number M. If it is found that N ⁇ M, it can try to obtain the update key from the cloud key management platform.
  • Terminal B encrypts the V2X message data using the key whose version number is M', and writes M' into the V2X message (equivalent to the second message above).
  • terminal B may also use any key stored locally to encrypt the V2X message data, which is not limited in this application.
  • Terminal B broadcasts and sends a V2X message containing the version number M' to the outside world.
  • the V2X message carries the certificate of terminal B (including the public key of terminal B) and the signature of terminal B.
  • terminal A After receiving the V2X message containing the version number M', terminal A first verifies the validity of the message. The verification process includes verifying the validity and validity of the certificate of terminal B, and verifying the signature in the V2X message according to the public key of terminal B. correctness. After all the verifications are passed, the following steps are performed: terminal A performs key update for terminal B (for the specific processes of S608 to S613, refer to the relevant descriptions of S504 to S509 of the method 500, which will not be repeated here).
  • the embodiments of the present application take two terminals as an example to describe the key update process between the terminals in detail. It should be understood that the key update process is not limited to only between two terminals, but may also be key update between three terminals, and the present application does not limit the number and type of terminals that communicate.
  • the terminal A in the above S607 may also be another terminal that can receive the V2X message sent by the terminal B in the above S606.
  • the key version is checked through message interaction between terminals, and once it is found that the key version of the sender (ie, terminal A) is greater than the key version used by the receiver (ie, terminal B)
  • the key update process is performed by the sender (not terminal B)
  • the whole process is based on the message between the terminal and the terminal and does not depend on the connection between the terminal and the network, and the receiver (ie, terminal B) uses a local storage
  • the second message is encrypted with the highest version of the key obtained by the second terminal, which can avoid the existence of the same key version as the key stored locally by the second terminal in the update key obtained by the second terminal, effectively reducing the resource overhead
  • the method can realize the update of the communication key when the terminal cannot be connected to the network side (for example, the cloud key management platform mentioned above), ensures the matching of the communication key versions of the two parties in communication, and effectively improves the communication efficiency.
  • FIG. 7 shows an apparatus 700 for secure communication provided by an embodiment of the present application.
  • the apparatus 700 includes: a receiving module 710 , a processing module 720 , and a sending module 730 .
  • the receiving module 710 is configured to receive a first message from the first terminal, where the first message includes identification information of the first key; the processing module 720 is configured to obtain the first result; the sending module 730 is further configured to: According to the first result, a second message is sent, the second message includes first key update information, and the first key update information is used to update the key of the first terminal or the second terminal 's key.
  • the first key update information is used to update the first key. Terminal key.
  • the first key update information includes identification information of the second key, an identification of the first terminal, a first update key not less than the second value corresponding to the first key, and the first key. Update the identification information of the key.
  • the processing module 720 is further configured to: encrypt the first update key by using the public key of the certificate of the first terminal.
  • the first update key information further includes a temporary public key; the processing module 720 is further configured to: randomly generate a temporary private key and the temporary public key; use the temporary private key and generating a first temporary encryption key from the public key of the certificate of the first terminal; and encrypting the first update key by using the first temporary encryption key.
  • the receiving module 710 is further configured to: receive a third message from the first terminal, where the third message includes identification information of the second key.
  • the second message when the second value corresponding to the identification information of the second key is smaller than the first value corresponding to the identification information of the first key, the second message includes a second encrypted message and the first value.
  • Key update information where the first key update information is used to update the key of the second terminal.
  • the first key update information includes identification information of any key stored locally by the second terminal; the processing module 720 is further configured to: determine whether there is a locally stored key that is related to the first key a key with the same value; if no key with the same value as the first value exists in the locally stored key, the second terminal selects any key from the locally stored key; and, The second encrypted message is encrypted using the either key.
  • the receiving module 710 is further configured to: receive a fourth message from the first terminal, where the fourth message includes second key update information, wherein the second key update information includes the first key update information.
  • the identification information of a key, the identification of the second terminal, the second update key locally stored by the first terminal and not smaller than the identification information of the first key, and the identification information of the second update key identification information;
  • the processing module 720 is further configured to: update the key stored locally by the second terminal according to the second key update information.
  • the second update key is encrypted using the public key of the certificate of the second terminal or a third temporary encryption key, wherein the third temporary encryption key is used by the first terminal.
  • the apparatus 700 may be specifically the second terminal in the foregoing embodiment, and the apparatus 700 may be configured to execute various processes and/or processes corresponding to the second terminal in the foregoing method 300 or steps, in order to avoid repetition, details are not repeated here.
  • FIG. 8 shows another apparatus 800 for secure communication provided by an embodiment of the present application.
  • the apparatus 800 includes a sending module 830 and a receiving module 820 .
  • the sending module 830 is configured to send a first message, where the first message includes identification information of the first key; the receiving module 820 is configured to receive a second message from the second terminal, the second message is based on If the first result is determined, the first result is used to indicate whether the identification information of the first key matches the identification information of the second key of the second terminal, and the second message includes the first key Update information, where the first key update information is used to update the key of the first terminal or the key of the second terminal.
  • the first key update information is used to update the first key. Terminal key.
  • the first key update information includes identification information of the second key, an identification of the first terminal, a first update key not less than the second value corresponding to the first key, and the first key. Update the identification information of the key.
  • the first update key is encrypted by using the public key of the certificate of the first terminal; the apparatus 800 further includes: a processing module configured to use the private key pair of the certificate of the first terminal The first update key is decrypted.
  • the first update key is encrypted by using a first temporary encryption key
  • the first temporary encryption key is a temporary private key and an all temporary private key randomly generated by the second terminal using the second terminal.
  • the first key update information further includes a temporary public key
  • the first update key information further includes a temporary public key
  • the apparatus 800 further includes: a processing module, generating a second temporary encryption key using the temporary public key and the private key of the certificate of the first terminal; and decrypting the first update key using the second temporary encryption key.
  • the processing module is further configured to: update the key of the first terminal according to the first key update information; the sending module 830 is further configured to: send a third message, the third The message includes identification information of the second key.
  • the first key update information is used to update the second key. Terminal key.
  • the first key update information includes identification information of any key stored locally by the second terminal.
  • the above processing module is further configured to: obtain a second result, where the second result is that the first value corresponding to the identification information of the first key is greater than the third value corresponding to the identification information of any key. value; the sending module 830 is further configured to: send a fourth message, where the fourth message includes second key update information, the second key update information is used to update the key of the second terminal, the first The second key update information includes the identification information of the first key, the identification of the second terminal, the second update key corresponding to not less than the first value, and the identification information of the second update key.
  • the second update key is encrypted using the public key of the certificate of the second terminal or a third temporary encryption key, wherein the third temporary encryption key is used by the first terminal.
  • the temporary private key is randomly generated by the first terminal and the public key of the certificate of the second terminal is generated.
  • the apparatus 800 may be specifically the first terminal in the foregoing embodiment, and the apparatus 800 may be configured to execute various processes and/or processes corresponding to the first terminal in the foregoing method 300 or steps, in order to avoid repetition, details are not repeated here.
  • module may refer to an application specific integrated circuit (ASIC), an electronic circuit, a processor for executing one or more software or firmware programs (eg, a shared processor, a dedicated processor, or a group of processors, etc.) and memory, merge logic, and/or other suitable components to support the described functions.
  • ASIC application specific integrated circuit
  • firmware programs eg, a shared processor, a dedicated processor, or a group of processors, etc.
  • the above-mentioned apparatus 700 and 800 have the functions of implementing the corresponding steps in the above-mentioned method 300; the above-mentioned functions may be implemented by hardware, or by executing corresponding software in hardware.
  • the hardware or software includes one or more modules corresponding to the above functions.
  • the apparatus 700 and the apparatus 800 may also be a chip or a system of chips, such as a system on chip (system on chip, SoC). This application is not limited here.
  • SoC system on chip
  • FIG. 9 shows yet another apparatus 900 for secure communication provided by an embodiment of the present application.
  • the apparatus 900 includes a processor 910 , a transceiver 920 and a memory 930 .
  • the processor 910, the transceiver 920 and the memory 930 communicate with each other through an internal connection path, the memory 930 is used to store instructions, and the processor 910 is used to execute the instructions stored in the memory 930 to control the transceiver 920 to send signals and / or receive signals.
  • the apparatus 900 may be specifically the first terminal or the second terminal in the foregoing embodiments, or the functions of the first terminal or the second terminal in the foregoing embodiments may be integrated in the apparatus 900, and the apparatus 900 may be used to execute Steps and/or processes corresponding to the first terminal or the second terminal in the foregoing embodiments.
  • the memory 930 may include read only memory and random access memory and provide instructions and data to the processor. A portion of the memory may also include non-volatile random access memory.
  • the memory may also store device type information.
  • the processor 910 may be configured to execute the instructions stored in the memory, and when the processor executes the instructions, the processor may execute various steps and/or processes corresponding to the first terminal or the second terminal in the foregoing method embodiments.
  • the processor 910 may be a central processing unit (central processing unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs). ASIC), Field Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • DSPs digital signal processors
  • ASIC application-specific integrated circuits
  • FPGA Field Programmable Gate Array
  • a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • each step of the above-mentioned method 300 may be completed by an integrated logic circuit of hardware in the processor 910 or instructions in the form of software.
  • the steps of the methods disclosed in conjunction with the embodiments of the present application may be directly embodied as executed by the hardware processor 910 , or executed by a combination of hardware and software modules in the processor 910 .
  • the software modules may be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other storage media mature in the art.
  • the storage medium is located in the memory, and the processor 910 executes the instructions in the memory, and completes the steps of the above method in combination with its hardware. To avoid repetition, detailed description is omitted here.
  • An implementation of the present application also provides a communication system, which may include the second terminal (ie, the apparatus 700) shown in FIG. 7 and the first terminal (ie, the apparatus 800) shown in FIG. 8 .
  • the present application provides a computer-readable storage medium, where the computer-readable storage medium is used to store a computer program, and the computer program is used to implement the method corresponding to the second terminal shown in various possible implementation manners in the foregoing embodiments.
  • the present application provides another computer-readable storage medium, where the computer-readable storage medium is used to store a computer program, and the computer program is used to implement the method corresponding to the first terminal shown in various possible implementation manners in the foregoing embodiments.
  • the present application provides a computer program product, the computer program product includes a computer program (also referred to as code, or instructions), when the computer program runs on a computer, the computer can execute various possible implementations in the above embodiments The method corresponding to the second terminal shown in the method.
  • a computer program also referred to as code, or instructions
  • the present application provides another computer program product, the computer program product includes a computer program (also referred to as code, or instructions), when the computer program runs on a computer, the computer can execute various possible implementations in the above embodiments.
  • the method corresponding to the first terminal shown in the implementation manner is implemented.
  • the present application provides a chip system, the chip system includes at least one processor for supporting the implementation of the functions involved in any one of the above-mentioned first aspect to the second aspect, for example, for example, receiving or processing the above-mentioned methods. the data and/or information involved.
  • the chip system further includes a memory for storing program instructions and data, and the memory is located inside the processor or outside the processor.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • the disclosed system, apparatus and method may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the functions, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium.
  • the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution.
  • the computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes .

Landscapes

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

Abstract

本申请提供了一种安全通信的方法和装置,能够在终端无法连接云端密钥管理平台的情况下,实现通信密钥的更新,保证了通信双方通信密钥标识的匹配,有效地提高了通信效率。该方法包括:第一终端发送第一消息,该第一消息包括第一密钥的标识信息。第二终端根据接收到的第一消息,获得第一结果,该第一结果用于指示第一密钥的标识信息与第二终端的第二密钥的标识信息是否匹配;并根据该第一结果,发送第二消息,该第二消息包括第一密钥更新信息,其中,第一密钥更新信息用于更新上述第一终端的密钥或上述第二终端的密钥。

Description

安全通信的方法和装置 技术领域
本申请涉及通信领域,尤其涉及一种安全通信的方法和装置。
背景技术
在多个终端之间进行加密通信的场景下,每个终端具有各自的通信密钥,通信的多个终端需要基于相同版本的通信密钥对消息进行加解密,以实现消息的成功传输。示例性地,在基于车联网(vehicle to everything,V2X)通信的场景下,车辆(也可称为车联网终端)需要随时通过V2X广播消息广播自身的位置坐标、以及车辆基于某个参考点的历史轨迹。为了防止恶意车辆或专门伪造的恶意路侧监听设备有意监听收集周围车辆的广播,获得连续坐标等数据,需要对上述V2X广播消息中的坐标数据进行加密保护。此外,为了提高通信密钥的安全性,降低密钥泄露所造成的影响,需要对消息加密密钥进行周期性更新。
目前,终端获取通信密钥的方式主要有两种:一种是所有终端在通信过程中临时从云端密钥管理平台处获取通信密钥,保证通信双方的密钥标识一致;另一种是云端密钥管理平台定期为多个终端下发更新的通信密钥,保证多个终端之间的密钥标识一致。
上述方式需要终端随时具备联网能力,对终端联网要求苛刻。一旦终端无法连接云端密钥管理平台(例如终端处于山区、桥洞等无网环境中),则无法更新通信密钥,通信将无法正常进行。
发明内容
本申请提供一种安全通信的方法和装置,能够在终端无法连接云端密钥管理平台的情况下,实现通信密钥的更新,保证了通信双方通信密钥标识的匹配,有效地提高了通信效率。
第一方面,提供了一种安全通信的方法,包括:第二终端接收来自第一终端的第一消息,该第一消息包括第一密钥的标识信息;获得第一结果,该第一结果用于指示上述第一密钥的标识信息与上述第二终端的第二密钥的标识信息是否匹配;根据该第一结果,发送第二消息,该第二消息包括第一密钥更新信息,该第一密钥更新信息用于更新上述第一终端的密钥或上述第二终端的密钥。
应理解,上述第一消息还包括第一加密消息、第一终端的证书(包括第一终端的公钥)、第一终端的签名或者其他信息,本申请对此不作限定。其中,该第一加密消息是采用该第一密钥进行加密的。在V2X通信的场景下,该第一加密消息可以包括车辆历史轨迹信息、车辆的位置坐标或者其他隐私信息等。
还应理解,上述第一消息和第二消息可以采用广播的方式进行传输,但本申请实施例对此不作限定。
本申请实施例的安全通信的方法,通过终端与终端之间的消息交互检查密钥标识,从 而基于检查结果,进行终端和终端之间的密钥更新过程,整个过程基于终端与终端之间的消息,不依赖于终端与网络之间的连接,能够在终端无法连接至网络侧(例如上述云端密钥管理平台)的情况下,实现通信密钥的更新,保证了通信双方通信密钥标识的匹配,有效地提高了通信效率。
结合第一方面,在第一方面的某些实现方式中,上述第二密钥的标识信息对应的第二值大于上述第一密钥的标识信息对应的第一值时,上述第一密钥更新信息用于更新第一终端的密钥。
应理解,本申请实施例中的第一值和第二值可以为密钥的标识大小,版本号的大小,或者时间的先后顺序等等,例如,上述第一值可以为20210228,第二值可以为20210305。本申请对此不作限定。
结合第一方面,在第一方面的某些实现方式中,上述第一密钥更新信息包括第二密钥的标识信息、第一终端的标识、不小于上述第二值对应的第一更新密钥以及该第一更新密钥的标识信息。
结合第一方面,在第一方面的某些实现方式中,在根据上述第一结果,发送第二消息之前,该方法还包括:第二终端采用第一终端的证书的公钥对上述第一更新密钥进行加密。
本申请实施例通过对第一更新密钥进行加密,可以进一步确保第一更新密钥的安全传输。
结合第一方面,在第一方面的某些实现方式中,上述第一更新密钥信息还包括临时公钥;在根据上述第一结果,发送第二消息之前,该方法还包括:第二终端随机生成临时私钥对和上述临时公钥;第二终端使用该临时私钥和第一终端的证书的公钥生成第一临时加密密钥;第二终端采用该第一临时加密密钥对上述第一更新密钥进行加密。
可选地,上述第一临时加密密钥和第二临时加密密钥可以采用密钥协商算法进行计算。
应理解,解密算法需要与加密算法相对应,才能完成解密操作。例如,加密算法为公钥加密,则解密算法为私钥解密。
本申请实施例的更新密钥采用终端双方计算得到的临时加密密钥进行加密,具有前向安全性,攻击者即使截取了第一消息并破解了第一终端的证书的私钥,也无法解密得到更新密钥,进一步提高了系统安全性。
结合第一方面,在第一方面的某些实现方式中,在根据第一结果,发送第二消息之后,该方法还包括:第二终端接收来自第一终端的第三消息,该第三消息包括上述第二密钥的标识信息。
结合第一方面,在第一方面的某些实现方式中,上述第二密钥的标识信息对应的第二值小于上述第一密钥的标识信息对应的第一值时,该第二消息包括第二加密消息和第一密钥更新信息,该第一密钥更新信息用于更新第二终端的密钥。
结合第一方面,在第一方面的某些实现方式中,上述第一密钥更新信息包括第二终端的本地存储的任一密钥的标识信息;在根据第一结果,发送第二消息之前,该方法还包括:第二终端确定本地存储的密钥中是否存在与上述第一值相同的密钥;若本地存储的密钥中不存在与该第一值相同的密钥,第二终端从本地存储的密钥中选择任一密钥;第二终端采用选择的任一密钥加密上述第二加密消息。
本申请实施例中,若第二终端采用本地存储的最高标识的密钥对第二消息进行加密, 可以避免第二终端获取到的更新密钥中存在与第二终端本地存储的密钥相同的密钥标识,有效的减少了资源的开销。
结合第一方面,在第一方面的某些实现方式中,在根据第一结果,发送第二消息之后,该方法还包括:第二终端接收来自第一终端的第四消息,该第四消息包括第二密钥更新信息,其中,该第二密钥更新信息包括上述第一密钥的标识信息、第二终端的标识、不小于上述第一值对应的第二更新密钥以及该第二更新密钥的标识信息;第二终端根据上述第二密钥更新信息,对第二终端的密钥进行更新。
应理解,上述第一终端接收到第二消息后,会验证消息的合法性。具体地,验证过程包括验证第二终端的证书的合法性、有效性以及根据第二终端的公钥验证第一消息中的签名的正确性。
还应理解,上述密钥更新方式可以是将第二终端本地存储的密钥替换为第一更新密钥。也可以是在第二终端本地存储的密钥基础上增加第一更新密钥。具体更新方式本申请对此不作限定。
结合第一方面,在第一方面的某些实现方式中,上述第二更新密钥是采用第二终端的证书的公钥或第三临时加密密钥加密的,其中,第三临时加密密钥是第一终端使用第一终端随机生成的临时私钥和上述第二终端的证书的公钥生成的;该方法还包括:第二终端采用第二终端的证书的私钥或第四临时加密密钥解密该第二更新密钥,其中,第四临时加密密钥是第二终端使用上述第一终端随机生成的临时公钥和第二终端的证书的私钥生成的。
综上所述,本申请提供的安全通信的方法,通过终端与终端之间的消息交互检查密钥标识,一旦发现所使用的密钥标识不匹配,则进行终端和终端之间的密钥更新过程,整个过程基于终端与终端之间的消息交互(即在交互的消息中携带密钥更新信息),不依赖于终端与网络之间的连接,能够在终端无法连接至网络侧(例如上述云端密钥管理平台)的情况下,实现通信密钥的更新,保证了通信双方通信密钥标识的匹配,有效地提高了通信效率。
第二方面,提供了另一种安全通信的方法,包括:第一终端发送第一消息,该第一消息包第一密钥的版本;该第一终端接收来自第二终端的第二消息,该第二消息是根据第一结果确定的,该第一结果用于指示该第一密钥的标识信息与该第二终端的第二密钥的标识信息是否匹配,该第二消息包括第一密钥更新信息,该第一密钥更新信息用于更新该第一终端的密钥或该第二终端的密钥。
结合第二方面,在第二方面的某些实现方式中,上述第二密钥的标识信息对应的第二值大于上述第一密钥的标识信息对应的第一值时,该第一密钥更新信息用于更新上述第一终端的密钥。
结合第二方面,在第二方面的某些实现方式中,上述第一密钥更新信息包括第二密钥的标识信息、第一终端的标识、不低于上述第二值对应的第一更新密钥以及该第一更新密钥的标识信息。
结合第二方面,在第二方面的某些实现方式中,上述第一更新密钥是采用上述第一终端的证书的公钥加密的;该方法还包括:该第一终端采用第一终端的证书的私钥对该第一更新密钥进行解密。
结合第二方面,在第二方面的某些实现方式中,上述第一更新密钥是采用第一临时加 密密钥加密的,该第一临时加密密钥是第二终端使用第二终端随机生成的临时私钥和上述第一终端的证书的公钥生成的,该第一更新密钥信息还包括临时公钥;该方法还包括:第一终端使用该临时公钥和第一终端的证书的私钥生成第二临时加密密钥;该第一终端采用该第二临时加密密钥对该第一更新密钥进行解密。
结合第二方面,在第二方面的某些实现方式中,在第一终端接收来自第二终端的第二消息之后,该方法还包括:第一终端根据第一密钥更新信息,对该第一终端的密钥进行更新;该第一终端发送第三消息,该第三消息包括上述第二密钥的标识信息。
结合第二方面,在第二方面的某些实现方式中,上述第二密钥的标识信息对应的第二值小于上述第一密钥的标识信息对应的第一值时,该第一密钥更新信息用于更新上述第二终端的密钥。
结合第二方面,在第二方面的某些实现方式中,该第一密钥更新信息包括上述第二终端本地存储的任一密钥的标识信息。
结合第二方面,在第二方面的某些实现方式中,在上述第一终端接收来自第二终端的第二消息之后,该方法还包括:获得第二结果,该第二结果为上述第一密钥的标识信息对应的第一值大于上述任一密钥的标识信息对应的第三值;该第一终端发送第四消息,该第四消息包括第二密钥更新信息,其中,第二密钥更新信息包括上述第一密钥的标识信息、第二终端的标识、不小于上述第一值对应的第二更新密钥以及该第二更新密钥的标识信息。
结合第二方面,在第二方面的某些实现方式中,上述第二更新密钥是采用上述第二终端的证书的公钥或第三临时加密密钥加密的,其中,第三临时加密密钥是上述第一终端使用第一终端随机生成的临时私钥和上述第二终端的证书的公钥生成的;该方法还包括:上述第二终端采用第二终端的证书的私钥或第四临时加密密钥解密该第二更新密钥,其中,第四临时加密密钥是上述第二终端使用上述第一终端随机生成的临时公钥和第二终端的证书的私钥生成的。
第三方面,提供了一种安全通信的装置,包括:用于执行上述第一方面中任一种可能的实现方式中的方法。具体地,该装置包括用于执行上述第一方面中任一种可能的实现方式中的方法的模块。
在一种设计中,该装置可以包括执行上述第一方面中所描述的方法/操作/步骤/动作所一一对应的模块,该模块可以是硬件电路,也可是软件,也可以是硬件电路结合软件实现。
在另一种设计中,该装置为通信芯片,通信芯片可以包括用于发送信息或数据的输入电路或者接口,以及用于接收信息或数据的输出电路或者接口。
在另一种设计中,该装置为通信设备,通信设备可以包括用于发送信息或数据的发射机,以及用于接收信息或数据的接收机。
在另一种设计中,该装置用于执行上述第一方面或第一方面任意可能的实现方式中的方法,该装置可以配置在第二终端中,或者该通信装置本身即为上述第二终端。
第四方面,提供了另一种安全通信的装置,包括:用于执行上述第二方面中任一种可能的实现方式中的方法。具体地,该通信装置包括用于执行上述第二方面中任一种可能的实现方式中的方法的模块。
在一种设计中,该装置可以包括执行上述第二方面中所描述的方法/操作/步骤/动作所一一对应的模块,该模块可以是硬件电路,也可是软件,也可以是硬件电路结合软件实现。
在另一种设计中,该装置为通信芯片,通信芯片可以包括用于发送信息或数据的输入电路或者接口,以及用于接收信息或数据的输出电路或者接口。
在另一种设计中,该装置为通信设备,通信设备可以包括用于发送信息或数据的发射机,以及用于接收信息或数据的接收机。
在另一种设计中,该装置用于执行上述第二方面或第二方面任意可能的实现方式中的方法,该通信装置可以配置在第一终端中,或者该装置本身即为上述第一终端。
第五方面,提供了另一种安全通信的装置,包括,处理器,存储器,该存储器用于存储计算机程序,该处理器用于从存储器中调用并运行该计算机程序,使得该装置执行上述任一方面中任一种可能实现方式中的方法。
可选地,所述处理器为一个或多个,所述存储器为一个或多个。
可选地,所述存储器可以与所述处理器集成在一起,或者所述存储器与处理器分离设置。
可选地,该装置还包括,发射机(发射器)和接收机(接收器),发射机和接收机可以分离设置,也可以集成在一起,称为收发机(收发器)。
第六方面,提供了一种通信系统,包括用于实现上述第一方面或第一方面的任一种可能实现的方法的装置,以及用于实现上述第二方面或第二方面的任一种可能实现的方法的装置。
在一个可能的设计中,该通信系统还可以包括本申请实施例所提供的方案中与第一终端和/或第二终端进行交互的其他设备。
第七方面,提供了一种计算机程序产品,所述计算机程序产品包括:计算机程序(也可以称为代码,或指令),当所述计算机程序被运行时,使得计算机执行上述任一方面中任一种可能实现方式中的方法。
第八方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序(也可以称为代码,或指令)当其在计算机上运行时,使得计算机执行上述任一方面中任一种可能实现方式中的方法。
第九方面,本申请提供了一种芯片系统,该芯片系统包括至少一个处理器,用于支持实现上述第一方面至第二方面中的任一方面中所涉及的功能,例如,例如接收或处理上述方法中所涉及的数据和/或信息。
在一种可能的设计中,所述芯片系统还包括存储器,所述存储器,用于保存程序指令和数据,存储器位于处理器之内或处理器之外。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
附图说明
图1是本申请提供的一种通信场景的示意图;
图2是本申请提供的一种加密通信场景的示意图;
图3是本申请实施例提供的安全通信的方法的示意性流程图;
图4是本申请实施例的一种V2X消息格式;
图5是本申请实施例提供的一种安全通信的方法的示意性流程图;
图6是本申请实施例提供的另一种安全通信的方法的示意性流程图;
图7是本申请实施例提供的一种安全通信的装置的示意性框图;
图8是本申请实施例提供的另一种安全通信的装置的示意性框图;
图9是本申请实施例提供的再一种安全通信的装置的示意性框图。
具体实施方式
下面将结合附图,对本申请中的技术方案进行描述。
本申请实施例的技术方案可以应用于各种通信系统,例如:长期演进(long term evolution,LTE)系统、LTE频分双工(frequency division duplex,FDD)系统、LTE时分双工(time division duplex,TDD)、通用移动通信系统(universal mobile telecommunication system,UMTS)、第五代(5th generation,5G)系统或新无线(new radio,NR)或者其他演进的通信系统等。
本申请实施例中的终端也可以称为:用户设备(user equipment,UE)、移动台(mobile station,MS)、移动终端(mobile terminal,MT)、接入终端、用户单元、用户站、移动站、移动台、远方站、远程终端、移动设备、用户终端、终端、无线通信设备、用户代理或用户装置等。
终端可以是一种向用户提供语音/数据连通性的设备,例如,具有无线连接功能的手持式设备、车载设备等。目前,一些终端的举例为:手机(mobile phone)、平板电脑、笔记本电脑、掌上电脑、移动互联网设备(mobile internet device,MID)、可穿戴设备,虚拟现实(virtual reality,VR)设备、增强现实(augmented reality,AR)设备、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程手术(remote medical surgery)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端、蜂窝电话、无绳电话、会话启动协议(session initiation protocol,SIP)电话、无线本地环路(wireless local loop,WLL)站、个人数字助理(personal digital assistant,PDA)、具有无线通信功能的手持设备、计算设备或连接到无线调制解调器的其它处理设备、车载设备、可穿戴设备,5G网络中的终端或者未来演进的公用陆地移动通信网络(public land mobile network,PLMN)中的终端等,本申请实施例对此并不限定。
作为示例而非限定,在本申请实施例中,该终端还可以是可穿戴设备。可穿戴设备也可以称为穿戴式智能设备,是应用穿戴式技术对日常穿戴进行智能化设计、开发出可以穿戴的设备的总称,如眼镜、手套、手表、服饰及鞋等。可穿戴设备即直接穿在身上,或是整合到用户的衣服或配件的一种便携式设备。可穿戴设备不仅仅是一种硬件设备,更是通过软件支持以及数据交互、云端交互来实现强大的功能。广义穿戴式智能设备包括功能全、尺寸大、可不依赖智能手机实现完整或者部分的功能,例如:智能手表或智能眼镜等,以及只专注于某一类应用功能,需要和其它设备如智能手机配合使用,如各类进行体征监测的智能手环、智能首饰等。
此外,在本申请实施例中,终端还可以是物联网(internet of things,IoT)系统中的终端,IoT是未来信息技术发展的重要组成部分,其主要技术特点是将物品通过通信技术与网络连接,从而实现人机互连,物物互连的智能化网络。
本申请的终端还可以是作为一个或多个部件或者单元而内置于车辆的车载模块、车载 模组、车载部件、车载芯片或者车载单元,车辆通过内置的所述车载模块、车载模组、车载部件、车载芯片或者车载单元可以实施本申请的方法。因此,本申请实施例可以应用于车联网,例如车辆外联(vehicle to everything,V2X)、车间通信长期演进技术(long term evolution-vehicle,LTE-V)、车到车(vehicle-to-vehicle,V2V)等。本申请实施例所涉及的第一终端和第二终端以车辆为例,进行示例性说明,当然,也可以替换为上述其它终端,例如第一终端为车辆,第二终端为手机,本申请实施例对此不作限定。
在本申请实施例中,终端包括硬件层、运行在硬件层之上的操作系统层,以及运行在操作系统层上的应用层。该硬件层包括中央处理器(central processing unit,CPU)、内存管理单元(memory management unit,MMU)和内存(也称为主存)等硬件。该操作系统可以是任意一种或多种通过进程(process)实现业务处理的计算机操作系统,例如,Linux操作系统、Unix操作系统、Android操作系统、iOS操作系统或windows操作系统等。该应用层包含浏览器、通讯录、文字处理软件、即时通信软件等应用。并且,本申请实施例并未对本申请实施例提供的方法的执行主体的具体结构特别限定,只要能够通过运行记录有本申请实施例的提供的方法的代码的程序,以根据本申请实施例提供的方法进行通信即可,例如,本申请实施例提供的方法的执行主体可以是终端,或者是终端中能够调用程序并执行程序的功能模块。
另外,本申请的各个方面或特征可以实现成方法、装置或使用标准编程和/或工程技术的制品。本申请中使用的术语“制品”涵盖可从任何计算机可读器件、载体或介质访问的计算机程序。例如,计算机可读介质可以包括,但不限于:磁存储器件(例如,硬盘、软盘或磁带等),光盘(例如,压缩盘(compact disc,CD)、数字通用盘(digital versatile disc,DVD)等),智能卡和闪存器件(例如,可擦写可编程只读存储器(erasable programmable read-only memory,EPROM)、卡、棒或钥匙驱动器等)。另外,本文描述的各种存储介质可代表用于存储信息的一个或多个设备和/或其它机器可读介质。术语“机器可读介质”可包括但不限于,无线信道和能够存储、包含和/或承载指令和/或数据的各种其它介质。
为便于理解本申请实施例,首先介绍本申请涉及到的相关术语。
1、车联网(vehicle-to-everything,V2X):是将汽车和其他车辆或是可能影响汽车的设备所进行的通信。车联网是包括其他种类通信的汽车通信系统,其他的通信有车与路边设施(vehicle-to-infrastructure,V2I)通信、车与网络通信(vehicle-To-network,V2N)、车与车(vehicle-to-vehicle,V2V)通信、车与行人(vehicle-to-pedestrian,V2P)通信、车与设备(vehicle-to device,V2D)通信。
2、V2X消息:车联网通信过程中的交互信息,示例性地,V2X消息可以为V2V或V2I过程中的广播消息。
3、路侧单元(road side unit,RSU):安装在路侧,采用专用短程通信技术与车载通信单元进行通讯,实现车辆身份识别,电子扣分等业务的装置。RSU是由高增益定向束控读写天线和射频控制器组成。高增益定向束控读写天线是一个微波收发模块,负责信号和数据的发送/接收、调制/解调、编码/解码、加密/解密;射频控制器是控制发射和接收数据以及处理向上位机收发信息的模块。
4、迪菲-赫尔曼密钥交换(Diffie–Hellman key exchange,DH)协议:是一种安全协议。它可以让双方在完全没有对方任何预先信息的条件下通过不安全信道创建起一个密钥。这 个密钥可以在后续的通讯中作为对称密钥来加密通讯内容。椭圆曲线迪菲-赫尔曼秘钥交换(elliptic curve Diffie–Hellman key exchange,ECDH)协议使用椭圆曲线密码算法完成类似DH协议的交互过程并创建密钥。
5、椭圆曲线密码学(elliptic curve cryptography,ECC):是一种基于椭圆曲线数学的公开密钥加密算法,包括一系列椭圆曲线上的点坐标运算(如点加、倍点、点乘等),以及公钥加密、签名、验签、数字信封等密码算法。
6、SM2算法:是一种公钥密码算法,基于更加安全先进的椭圆曲线密码机制,在国际标准的ECC椭圆曲线密码理论基础上进行自主研发设计,具备ECC算法的性能特点并实现优化改进。
7、密钥派生函数(key derivation functions,KDF):使用伪随机函数从诸如主密钥或密码的秘密值中派生出一个或多个密钥。KDF可用于将密钥扩展为更长的密钥或获取所需格式的密钥,例如,将作为迪菲-赫尔曼密钥交换结果的组元素转换为对称加密密钥。
下面结合图1对适用于本申请实施例的通信场景进行详细介绍。
图1示出了本申请提供的一种通信场景100。在图1所示的通信场景100中,第一终端110与第二终端120之间可以通过无线通信技术进行通信。该无线通信技术可以为上述4G或5G等,本申请实施例对此不作限定。
一般情况下,第一终端110和第二终端120之间的距离较短。此外,第一终端110和第二终端120之间的通信链路可以称为侧行链路(sidelink,SL)或其他名称,本申请实施例对此也不作限定。
在一种可能的场景中,上述图1中的第一终端110和第二终端120可以均为车载设备(也可以为车辆或车联网终端),其对应的通信可以称为V2V通信。在另一种可能的场景中,上述图1中的第一终端110可以为车载设备(也可以为车辆或车联网终端),第二终端120可以为RSU,其对应的通信可以称为V2I通信。
应理解,图1仅为便于理解而示出的简化示意图,在其他可能的场景中,该通信场景中还可以包括其他设备,图1中未予以画出。
结合上述图1所示的场景,当图1中所示的第一终端110和第二终端120之间进行通信时,为了防止恶意设备监听收集相关数据,第一终端110和第二终端120可以对传输消息进行加密传输。因此,第一终端110和第二终端120需要从云端密钥管理平台获取通信密钥,消息的发送端采用该通信密钥对消息进行加密并发送,消息的接收端需要基于相同版本的密钥对该消息进行解密,从而获取消息中的内容,完成通信。
图2示出了本申请提供的一种加密通信场景200。如图2所示,该场景200中包括第一终端、第二终端以及云端密钥管理平台。其中,云端密钥管理平台负责统一管理各个通信终端进行消息加密通信时的密钥。云端密钥管理平台可以定期向第一终端和第二终端下发通信密钥(或更新通信密钥),或者,云端密钥管理平台在接收到第一终端和/或第二终端发送的密钥请求消息时,向该第一终端和/或第二终端下发通信密钥(或更新通信密钥)。第一终端和/或第二终端从云端密钥管理平台获取通信密钥之后,可以将通信密钥在本地保存,并在后续加密通信的过程中使用通信密钥对部分信息进行加密保护(例如,V2X消息中的坐标、历史轨迹等信息)。
应理解,上述云端密钥管理平台可以是服务器,第一终端和第二终端具备联网能力, 能够通过互联网连接至云端密钥管理平台。本申请实施例对此不作限定。
示例性地,在基于V2X通信的场景下,车辆(也可称为车联网终端)需要随时通过V2X广播消息广播自身的位置坐标、以及车辆基于某个参考点的历史轨迹,使得车辆能够判断与他车之间的相对位置,结合车辆传感器对车道,周边物体的感知和定位,从而实现包括前向碰撞预警、盲区/变道辅助、紧急制动预警、逆向超车碰撞预警、交叉路口碰撞预警、左转辅助等多种功能。根据现行国家测绘管理条例《测绘管理工作国家秘密范围的规定》的解读,这些位置坐标信息需要加密保护。车辆历史轨迹信息数据属于用户个人隐私数据。因此,为了防止恶意车辆或专门伪造的恶意路侧监听设备有意监听收集周围车辆的广播,获得连续坐标等数据,需要对上述V2X广播消息中的坐标数据进行加密保护。此外,为了提高通信密钥的安全性,降低密钥泄露所造成的影响,需要对消息加密密钥进行周期性更新。由于V2X广播消息需要各设备之间互联互通,V2X广播消息中的坐标信息加密所需的密钥也需要实现互联互通。密钥不匹配会导致加密信息无法正常解析,从而影响V2X通信相关业务。
目前,终端获取通信密钥的方式主要有两种:一种是所有终端在通信过程中临时从云端密钥管理平台处获取通信密钥,保证通信双方的密钥标识一致,完成终端之间的正常通信;另一种是云端密钥管理平台定期为多个终端下发更新的通信密钥,保证多个终端之间的密钥标识一致,完成终端之间的正常通信。
但是,上述两种方式均需要终端随时具备联网能力,对终端联网要求苛刻。一旦终端无法连接云端密钥管理平台(例如终端处于山区、桥洞等无网环境中),无法更新通信密钥,通信将无法正常进行。
有鉴于此,本申请提供了一种安全通信的方法和装置,通过终端与终端之间的消息交互检查密钥的标识,一旦发现所使用的密钥的标识不匹配,则进行终端与终端之间的密钥更新过程,整个过程基于终端与终端之间的消息,不依赖于终端与网络之间的连接,能够在终端无法连接至网络侧(例如上述云端密钥管理平台)的情况下,实现通信密钥的更新,保证了通信双方通信密钥标识的匹配,有效地提高了通信效率。
在介绍本申请实施例提供的安全通信的方法和装置之前,先做出以下几点说明。
第一,在下文示出的实施例中,各术语及英文缩略语,如加密消息,密钥的标识信息等,均为方便描述而给出的示例性举例,不应对本申请构成任何限定。本申请并不排除已有或未来定义其它能够实现相同或相似功能的术语的可能。
第二,在下文示出的实施例中第一、第二以及各种数字编号仅为描述方便进行的区分,并不用来限制本申请实施例的范围。例如,区分不同的消息、区分不同的密钥标识等。需要说明的是,本申请实施例使用“第一”、“第二”等序数词是用于对多个对象进行区分,不用于限定多个对象的顺序、时序、优先级或重要程度。例如,第一消息、第二消息等,只是为了区分不同的消息类型,而并不是表示这两种消息的结构、重要程度等不同。
第三,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a、b和c 中的至少一项(个),可以表示:a,或b,或c,或a和b,或a和c,或b和c,或a、b和c,其中a,b,c可以是单个,也可以是多个。
下面结合图3,对本申请实施例提供的安全通信的方法300进行详细说明。该方法300可以应用于图1所示的通信场景100,也可以应用于图2所示的通信场景200,还可以应用于其他通信场景,但本申请实施例不限于此。
本申请实施例中,在进行端到端的安全通信的方法之前,终端可以通过联网的方式执行云端注册过程或云端密钥更新过程,从云端密钥管理平台获取通信密钥,用于后续消息的加密通信。终端从云端密钥管理平台获取的密钥个数可以为一个或多个,本申请对此不作限定。
应理解,上述每一个通信密钥对应一个密钥标识,每一个标识都有唯一对应的值,与该标识对应的值可以称为标识号,且每一个密钥都具有一定的有效期限。在某个密钥到达有效期之前,终端需要更换成新的密钥用于后续的消息通信。例如,终端当前使用的通信密钥的标识对应的值为N,在该密钥到期截止时间或到期之前某个时间点(如提前一天),该终端使用标识对应的值为N+1的密钥作为新的通信密钥。本申请实施例将密钥标识号简称为密钥的标识。还应理解,密钥的标识还可以称为密钥的版本、或者密钥的索引等,用于指示唯一的通信密钥,本申请实施例仅以密钥的标识为例进行说明。
图3是本申请实施例提供的安全通信的方法300的示意性流程图。如图3所示,该方法300包括以下步骤:
S301、第一终端发送第一消息,该第一消息包括第一密钥的标识信息。相应地,第二终端接收该第一消息。
应理解,上述第一消息还包括第一加密消息、第一终端的证书(包括第一终端的公钥)、第一终端的签名或者其他信息,本申请对此不作限定。其中,该第一加密消息是采用该第一密钥进行加密的。在V2X通信的场景下,该第一加密消息可以包括车辆历史轨迹信息、车辆的位置坐标或者其他隐私信息等。
还应理解,上述第二终端接收到第一消息后,可以验证消息的合法性。示例性地,验证过程可以包括验证第一终端的证书的合法性、有效性以及根据第一终端的公钥验证第一消息中的签名正确性。
S302、获得第一结果,该第一结果用于指示上述第一密钥的标识信息与上述第二终端的第二密钥的标识信息是否匹配。
示例性地,上述第一消息的合法性验证通过后,第二终端读取第一消息中的第一密钥的标识(记为N),将该第一密钥的标识与第二终端当前使用的第二密钥的标识(记为M)进行比较,获得比较结果。本申请实施例将获得的比较结果称为第一结果。
S303、第二终端根据上述第一结果,发送第二消息,该第二消息包括第一密钥更新信息,该第一密钥更新信息用于更新第一终端的密钥或第二终端的密钥。相应地,第一终端接收该第二消息。
应理解,在多个终端之间进行加密通信时,通信的多个终端需要基于相同标识的通信密钥对消息进行加解密,以实现消息的成功传输。因此,为了保证通信双方的通信密钥标识一致,通信双方需要对密钥进行更新。在本申请实施例中,第二终端可以根据上述比较结果确定是由第一终端更新密钥还是由第二终端更新密钥,具体更新过程后续将会进行详 细说明。
还应理解,上述第一消息和第二消息可以采用广播的方式进行传输,但本申请实施例对此不作限定。
本申请实施例的安全通信的方法,通过终端与终端之间的消息交互检查密钥标识,从而基于检查结果,进行终端和终端之间的密钥更新过程,整个过程基于终端与终端之间的消息,不依赖于终端与网络之间的连接,能够在终端无法连接至网络侧(例如上述云端密钥管理平台)的情况下,实现通信密钥的更新,保证了通信双方通信密钥标识的匹配,有效地提高了通信效率。
在本申请实施例中,上述第一密钥更新信息中包括的信息是根据上述S302中的第一结果确定的。该第一结果存在以下三种可能的情况。
情况一:上述第二密钥的标识信息对应的第二值等于上述第一密钥的标识信息对应的第一值,即M=N,则第二终端可以采用当前使用的密钥对第一消息中的加密信息进行解密,从而进行后续的通信,无需执行S303。
应理解,本申请实施例中的第一值和第二值可以为密钥的标识大小,版本号的大小,或者时间的先后顺序等等,例如,上述第一值可以为N=4,第二值可以为M=6或者N=20210228,M=20210305,本申请对此不作限定。
情况二:上述第二密钥的标识信息对应的第二值大于上述第一密钥的标识信息对应的第一值,即M>N,则上述第一密钥更新信息包括上述第二密钥的标识信息、上述第一终端的标识、不低于第二密钥的标识对应的更新密钥以及该更新密钥的标识。
本申请实施例将不小于第二密钥的标识对应的更新密钥统称为第一更新密钥,将该第一更新密钥的标识称为第一更新密钥的标识。
应理解,上述第一更新密钥可以是一个也可以是多个,本申请对此不作限定。
结合上面的例子,M>N表明第一终端的密钥需要更新。上述第一密钥更新信息包括第二密钥的标识信息M、第一终端的标识、第二终端的本地存储的密钥标识不小于M的通信密钥(一个或多个,密钥标识分别为M、M+1、…、M+T)以及M、M+1、…、M+T。在本申请实施例中,T为大于或等于0的整数,且M+T为上述第二终端本地存储的最高密钥的标识。
可选地,本申请实施例中,在上述第二密钥的标识信息对应的第二值大于上述第一密钥的标识信息对应的第一值的情况下,即M>N,在上述第二终端发送的第二消息中,还可以包括密钥标识小于M的通信密钥,此处不作限定。
示例性地,当第一终端为车联网终端时,上述第一终端的标识可以是第一终端的证书序列号、车辆识别号码等能够标识第一终端的数据等等。
作为一个可选的实施例,在上述第二密钥的标识信息对应的第二值大于上述第一密钥的标识信息对应的第一值的情况下,上述第二终端发送第二消息之前,可以对上述第一更新密钥进行加密,进一步确保第一更新密钥的安全传输。相应地,该第一终端可以在接收到第二终端发送的第二消息之后,对该第一更新密钥进行解密。
本申请实施例示出了两种对上述第一更新密钥进行加密和解密的方式。
方式一:第二终端可以采用上述第一终端的证书的公钥对上述第一更新密钥进行加密。相应地,上述第一终端可以采用第一终端的证书的私钥对第一更新密钥进行解密。
方式二:第二终端可以采用第一临时加密密钥对上述第一更新密钥进行加密。若第二终端采用第一临时加密密钥对第一更新密钥进行加密,上述第一更新密钥信息还包括第二终端随机生成的临时公钥。相应地,第一终端可以采用第二临时加密密钥对第一更新密钥进行解密。
具体地,上述第一临时加密密钥是采用第二终端随机生成的临时私钥和第一终端的证书的公钥生成的;第二临时加密密钥是第一终端根据接收到的临时公钥和第一终端的证书的私钥生成的。
应理解,上述临时公钥和临时私钥为一对密钥,可以称为临时公私钥对。
可选地,上述第一临时加密密钥和第二临时加密密钥可以采用密钥协商算法进行计算。例如,DH算法和ECDH算法。
下面以ECDH算法为例,详细说明临时加密密钥K的计算过程。
示例性地,第二终端随机生成临时私钥(priKeyB),并根据第一终端中定义的公钥算法(如SM2算法)生成对应的公钥(pubKeyB)。第二终端计算第一临时加密密钥:
K1=KDF(priKeyB*pubKeyA),
其中,KDF为密钥派生函数,*表示椭圆曲线点乘运算,pubKeyA为第一终端的证书的公钥(包含在第一终端的证书中)。
第二终端使用加密密钥K1对本地存储的第一更新密钥进行加密计算:
Enc_key=Enc(KeyM||KeyM+1||…||KeyM+T,K1),
其中,Enc为对称密码算法的加密操作。
相应地,第一终端计算第二临时加密密钥:
K2=KDF(priKeyA*pubKeyB),
其中,KDF为密钥派生函数,*表示椭圆曲线点乘运算,priKeyA为第一终端的证书的私钥,pubKeyB包含在第一更新密钥信息中。
第一终端使用K2解密Enc_key,得到更新密钥:KeyM||KeyM+1||…||KeyM+T=Dec(Enc_key,K2),Dec为对称密码算法的解密操作。
应理解,解密算法需要与加密算法相对应,才能完成解密操作。例如,加密算法为公钥加密,则解密算法为私钥解密。
本申请实施例对更新密钥采用终端双方计算得到的临时加密密钥进行加密,具有前向安全性,攻击者即使截取了第一消息并破解了第一终端的证书的私钥,也无法解密得到更新密钥,进一步提高了系统安全性。
作为一个可选的实施例,在上述第二密钥的标识信息对应的第二值大于上述第一密钥的标识信息对应的第一值的情况下,即M>N,在第一终端接收来自第二终端的第二消息之后,该方法还包括:第一终端根据该第一密钥更新信息,对第一终端的密钥进行更新。该第一终端发送第三消息,该第三消息包括上述第二密钥的标识信息。相应地,第二终端接收该第三消息。
应理解,上述第二消息还包括第二加密消息、第二终端的证书(包括第一终端的公钥)、第二终端的签名或者其他信息,本申请对此不作限定。其中,该第二加密消息是采用该第二密钥进行加密的。在V2X通信的场景下,该第二加密消息可以包括车辆历史轨迹信息、车辆的位置坐标或者其他隐私信息等。
应理解,上述第一终端接收到第二消息后,可以验证消息的合法性。示例性地,验证过程可以包括验证第二终端的证书合法性、有效性以及根据第二终端的公钥验证第一消息中的签名正确性。
还应理解,上述第一终端根据该第一密钥更新信息,对第一终端的密钥进行更新,可以指第一终端将第一终端本地存储的密钥替换为第一更新密钥,也可以指第一终端在第一终端本地存储的密钥基础上存储第一更新密钥。本申请实施例对具体的密钥更新方式不作限定。
本申请实施例在第一终端接收到第二消息后,查找第二消息中的标识信息,若发现自身的标识,则使用自身证书对应的私钥或第二临时加密密钥对第一更新密钥进行解密。在解密完成后,第一终端可以对本地存储的密钥更新进行更新,并将第二密钥(即上述标识为M的密钥)确定为当前使用的密钥。第一终端可以使用第二密钥对第一消息中的部分信息重新进行加密发送(即上述第三消息)。
本申请实施例提供的安全通信的方法,通过终端之间的消息通信,完成密钥的更新过程,能够在终端无法连接至网络侧(例如上述云端密钥管理平台)的情况下,实现通信密钥的更新,保证了通信双方通信密钥标识的匹配,有效地提高了通信效率。
情况三:上述第二密钥的标识信息对应的第二值小于上述第一密钥的标识信息对应的第一值,即M<N,则上述第一密钥更新信息包括第二终端的本地存储的任一密钥的标识。
作为一个可选的实施例,在上述第二密钥的标识信息对应的第二值小于上述第一密钥的标识信息对应的第一值的情况下,在第二终端发送第二消息之前,该方法还包括:第二终端确定本地存储的密钥中是否存在与第一值相同的密钥。
在一种可能的实现方式中,第二终端的本地存储的密钥中存在与第一值相同的密钥,则第二终端可以采用与第一值相同的密钥解密上述第一消息,从而进行后续的正常通信,无需执行S303。
在另一种可能的实现方式中,第二终端的本地存储的密钥中不存在与第一密钥的标识相同的密钥,第二终端可以从本地存储的密钥中选择任一密钥,并采用该任一密钥加密上述第二加密消息。
示例性地,第二终端可以从M开始,对大于M的密钥标识逐个递增进行比对(M为最高标识时不进行递增比对),即比对M+1和N,若N>M+1,继续比对M+2和N。若存在与N相等的标识,则停止比对,采用该标识的密钥解密第一消息,并将该标识的密钥作为当前密钥进行通信。若直至比对到本地存储的最高标识M’,都不存在标识与N相等的密钥,则表明第二终端的密钥需要更新。
可选地,上述任一密钥为第二终端的本地存储的最高标识的密钥。若第二终端采用本地存储的最高标识(即M’)的密钥对第二消息进行加密,可以避免第二终端获取到的更新密钥中存在与第二终端本地存储的密钥相同的密钥标识,有效地减少了资源的开销。
作为一个可选的实施例,在上述第二密钥的标识信息对应的第二值小于上述第一密钥的标识对应的第一值的情况下,第一终端接收来自第二终端的第二消息之后,该方法还包括:获得第二结果,该第二结果为第一密钥的标识信息对应的第一值大于任一密钥的标识信息对应的第三值。上述第一终端发送第四消息,该第四消息包括第二密钥更新信息,其中,该第二密钥更新信息包括第一密钥的标识信息、第二终端的标识、不小于第一密钥的 标识对应的更新密钥以及该更新密钥的标识信息。相应地,第二终端接收来自上述第一终端的第四消息,并根据第二密钥更新信息,对第二终端的密钥进行更新。
本申请实施例将第一终端本地存储的不小于第一密钥的标识对应的更新密钥称为第二更新密钥,该更新密钥的标识称为第二更新密钥的标识。
应理解,上述第四消息还包括第四加密消息、第一终端的证书(包括第一终端的公钥)、第一终端的签名或者其他信息,本申请对此不作限定。其中,该第四加密消息是采用该第一密钥进行加密的。
应理解,上述密钥更新方式可参照第二终端的密钥更新过程,此处不再赘述。
作为一个可选的实施例,在上述第二密钥的标识信息对应的第二值小于上述第一密钥的标识对应的第一值的情况下,第一终端可以对上述第二更新密钥进行加密,进一步确保第二更新密钥的安全传输。上述第二更新密钥可以采用第二终端的证书的公钥或第三临时加密密钥进行加密,其中,第三临时加密密钥是第一终端使用第一终端随机生成的临时私钥和第二终端的证书的公钥生成的。相应地,第二终端采用第二终端的证书的私钥或第四临时加密密钥解密上述第二更新密钥,其中,第四临时加密密钥是第二终端使用第一终端随机生成的临时公钥和第二终端的证书的私钥生成的。
应理解,上述临时公私钥对中的临时私钥是第一终端随机生成的,上述临时公私钥对中的临时公钥是第一终端根据第二终端中定义的公钥算法生成。上述第三临时加密密钥的计算过程可以参照上述第一临时加密密钥的计算过程,此处不再赘述。上述第四临时加密密钥的计算过程可以参照上述第二临时加密密钥的计算过程,此处不再赘述。
示例性地,在V2X消息通信的场景下,上述第一终端和第二终端为车联网终端,上述第一消息和第二消息为V2X消息。本申请实施例的V2X消息在现有V2X消息格式的基础上增加了相关字段用于承载上述方法中提到的密钥更新信息。下面,以密钥的版本为例,结合图4详细说明本申请实施例的V2X消息的格式。
图4示出了本申请实施例的一种V2X消息格式。如图4所示,当前密钥版本和密钥更新信息为本申请在待签名数据字段中的新增字段,剩余字段均为现有V2X消息的字段。其中,证书字段和签名值字段用于消息合法性校验。
上述新增的当前密钥版本字段,用于承载当前V2X消息数据加密所使用的密钥版本号(即上述第一密钥的版本、第二密钥的版本以及任一密钥的版本)。
上述新增的密钥更新信息字段,用于承载端侧密钥更新所需的相关信息。应理解,端侧密钥更新所需的相关信息可以是上述第一终端密钥更新所需的相关信息,也可以是上述第二终端密钥更新所需的相关信息。
该密钥更新信息字段包括下列子字段:
1、更新目标:用于标识更新密钥对应的主体(即上述第一终端的标识或第二终端的标识)。
2、更新密钥版本:用于承载更新密钥对应的版本号(即上述第一更新密钥的版本或上述第二更新密钥的版本)。
3、更新密钥封装:用于承载加密保护的更新密钥(即上述第一更新密钥或上述第二更新密钥)。
下面,以V2X消息通信的场景为例,结合两个具体的实施例,详细说明上述安全通 信的方法。在图5和图6中,密钥的标识信息均以密钥的版本为例进行说明。其中,终端A可以为上述第一终端,终端B可以为上述第二终端。在终端A和终端B执行图5和图6所示出的步骤前,终端A和终端B通过联网的方式执行云端注册过程或云端密钥更新过程,具体过程可参照上述相关描述,此处不再赘述。
图5是本申请实施例提供的一种安全通信的方法500的示意性流程图。该方法500可以应用于图1所示的通信场景100,也可以应用于图2所示的通信场景200,还可以应用于其他通信场景,但本申请实施例不限于此。图5所示的具体流程如下:
S501、终端A使用当前版本的密钥(相当于上述第一密钥)对V2X消息中的信息进行加密后,将当前密钥的版本号写入V2X消息(相当于上述第一消息)中,将当前版本号记为N。
S502、终端A向外界广播发送包含版本号N的V2X消息,同时,V2X消息中携带了终端A的证书(包含终端A的公钥)和终端A的签名。
S503、终端B接收到该V2X消息后,首先验证消息的合法性,验证过程包含验证终端A的证书合法性及有效性、以及根据终端A的公钥验证V2X消息中的签名正确性。全部验证通过后执行下列步骤。
S504、消息合法性验证通过后,终端B读取V2X消息中的密钥版本号N,与当前使用的密钥(相当于上述第二密钥)的版本号(记为M)进行比对。若M=N,则进行消息解密过程,进行后续的正常V2X通信过程。若N<M,则说明终端A的密钥需要更新,终端B开始执行下列步骤。
S505、终端B将本地存储的所有密钥版本不小于M的通信密钥(一个或多个,密钥版本分别为M,M+1,…,M+T)使用终端A的公钥进行封装保护。具体的封装算法可以是公钥加密算法或者数字信封算法。
应理解,上述封装终端B本地存储的所有密钥版本不小于M的通信密钥(一个或多个,密钥版本分别为M,M+1,…,M+T)的方法,还可以通过终端B随机生成的临时加密密钥进行加密。临时加密密钥的具体计算过程可参照上述相关描述,此处不再赘述。
S506、终端B使用当前版本(M)的密钥对V2X消息中的信息进行加密后,将M写入V2X消息(相当于上述第二消息)中,同时在V2X消息中写入终端A的标识信息(可以是终端A的证书序列号、车辆识别号码等能够标识终端A的数据)、更新密钥的版本号(M,M+1,…,M+T)(相当于上述第一更新密钥的版本)以及封装保护后的通信密钥(相当于上述加密的第一更新密钥)。
S507、终端B向外界广播发送V2X消息(包含了版本号M、终端A的标识信息、更新密钥版本号以及封装保护后的更新密钥等信息),同时,V2X消息中携带了终端B的证书(包含终端B的公钥)和终端B的签名。
S508、终端A接收到该V2X消息后,首先验证消息的合法性,验证过程包含验证终端B的证书合法性及有效性、以及根据终端B的公钥验证V2X消息中的签名正确性。全部验证通过后执行后续步骤。
S509、终端A查找V2X消息中的标识信息,若发现自身的标识,则使用自身证书对应的私钥对封装后的更新密钥进行解封装。解封装完成后对本地存储的V2X通信密钥进行更新,并将当前使用的密钥版本号切换成M。
应理解,终端A对S505中对封装后的更新密钥进行解封装的方式,同样可以采用临时加密密钥进行解密。用于解密操作的临时加密密钥的具体计算过程可参照上述相关描述,此处不再赘述。
S510、终端A使用版本号M的密钥对S501的V2X消息中的信息进行重新加密后,将密钥版本号M写入V2X消息(相当于上述第三消息)中重新发送。
本申请提供的安全通信的方法,通过终端与终端之间的消息交互检查密钥版本,一旦发送端(即终端A)的密钥版本小于接收端(即终端B)所使用的密钥版本时,则采用接收端(即终端B)进行密钥更新过程,且更新密钥是进行加密传输的,进一步保证了更新密钥的安全传输。由于整个密钥更新过程是基于终端与终端之间的消息完成的,不依赖于终端与网络之间的连接。因此,该方法能够在终端无法连接至网络侧(例如上述云端密钥管理平台)的情况下,实现通信密钥的更新,保证了通信双方通信密钥版本的匹配,有效地提高了通信效率。
图6是本申请实施例提供的另一种安全通信的方法600的示意性流程图。该方法600可以应用于图1所示的通信场景100,也可以应用于图2所示的通信场景200,还可以应用于其他通信场景,但本申请实施例不限于此。图6所示的具体流程如下:
S601至S603与上述方法500中的S501至S503相同,此处不再赘述。
S604、终端B对V2X消息(相当于上述第一消息)的合法性验证通过后,读取V2X消息中的密钥版本(相当于上述第一密钥的版本)号N,与当前使用的密钥版本(相当于上述第二密钥的版本)号M进行比对。若N>M,终端B可以从M开始,对大于M的密钥版本逐个递增进行比对(M为最高版本时不进行递增比对),即比对M+1和N,若N>M+1,继续比对M+2和N。若存在与N相等的版本,则停止比对,采用该版本的密钥解密第一消息,并将该版本的密钥作为当前密钥进行通信。若直至比对到本地存储的最高版本M’,都不存在版本与N相等的密钥,则终端B开始执行后续步骤。
应理解,终端B读取V2X消息中的密钥版本号N,与当前使用的密钥版本号M进行比对,若发现N≠M时,可以尝试从云端密钥管理平台获取更新密钥。
S605、终端B使用版本号为M’的密钥对V2X消息数据进行加密,并将M’写入V2X消息(相当于上述第二消息)中。
可选地,终端B也可以使用本地存储的任一密钥对V2X消息数据进行加密,本申请对此不作限定。
S606、终端B向外界广播发送包含版本号M’的V2X消息,同时,V2X消息中携带了终端B的证书(包含终端B的公钥)和终端B的签名。
S607、终端A收到包含版本号M’的V2X消息后,首先验证消息的合法性,验证过程包含验证终端B的证书合法性及有效性、以及根据终端B的公钥验证V2X消息中的签名正确性。全部验证通过后执行后续步骤:由终端A为终端B进行密钥更新(S608至S613的具体过程可参照方法500的S504至S509的相关描述,此处不再赘述)。
本申请实施例以两个终端为例,详细描述了终端之间的密钥更新流程。应理解,该密钥更新流程不仅仅限于两个终端之间,也可以是三个终端之间的密钥更新,本申请对进行通信的终端数量以及类型均不作限定。例如,上述S607中的终端A也可以是其他能够收到上述S606中终端B发送的V2X消息的终端。
本申请提供的安全通信的方法,通过终端与终端之间的消息交互检查密钥版本,一旦发现发送端(即终端A)的密钥版本大于接收端(即终端B)所使用的密钥版本时,则采用发送端(非终端B)进行密钥更新过程,整个过程基于终端与终端之间的消息,不依赖于终端与网络之间的连接,且接收端(即终端B)采用本地存储的最高版本的密钥对第二消息进行加密,可以避免第二终端获取到的更新密钥中存在与第二终端本地存储的密钥相同的密钥版本,有效的减少了资源的开销,而且该方法能够在终端无法连接至网络侧(例如上述云端密钥管理平台)的情况下,实现通信密钥的更新,保证了通信双方通信密钥版本的匹配,有效提高了通信效率。
应理解,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
上文中结合图3至图6,详细描述了本申请实施例的安全通信的方法,下面将结合图7至图9,详细描述本申请实施例的安全通信的装置。
图7示出了本申请实施例提供的一种安全通信的装置700,该装置700包括:接收模块710、处理模块720以及发送模块730。
其中,接收模块710,用于接收来自第一终端的第一消息,所述第一消息包括第一密钥的标识信息;处理模块720,用于获得第一结果;发送模块730还用于:根据所述第一结果,发送第二消息,所述第二消息包括第一密钥更新信息,所述第一密钥更新信息用于更新所述第一终端的密钥或所述第二终端的密钥。
可选地,所述第二密钥的标识信息对应的第二值大于所述第一密钥的标识信息对应的第一值时,所述第一密钥更新信息用于更新所述第一终端的密钥。
可选地,所述第一密钥更新信息包括所述第二密钥的标识信息、所述第一终端的标识、不小于所述第二值对应的第一更新密钥以及所述第一更新密钥的标识信息。
可选地,处理模块720还用于:采用所述第一终端的证书的公钥对所述第一更新密钥进行加密。
可选地,所述第一更新密钥信息还包括临时公钥;处理模块720还用于:随机生成临时私钥和所述临时公钥;使用所述临时公私钥对中的临时私钥和所述第一终端的证书的公钥生成第一临时加密密钥;以及,采用所述第一临时加密密钥对所述第一更新密钥进行加密。
可选地,接收模块710还用于:接收来自所述第一终端的第三消息,所述第三消息包括所述第二密钥的标识信息。
可选地,所述第二密钥的标识信息对应的第二值小于所述第一密钥的标识信息对应的第一值时,所述第二消息包括第二加密消息和所述第一密钥更新信息,所述第一密钥更新信息用于更新所述第二终端的密钥。
可选地,所述第一密钥更新信息包括所述第二终端本地存储的任一密钥的标识信息;处理模块720还用于:确定本地存储的密钥中是否存在与所述第一值相同的密钥;若所述本地存储的密钥中不存在与所述第一值相同的密钥,所述第二终端从所述本地存储的密钥中选择任一密钥;以及,采用所述任一密钥加密所述第二加密消息。
可选地,接收模块710还用于:接收来自所述第一终端的第四消息,所述第四消息包括第二密钥更新信息,其中,所述第二密钥更新信息包括所述第一密钥的标识信息、所述 第二终端的标识、所述第一终端本地存储的不小于所述第一密钥的标识信息的第二更新密钥、以及所述第二更新密钥的标识信息;处理模块720还用于:根据所述第二密钥更新信息,对所述第二终端本地存储的密钥进行更新。
可选地,所述第二更新密钥是采用所述第二终端的证书的公钥或第三临时加密密钥加密的,其中,所述第三临时加密密钥是所述第一终端使用所述第一终端随机生成的临时私钥和所述第二终端的证书的公钥生成的;处理模块720还用于:采用所述第二终端的证书的私钥或第四临时加密密钥解密所述第二更新密钥,其中,所述第四临时加密密钥是所述第二终端使用所述第一终端随机生成的临时公钥和所述第二终端的证书的私钥生成的。
在一个可选的例子中,本领域技术人员可以理解,装置700可以具体为上述实施例中的第二终端,该装置700可以用于执行上述方法300中与第二终端对应的各个流程和/或步骤,为避免重复,此处不再赘述。
图8示出了本申请实施例提供的另一种安全通信的装置800,该装置800包括:发送模块830和接收模块820。
其中,发送模块830,用于发送第一消息,所述第一消息包括第一密钥的标识信息;接收模块820,用于接收来自第二终端的第二消息,所述第二消息是根据第一结果确定的,所述第一结果用于指示所述第一密钥的标识信息与所述第二终端的第二密钥的标识信息是否匹配,所述第二消息包括第一密钥更新信息,所述第一密钥更新信息用于更新所述第一终端的密钥或所述第二终端的密钥。
可选地,所述第二密钥的标识信息对应的第二值大于所述第一密钥的标识信息对应的第一值时,所述第一密钥更新信息用于更新所述第一终端的密钥。
可选地,所述第一密钥更新信息包括所述第二密钥的标识信息、所述第一终端的标识、不小于所述第二值对应的第一更新密钥以及所述第一更新密钥的标识信息。
可选地,所述第一更新密钥是采用所述第一终端的证书的公钥加密的;所述装置800还包括:处理模块,用于采用所述第一终端的证书的私钥对所述第一更新密钥进行解密。
可选地,所述第一更新密钥是采用第一临时加密密钥加密的,所述第一临时加密密钥是所述第二终端使用所述第二终端随机生成的临时私钥和所述第一终端的证书的公钥生成的,所述第一密钥更新信息还包括临时公钥,所述第一更新密钥信息还包括临时公钥;所述装置800还包括:处理模块,用于使用所述临时公钥和所述第一终端的证书的私钥生成第二临时加密密钥;以及,采用所述第二临时加密密钥对所述第一更新密钥进行解密。
可选地,所述处理模块还用于:根据所述第一密钥更新信息,对所述第一终端的密钥进行更新;发送模块830还用于:发送第三消息,所述第三消息包括所述第二密钥的标识信息。
可选地,所述第二密钥的标识信息对应的第二值小于所述第一密钥的标识信息对应的第一值时,所述第一密钥更新信息用于更新所述第二终端的密钥。
可选地,所述第一密钥更新信息包括所述第二终端本地存储的任一密钥的标识信息。
可选地,上述处理模块还用于:获得第二结果,所述第二结果为所述第一密钥的标识信息对应的第一值大于所述任一密钥的标识信息对应的第三值;发送模块830还用于:发送第四消息,所述第四消息包括第二密钥更新信息,所述第二密钥更新信息用于更新所述第二终端的密钥,所述第二密钥更新信息包括所述第一密钥的标识信息、所述第二终端的 标识、不小于所述第一值对应的第二更新密钥以及所述第二更新密钥的标识信息。
可选地,所述第二更新密钥是采用所述第二终端的证书的公钥或第三临时加密密钥加密的,其中,所述第三临时加密密钥是所述第一终端使用所述第一终端随机生成的临时私钥和所述第二终端的证书的公钥生成的。
在一个可选的例子中,本领域技术人员可以理解,装置800可以具体为上述实施例中的第一终端,该装置800可以用于执行上述方法300中与第一终端对应的各个流程和/或步骤,为避免重复,此处不再赘述。
应理解,这里的装置700和装置800以功能模块的形式体现。这里的术语“模块”可以指应用特有集成电路(application specific integrated circuit,ASIC)、电子电路、用于执行一个或多个软件或固件程序的处理器(例如共享处理器、专有处理器或组处理器等)和存储器、合并逻辑电路和/或其它支持所描述的功能的合适组件。
上述装置700和装置800具有实现上述方法300中的相应步骤的功能;上述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块。
在本申请的实施例,装置700和装置800也可以是芯片或者芯片系统,例如:片上系统(system on chip,SoC)。本申请在此不作限定。
图9示出了本申请实施例提供的再一种安全通信的装置900。该装置900包括处理器910、收发器920和存储器930。其中,处理器910、收发器920和存储器930通过内部连接通路互相通信,该存储器930用于存储指令,该处理器910用于执行该存储器930存储的指令,以控制该收发器920发送信号和/或接收信号。
应理解,装置900可以具体为上述实施例中的第一终端或者第二终端,或者,上述实施例中的第一终端或第二终端的功能可以集成在装置900中,装置900可以用于执行上述实施例中的第一终端或第二终端对应的各个步骤和/或流程。可选地,该存储器930可以包括只读存储器和随机存取存储器,并向处理器提供指令和数据。存储器的一部分还可以包括非易失性随机存取存储器。例如,存储器还可以存储设备类型的信息。该处理器910可以用于执行存储器中存储的指令,并且该处理器执行该指令时,该处理器可以执行上述方法实施例中与第一终端或第二终端对应的各个步骤和/或流程。
应理解,在本申请实施例中,该处理器910可以是中央处理单元(central processing unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
在实现过程中,上述方法300的各步骤可以通过处理器910中的硬件的集成逻辑电路或者软件形式的指令完成。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器910执行完成,或者用处理器910中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器910执行存储器中的指令,结合其硬件完成上述方法的步骤。为避免重复,这里不再详细描述。
本申请实施还提供了一种通信系统,该通信系统可以包括上述图7所示的第二终端 (即装置700)和上述图8所示的第一终端(即装置800)。
本申请提供一种计算机可读存储介质,该计算机可读存储介质用于存储计算机程序,该计算机程序用于实现上述实施例中各种可能的实现方式所示的第二终端对应的方法。
本申请提供另一种计算机可读存储介质,该计算机可读存储介质用于存储计算机程序,该计算机程序用于实现上述实施例中各种可能的实现方式所示的第一终端对应的方法。
本申请提供一种计算机程序产品,该计算机程序产品包括计算机程序(也可以称为代码,或指令),当该计算机程序在计算机上运行时,该计算机可以执行上述实施例中各种可能的实现方式所示的第二终端对应的方法。
本申请提供另一种计算机程序产品,该计算机程序产品包括计算机程序(也可以称为代码,或指令),当该计算机程序在计算机上运行时,该计算机可以执行上述实施例中各种可能的实现方式所示的第一终端对应的方法。
本申请提供一种芯片系统,该芯片系统包括至少一个处理器,用于支持实现上述第一方面至第二方面中的任一方面中所涉及的功能,例如,例如接收或处理上述方法中所涉及的数据和/或信息。
在一种可能的设计中,所述芯片系统还包括存储器,所述存储器,用于保存程序指令和数据,存储器位于处理器之内或处理器之外。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计 算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (44)

  1. 一种安全通信的方法,其特征在于,包括:
    第二终端接收来自第一终端的第一消息,所述第一消息包括第一密钥的标识信息;
    获得第一结果,所述第一结果用于指示所述第一密钥的标识信息与所述第二终端的第二密钥的标识信息是否匹配;
    根据所述第一结果,发送第二消息,所述第二消息包括第一密钥更新信息,所述第一密钥更新信息用于更新所述第一终端的密钥或所述第二终端的密钥。
  2. 如权利要求1所述的方法,其特征在于,所述第二密钥的标识信息对应的第二值大于所述第一密钥的标识信息对应的第一值时,所述第一密钥更新信息用于更新所述第一终端的密钥。
  3. 如权利要求2所述的方法,其特征在于,所述第一密钥更新信息包括所述第二密钥的标识信息、所述第一终端的标识、不小于所述第二值对应的第一更新密钥以及所述第一更新密钥的标识信息。
  4. 如权利要求3所述的方法,其特征在于,在所述根据所述第一结果,发送第二消息之前,所述方法还包括:
    所述第二终端采用所述第一终端的证书的公钥对所述第一更新密钥进行加密。
  5. 如权利要求3所述的方法,其特征在于,所述第一密钥更新信息还包括临时公钥;
    在所述根据所述第一结果,发送第二消息之前,所述方法还包括:
    所述第二终端随机生成临时私钥和所述临时公钥;
    所述第二终端使用所述临时私钥和所述第一终端的证书的公钥生成第一临时加密密钥;
    所述第二终端采用所述第一临时加密密钥对所述第一更新密钥进行加密。
  6. 如权利要求2至5中任一项所述的方法,其特征在于,在所述根据所述第一结果,发送第二消息之后,所述方法还包括:
    所述第二终端接收来自所述第一终端的第三消息,所述第三消息包括所述第二密钥的标识信息。
  7. 如权利要求1所述的方法,其特征在于,所述第二密钥的标识信息对应的第二值小于所述第一密钥的标识信息对应的第一值时,所述第二消息包括第二加密消息和所述第一密钥更新信息,所述第一密钥更新信息用于更新所述第二终端的密钥。
  8. 如权利要求7所述的方法,其特征在于,所述第一密钥更新信息包括所述第二终端本地存储的任一密钥的标识信息;
    在所述根据所述第一结果,发送第二消息之前,所述方法还包括:
    所述第二终端确定本地存储的密钥中是否存在与所述第一值相同的密钥;
    若所述本地存储的密钥中不存在与所述第一值相同的密钥,所述第二终端从所述本地存储的密钥中选择所述任一密钥;
    所述第二终端采用所述任一密钥加密所述第二加密消息。
  9. 如权利要求7或8所述的方法,其特征在于,在所述根据所述第一结果,发送第二 消息之后,所述方法还包括:
    所述第二终端接收来自所述第一终端的第四消息,所述第四消息包括第二密钥更新信息,其中,所述第二密钥更新信息包括所述第一密钥的标识信息、所述第二终端的标识、不小于所述第一值对应的第二更新密钥以及所述第二更新密钥的标识信息;
    所述第二终端根据所述第二密钥更新信息,对所述第二终端的密钥进行更新。
  10. 如权利要求9所述的方法,其特征在于,所述第二更新密钥是采用所述第二终端的证书的公钥或第三临时加密密钥加密的,其中,所述第三临时加密密钥是所述第一终端使用所述第一终端随机生成的临时私钥和所述第二终端的证书的公钥生成的;
    所述方法还包括:
    所述第二终端采用所述第二终端的证书的私钥或第四临时加密密钥解密所述第二更新密钥,其中,所述第四临时加密密钥是所述第二终端使用所述第一终端随机生成的临时公钥和所述第二终端的证书的私钥生成的。
  11. 一种安全通信的方法,其特征在于,包括:
    第一终端发送第一消息,所述第一消息包括第一密钥的标识信息;
    所述第一终端接收来自第二终端的第二消息,所述第二消息是根据第一结果确定的,所述第一结果用于指示所述第一密钥的标识信息与所述第二终端的第二密钥的标识信息是否匹配,所述第二消息包括第一密钥更新信息,所述第一密钥更新信息用于更新所述第一终端的密钥或所述第二终端的密钥。
  12. 如权利要求11所述的方法,其特征在于,所述第二密钥的标识信息对应的第二值大于所述第一密钥的标识信息对应的第一值时,所述第一密钥更新信息用于更新所述第一终端的密钥。
  13. 如权利要求12所述的方法,其特征在于,所述第一密钥更新信息包括所述第二密钥的标识信息、所述第一终端的标识、不小于所述第二值对应的第一更新密钥以及所述第一更新密钥的标识信息。
  14. 如权利要求13所述的方法,其特征在于,所述第一更新密钥是采用所述第一终端的证书的公钥加密的;
    所述方法还包括:
    所述第一终端采用所述第一终端的证书的私钥对所述第一更新密钥进行解密。
  15. 如权利要求13所述的方法,其特征在于,所述第一更新密钥是采用第一临时加密密钥加密的,所述第一临时加密密钥是所述第二终端使用所述第二终端随机生成的临时私钥和所述第一终端的证书的公钥生成的,所述第一密钥更新信息还包括临时公钥;
    所述方法还包括:
    所述第一终端使用所述临时公钥和所述第一终端的证书的私钥生成第二临时加密密钥;
    所述第一终端采用所述第二临时加密密钥对所述第一更新密钥进行解密。
  16. 如权利要求12至15中任一项所述的方法,其特征在于,在所述第一终端接收来自第二终端的第二消息之后,所述方法还包括:
    所述第一终端根据所述第一密钥更新信息,对所述第一终端的密钥进行更新;
    所述第一终端发送第三消息,所述第三消息包括所述第二密钥的标识信息。
  17. 如权利要求11所述的方法,其特征在于,所述第二密钥的标识信息对应的第二值小于所述第一密钥的标识信息对应的第一值时,所述第一密钥更新信息用于更新所述第二终端的密钥。
  18. 如权利要求17所述的方法,其特征在于,所述第一密钥更新信息包括所述第二终端本地存储的任一密钥的标识信息。
  19. 如权利要求18所述的方法,其特征在于,在所述第一终端接收来自第二终端的第二消息之后,所述方法还包括:
    获得第二结果,所述第二结果为所述第一密钥的标识信息对应的第一值大于所述任一密钥的标识信息对应的第三值;
    所述第一终端发送第四消息,所述第四消息包括第二密钥更新信息,所述第二密钥更新信息用于更新所述第二终端的密钥,所述第二密钥更新信息包括所述第一密钥的标识信息、所述第二终端的标识、不小于所述第一值对应的第二更新密钥以及所述第二更新密钥的标识信息。
  20. 如权利要求19所述的方法,其特征在于,所述第二更新密钥是采用所述第二终端的证书的公钥或第三临时加密密钥加密的,其中,所述第三临时加密密钥是所述第一终端使用所述第一终端随机生成的临时私钥和所述第二终端的证书的公钥生成的。
  21. 一种安全通信的装置,其特征在于,包括:
    接收模块,用于接收来自第一终端的第一消息,所述第一消息包括第一密钥的标识信息;
    处理模块,用于获得第一结果,所述第一结果用于指示所述第一密钥的标识信息与第二终端的第二密钥的标识信息是否匹配;
    发送模块,用于根据所述第一结果,发送第二消息,所述第二消息包括第一密钥更新信息,所述第一密钥更新信息用于更新所述第一终端的密钥或所述第二终端的密钥。
  22. 如权利要求21所述的装置,其特征在于,所述第二密钥的标识信息对应的第二值大于所述第一密钥的标识信息对应的第一值时,所述第一密钥更新信息用于更新所述第一终端的密钥。
  23. 如权利要求22所述的装置,其特征在于,所述第一密钥更新信息包括所述第二密钥的标识信息、所述第一终端的标识、不小于所述第二值对应的第一更新密钥以及所述第一更新密钥的标识信息。
  24. 如权利要求23所述的装置,其特征在于,所述处理模块还用于:
    采用所述第一终端的证书的公钥对所述第一更新密钥进行加密。
  25. 如权利要求23所述的装置,其特征在于,所述第一更新密钥信息还包括临时公钥;
    所述处理模块还用于:
    随机生成临时私钥和所述临时公钥;使用所述临时私钥和所述第一终端的证书的公钥生成第一临时加密密钥;以及,采用所述第一临时加密密钥对所述第一更新密钥进行加密。
  26. 如权利要求22至25中任一项所述的装置,其特征在于,所述接收模块还用于:
    接收来自所述第一终端的第三消息,所述第三消息包括所述第二密钥的标识信息。
  27. 如权利要求21所述的装置,其特征在于,所述第二密钥的标识信息对应的第二值小于所述第一密钥的标识信息对应的第一值时,所述第二消息包括第二加密消息和所述第 一密钥更新信息,所述第一密钥更新信息用于更新所述第二终端的密钥。
  28. 如权利要求27所述的装置,其特征在于,所述第一密钥更新信息包括所述第二终端本地存储的任一密钥的标识信息;
    所述处理模块还用于:
    确定本地存储的密钥中是否存在与所述第一值相同的密钥;若所述本地存储的密钥中不存在与所述第一值相同的密钥,所述第二终端从所述本地存储的密钥中选择任一密钥;以及,采用所述任一密钥加密所述第二加密消息。
  29. 如权利要求27或28所述的装置,其特征在于,所述接收模块还用于:
    接收来自所述第一终端的第四消息,所述第四消息包括第二密钥更新信息,其中,所述第二密钥更新信息包括所述第一密钥的标识信息、所述第二终端的标识、不小于所述第一值对应的第二更新密钥以及所述第二更新密钥的标识信息;
    所述处理模块还用于:根据所述第二密钥更新信息,对所述第二终端的密钥进行更新。
  30. 如权利要求29所述的装置,其特征在于,所述第二更新密钥是采用所述第二终端的证书的公钥或第三临时加密密钥加密的,其中,所述第三临时加密密钥是所述第一终端使用所述第一终端随机生成的临时私钥和所述第二终端的证书的公钥生成的;
    所述处理模块还用于:
    采用所述第二终端的证书的私钥或第四临时加密密钥解密所述第二更新密钥,其中,所述第四临时加密密钥是所述第二终端使用所述第一终端随机生成的临时公钥和所述第二终端的证书的私钥生成的。
  31. 一种安全通信的装置,其特征在于,包括:
    发送模块,用于发送第一消息,所述第一消息包括第一密钥的标识信息;
    接收模块,用于接收来自第二终端的第二消息,所述第二消息是根据第一结果确定的,所述第一结果用于指示所述第一密钥的标识信息与所述第二终端的第二密钥的标识信息是否匹配,所述第二消息包括第一密钥更新信息,所述第一密钥更新信息用于更新第一终端的密钥或所述第二终端的密钥。
  32. 如权利要求31所述的装置,其特征在于,所述第二密钥的标识信息对应的第二值大于所述第一密钥的标识信息对应的第一值时,所述第一密钥更新信息用于更新所述第一终端的密钥。
  33. 如权利要求32所述的装置,其特征在于,所述第一密钥更新信息包括所述第二密钥的标识信息、所述第一终端的标识、不小于所述第二值对应的第一更新密钥以及所述第一更新密钥的标识信息。
  34. 如权利要求33所述的装置,其特征在于,所述第一更新密钥是采用所述第一终端的证书的公钥加密的;
    所述装置还包括:处理模块,用于采用所述第一终端的证书的私钥对所述第一更新密钥进行解密。
  35. 如权利要求33所述的装置,其特征在于,所述第一更新密钥是采用第一临时加密密钥加密的,所述第一临时加密密钥是所述第二终端使用所述第二终端随机生成的临时私钥和所述第一终端的证书的公钥生成的,所述第一密钥更新信息还包括临时公钥;
    所述装置还包括:处理模块,用于使用所述临时公钥和所述第一终端的证书的私钥生 成第二临时加密密钥;以及,采用所述第二临时加密密钥对所述第一更新密钥进行解密。
  36. 如权利要求34或35所述的装置,其特征在于,所述处理模块还用于:
    根据所述第一密钥更新信息,对所述第一终端的密钥进行更新;
    所述发送模块还用于:发送第三消息,所述第三消息包括所述第二密钥的标识信息。
  37. 如权利要求31所述的装置,其特征在于,所述第二密钥的标识信息对应的第二值小于所述第一密钥的标识信息对应的第一值时,所述第一密钥更新信息用于更新所述第二终端的密钥。
  38. 如权利要求37所述的装置,其特征在于,所述第一密钥更新信息包括所述第二终端本地存储的任一密钥的标识信息。
  39. 如权利要求38所述的装置,其特征在于,所述装置还包括:
    处理模块,用于获得第二结果,所述第二结果为所述第一密钥的标识信息对应的第一值大于所述任一密钥的标识信息对应的第三值;
    所述发送模块还用于:发送第四消息,所述第四消息包括第二密钥更新信息,所述第二密钥更新信息用于更新所述第二终端的密钥,所述第二密钥更新信息包括所述第一密钥的标识信息、所述第二终端的标识、不小于所述第一值对应的第二更新密钥以及所述第二更新密钥的标识信息。
  40. 如权利要求39所述的装置,其特征在于,所述第二更新密钥是采用所述第二终端的证书的公钥或第三临时加密密钥加密的,其中,所述第三临时加密密钥是所述第一终端使用所述第一终端随机生成的临时私钥和所述第二终端的证书的公钥生成的。
  41. 一种通信系统,其特征在于,包括权利要求21至30中任一项所述的装置和权利要求31至40中任一项所述的装置。
  42. 一种安全通信的装置,其特征在于,包括:处理器,所述处理器与存储器耦合,所述存储器用于存储计算机程序,当所述处理器调用所述计算机程序时,使得所述装置执行如权利要求1至10中任一项所述的方法,或执行如权利要求11至20中任一项所述的方法。
  43. 一种计算机程序产品,所述计算机程序产品中包括计算机程序代码,其特征在于,当所述计算机程序代码在计算机上运行时,使得计算机实现如权利要求1至10中任一项所述的方法,或实现如权利要求11至20中任一项所述的方法。
  44. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序,当所述计算机程序在一个或多个处理器上运行时,实现如权利要求1至10中任一项所述的方法,或用于实现如权利要求11至20中任一项所述的方法。
PCT/CN2021/079720 2021-03-09 2021-03-09 安全通信的方法和装置 WO2022188027A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202180000454.7A CN113170291B (zh) 2021-03-09 2021-03-09 安全通信的方法和装置
PCT/CN2021/079720 WO2022188027A1 (zh) 2021-03-09 2021-03-09 安全通信的方法和装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/079720 WO2022188027A1 (zh) 2021-03-09 2021-03-09 安全通信的方法和装置

Publications (1)

Publication Number Publication Date
WO2022188027A1 true WO2022188027A1 (zh) 2022-09-15

Family

ID=76876015

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/079720 WO2022188027A1 (zh) 2021-03-09 2021-03-09 安全通信的方法和装置

Country Status (2)

Country Link
CN (1) CN113170291B (zh)
WO (1) WO2022188027A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113656822A (zh) * 2021-08-31 2021-11-16 成都卫士通信息产业股份有限公司 一种多媒体会议密钥管理方法、装置、设备及存储介质
CN114024724B (zh) * 2021-10-25 2023-06-13 四川启睿克科技有限公司 一种基于物联网的对称密钥动态生成方法
CN115037546B (zh) * 2022-06-20 2024-04-26 深圳海星智驾科技有限公司 密钥泄露的判定方法和装置、电子设备和存储介质
CN117675235A (zh) * 2022-08-22 2024-03-08 中国移动通信有限公司研究院 一种保密通信处理方法、第一终端及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103326853A (zh) * 2012-03-22 2013-09-25 中兴通讯股份有限公司 一种密钥更新的方法及装置
CN106789055A (zh) * 2017-01-20 2017-05-31 兴唐通信科技有限公司 单向流程前向安全技术实现方法
CN109802827A (zh) * 2018-12-19 2019-05-24 中国长城科技集团股份有限公司 密钥更新方法及密钥更新系统

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6556955B2 (ja) * 2016-07-19 2019-08-07 日本電信電話株式会社 通信端末、サーバ装置、プログラム
CN106658493B (zh) * 2016-10-17 2019-12-06 东软集团股份有限公司 密钥管理方法、装置和系统
CN108494722A (zh) * 2018-01-23 2018-09-04 国网浙江省电力有限公司电力科学研究院 智能变电站通信报文完整性保护方法
CN112449326A (zh) * 2019-08-30 2021-03-05 华为技术有限公司 一种通信、更新密钥的方法及装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103326853A (zh) * 2012-03-22 2013-09-25 中兴通讯股份有限公司 一种密钥更新的方法及装置
CN106789055A (zh) * 2017-01-20 2017-05-31 兴唐通信科技有限公司 单向流程前向安全技术实现方法
CN109802827A (zh) * 2018-12-19 2019-05-24 中国长城科技集团股份有限公司 密钥更新方法及密钥更新系统

Also Published As

Publication number Publication date
CN113170291A (zh) 2021-07-23
CN113170291B (zh) 2023-07-11

Similar Documents

Publication Publication Date Title
WO2022188027A1 (zh) 安全通信的方法和装置
EP4254861A1 (en) Secure access method and device
US10567428B2 (en) Secure wireless ranging
US10250578B2 (en) Internet key exchange (IKE) for secure association between devices
KR20130111165A (ko) 블루투스 저 에너지 프라이버시
EP4068675A1 (en) Method and device for certificate application
WO2022110083A1 (zh) 一种通信方法及装置
CN112822177B (zh) 数据传输方法、装置、设备和存储介质
CN114762290A (zh) 对数字密钥进行管理的方法和电子装置
CN105407109A (zh) 一种蓝牙设备间数据安全传输方法
CN112399369B (zh) 一种秘钥更新方法及通信装置
EP4362521A1 (en) Method for establishing secure vehicle communication, and vehicle, terminal and system
CN114095277A (zh) 配电网安全通信方法、安全接入设备及可读存储介质
CN111836260B (zh) 一种认证信息处理方法、终端和网络设备
KR20180012658A (ko) 근접-기반 서비스 직접 통신에 기반하여 v2x 서비스를 제공하는 장치 및 방법
WO2018076242A1 (zh) 一种信息传输方法及设备
US20220368522A1 (en) Bluetooth peripheral and central apparatuses and verification method
CN113455032B (zh) 通信方法、通信装置及计算机可读介质
CN113228722B (zh) 一种配对方法及装置
EP4184857A1 (en) Bluetooth node pairing method and related apparatus
CN113455024B (zh) 一种密钥获取方法及相关装置
CN117061539A (zh) 一种基于区块链的业务处理方法及装置
Sanchez Carmona Pedestrian to Vehicle Communication: A Safe and Private Solution Proposal
CN116863565A (zh) 基于密钥的智能门锁控制方法及装置
CN116305018A (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: 21929509

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21929509

Country of ref document: EP

Kind code of ref document: A1