Key exchange method, device, and electronic device

End-to-end key exchange is realized through communication servers and SMS exchanges, which solves the problem of insufficient key exchange security in the existing technology, improves communication security, and avoids the risk of a single centralized service being breached.

CN114173328BActive Publication Date: 2024-09-03CHINA TELECOM CORP LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202111487530.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-06
Publication Date
2024-09-03
Estimated Expiration
2041-12-06

Smart Images

  • Figure CN114173328B
    Figure CN114173328B
Patent Text Reader

Abstract

The present application provides a key exchange method, device, and electronic device, the method comprising: sending an initial session request to a communication server, so that the communication server sends an initial session request to a target terminal, and receives basic information returned by the target terminal for the initial session request; sending a text message request to the target terminal based on the text message address, so that the target terminal generates a first key according to the text message request and the identifier of the target terminal; receiving a notification message returned by the target terminal for the text message request, and generating a second key identical to the first key according to the basic information and the text message request; and performing a public key exchange between the initiating terminal and the target terminal according to the second key and the first key. The technical solution of the embodiment of the present application completes the information transmission of the key exchange process through the communication server and text message communication, which can effectively avoid the security risks caused by the breach of a single centralized service, and the key exchange is more secure, thereby effectively ensuring end-to-end secure communication.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of mobile communication technology, and in particular to a key exchange method, device, and electronic device. Background Art

[0002] End-to-end is the foundation of network communication, and in some communication scenarios, the security of end-to-end communication needs to be strictly guaranteed, such as in pan-communication scenarios (corporate office, personal privacy protection, core confidentiality protection, etc.) with extremely high requirements for information security and privacy, in scenarios where the credibility of public networks (public WIFI, etc.) is questionable, and in scenarios where the security and credibility of a single center (telecom operator or service provider) is questionable. If the security of end-to-end communication cannot be guaranteed, it will cause the leakage of user privacy, corporate information and other data during communication, which is likely to cause huge losses to the communication end side.

[0003] End-to-end communication security can rely on encryption, but traditional end-to-end encryption schemes are based on fully trusted certificate authorities (CAs) or require the end side to unconditionally trust the service provider during the key exchange phase, i.e., the key exchange phase is centralized. Therefore, existing end-to-end encryption schemes cannot completely avoid issues such as CA and service provider credibility, man-in-the-middle attacks, and network and service-side security, making it difficult to guarantee information security. Summary of the invention

[0004] To solve the above technical problems, the embodiments of the present application provide a key exchange method and device, and an electronic device, which realize end-to-end key exchange through a communication server and SMS communication, thereby improving the security of key exchange.

[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0006] According to one aspect of an embodiment of the present application, a key exchange method is provided, which is applied to an initiating terminal, and the method includes: sending an initial session request to a communication server, so that the communication server sends the initial session request to a target terminal, and receiving basic information returned by the target terminal for the initial session request, the basic information including an SMS address and an identifier of the target terminal; sending an SMS request to the target terminal based on the SMS address, so that the target terminal generates a first key according to the SMS request and the identifier of the target terminal; receiving a notification message returned by the target terminal for the SMS request, and generating a second key that is the same as the first key according to the basic information and the SMS request; and exchanging public keys between the initiating terminal and the target terminal according to the second key and the first key.

[0007] In one embodiment, the SMS request includes a session identifier and a random number, and the first key is generated by the target terminal according to the session identifier, the random number, and the identifier of the target terminal.

[0008] In one embodiment, the exchanging of public keys between the initiating terminal and the target terminal according to the second key and the first key includes:

[0009] Encrypting the second preset public key by using the target encryption algorithm and the second key to obtain a second ciphertext, and sending the second ciphertext to the target terminal, so that the target terminal decrypts the second ciphertext by using the target encryption algorithm and the first key to obtain the second preset public key;

[0010] Obtain a first ciphertext sent by the target terminal, decrypt the first ciphertext using the target encryption algorithm and the second key to obtain a first preset public key of the target terminal, wherein the first ciphertext is obtained by encrypting the first preset public key using the target encryption algorithm and the first key.

[0011] In one embodiment, before encrypting the second preset public key by using the target encryption algorithm and the second key to obtain a second ciphertext, and sending the second ciphertext to the target terminal so that the target terminal decrypts the second ciphertext by using the target encryption algorithm and the first key to obtain the second preset public key, the method further includes:

[0012] Acquire a set of encryption algorithms supported by the target terminal from the basic information;

[0013] The target encryption algorithm is selected from the encryption algorithm set, and the target encryption algorithm is sent to the target terminal through the SMS request.

[0014] In one embodiment, the exchanging of public keys between the initiating terminal and the target terminal according to the second key and the first key includes:

[0015] generating a second asymmetric key pair, the second asymmetric key pair comprising a second target public key;

[0016] Encrypting the second target public key by using the target encryption algorithm and the second key to obtain a second target ciphertext, and sending the second target ciphertext to the target terminal, so that the target terminal decrypts the second target ciphertext by using the target encryption algorithm and the first key to obtain the second target public key;

[0017] Obtain a first target ciphertext sent by the target terminal, and decrypt the first target ciphertext using the target encryption algorithm and the second key to obtain a first target public key of the target terminal, wherein the first target ciphertext is obtained by encrypting the first target public key by the target terminal using the target encryption algorithm and the first key, and the first target public key is a public key in a first asymmetric key pair generated by the target terminal.

[0018] In one embodiment, after performing the public key exchange between the initiating terminal and the target terminal according to the second key and the first key, the method further includes:

[0019] Encrypting the first data to be transmitted by using a first target public key, and sending the encrypted data to be transmitted to the target terminal, so that the target terminal decrypts the encrypted data to be transmitted by using a first target private key to obtain the first data to be transmitted, wherein the first target public key is a public key in a first asymmetric key pair pre-generated by the target terminal, and the first target private key is a private key in the first asymmetric key pair; or,

[0020] Receive the encrypted second data to be transmitted sent by the target terminal, decrypt the encrypted second data to be transmitted by using the second target private key to obtain the second data to be transmitted, wherein the encrypted second data to be transmitted is obtained by the target terminal encrypting the data to be transmitted by using the second target public key, the second target private key is a private key in a pre-generated second asymmetric key pair, and the second target public key is a public key in a pre-generated second asymmetric key pair.

[0021] According to one aspect of an embodiment of the present application, a key exchange method is provided, which is applied to a target terminal, and the method includes: sending basic information to an initiating terminal in response to an initial session request, the initial session request being sent by the initiating terminal to a communication server and forwarded based on the communication server, the basic information including a text message address and an identifier; receiving a text message request sent by the initiating terminal based on the text message address, and generating a first key based on the text message request and the identifier; after generating the first key, sending a notification to the initiating terminal in response to the text message request, so that the initiating terminal generates a second key that is the same as the first key based on the basic information and the text message request; and exchanging public keys between the target terminal and the initiating terminal based on the second key and the first key.

[0022] According to one aspect of an embodiment of the present application, a key exchange device is provided, which is applied to an initiating terminal, and the device includes: a first initial module, configured to send an initial session request to a communication server, so that the communication server sends the initial session request to a target terminal, and receives basic information returned by the target terminal in response to the initial session request, wherein the basic information includes an SMS address and an identifier of the target terminal; a first key generation module, configured to send an SMS request to the target terminal based on the SMS address, so that the target terminal generates a first key according to the SMS request and the identifier of the target terminal; a second key generation module, configured to receive a notification message returned by the target terminal in response to the SMS request, and generate a second key identical to the first key according to the basic information and the SMS request; and a first exchange module, configured to perform a public key exchange between the initiating terminal and the target terminal according to the second key and the first key.

[0023] According to one aspect of an embodiment of the present application, a key exchange device is provided, which is applied to a target terminal, and the device includes: a second initial module, configured to send basic information to an initiating terminal in response to an initial session request, the initial session request is sent by the initiating terminal to a communication server and forwarded based on the communication server, and the basic information includes a text message address and an identifier; a first key acquisition module, configured to receive a text message request sent by the initiating terminal based on the text message address, and generate a first key according to the text message request and the identifier; a second key acquisition module, configured to send a notification to the initiating terminal in response to the text message request after generating the first key, so that the initiating terminal generates a second key that is the same as the first key according to the basic information and the text message request; a second exchange module, configured to exchange public keys between the target terminal and the initiating terminal according to the second key and the first key.

[0024] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising one or more processors; a storage device for storing one or more computer programs, wherein when the one or more computer programs are executed by the one or more processors, the electronic device implements the key exchange method as described above.

[0025] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the key exchange method as described above.

[0026] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the key exchange method provided in the above various optional embodiments.

[0027] In the technical solution provided in the embodiments of the present application, the information transmission of the key exchange process is completed through the communication server and SMS communication, which can effectively avoid the security risks caused by the compromise of a single centralized service. The key exchange is more secure, thereby effectively ensuring end-to-end secure communication.

[0028] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0030] Figure 1 It is a schematic diagram of an implementation environment involved in this application;

[0031] Figure 2 is a flowchart of a key exchange method shown in an exemplary embodiment of the present application;

[0032] Figure 3 yes Figure 2 A flow chart of step S270 in the illustrated embodiment in an exemplary embodiment;

[0033] Figure 4 is a flowchart of a key exchange method shown in another exemplary embodiment of the present application;

[0034] Figure 5 yes Figure 2 A flowchart of step S270 in the illustrated embodiment in another exemplary embodiment;

[0035] Figure 6 is a flowchart of a key exchange method shown in another exemplary embodiment of the present application;

[0036] Figure 7 is a flowchart of a key exchange method shown in another exemplary embodiment of the present application;

[0037] Figure 8 is a structural schematic diagram of a key exchange device shown in an exemplary embodiment of the present application;

[0038] Fig. 9 is a structural schematic diagram of a key exchange device shown in another exemplary embodiment of the present application;

[0039] Fig.10 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0040] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0041] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0042] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0043] It should also be noted that the "multiple" mentioned in this application refers to two or more than two. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship.

[0044] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0045] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0046] The key exchange method and device, electronic device, and storage medium proposed in the embodiments of the present application involve artificial intelligence technology and machine learning technology, and these embodiments will be described in detail below.

[0047] First see Figure 1 , Figure 1 1 is a schematic diagram of an implementation environment involved in the present application. The implementation environment includes an initiating terminal 101, a target terminal 103, a communication server 200 and a base station 300. Both the initiating terminal 101 and the target terminal 103 can communicate with the communication server 200 through a wired or wireless network, and both the initiating terminal 101 and the target terminal 103 can also communicate with the base station 300 through a wired or wireless network.

[0048] In this embodiment, the initiating terminal 101 and the target terminal 103 transmit messages through the communication server 200 or the base station 300. The initiating terminal 101 and the target terminal 103 first exchange basic information of both parties through the communication server 200, and then the initiating terminal 101 and the target terminal 103 complete key negotiation through the base station 300. Finally, the initiating terminal 101 and the target terminal 103 complete key exchange again through the communication server 200. After the initiating terminal 101 and the target terminal 103 complete the key exchange, the information between the initiating terminal 101 and the target terminal 103 can be transmitted through the exchanged key.

[0049] Exemplarily, the initiating terminal 101 sends an initial session request to the target terminal 103 through the communication server 200. After receiving the initial session request, the target terminal 103 transmits its basic information through the communication server 200, and the basic information includes the SMS address and identifier of the target terminal 103; then, the initiating terminal 101 sends an SMS request to the target terminal 103 through the base station 300 according to the SMS address, the target terminal 103 generates a first key according to the SMS request and the identifier of the target terminal 103, and after generating the first key, sends a notification message to the initiating terminal 101 through the base station 300, the initiating terminal 101 then generates a second key that is the same as the first key according to the basic information and the SMS request, and then the initiating terminal 101 and the target terminal 103 complete the public key exchange between them through the communication server 200 according to the second key and the first key.

[0050] Among them, the initiating terminal 101 and the target terminal 103 can be any electronic device that can realize data visualization, such as a smart phone, a tablet, a laptop, a computer, etc., and there is no restriction here. The server end 200 can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, wherein multiple servers can form a blockchain, and the server is a node on the blockchain. The communication server 200 can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network, content distribution network) and big data and artificial intelligence platforms, and there is no restriction here; the base station 300 can be a base station of any operator, used for the transmission of SMS messages.

[0051] Figure 2 FIG. 1 is a flow chart showing a key exchange method according to an exemplary embodiment. Figure 2 As shown, in an exemplary embodiment, the method is applied to an initiating terminal, and the method may include steps S210 to S270, which are described in detail as follows:

[0052] Step S210: sending an initial session request to the communication server, so that the communication server sends the initial session request to the target terminal and receives basic information returned by the target terminal in response to the initial session request.

[0053] In this embodiment, before the initiating terminal and the target terminal transmit information, in order to ensure the security of information transmission, a key exchange is performed first. Specifically, the initiating terminal will first initiate an initial session request to the communication server, and the communication server will forward the initial session request to the target terminal. The initial session request includes a session identifier generated by the initiating terminal (i.e., Session-ID, a globally unique identifier of the initiating terminal during the key exchange process), the identity information of the target terminal, the identity information of the initiating terminal, and the identifier of the initiating terminal.

[0054] Among them, the identity information of the target terminal and the identity information of the initiating terminal are used by the communication server to identify the identity information of the target terminal and the initiating terminal, which facilitates the transmission of messages between the target terminal and the initiating terminal. The session identifier can be used to query the session content, messages, etc. of the initiating terminal through the session identifier during the entire key exchange process.

[0055] After receiving the initial session request, the target terminal will save the content of the initial session request and return the basic information of the target terminal to the communication server, and the communication server will forward the basic information to the initiating terminal; the basic information includes the identification of the target terminal, the SMS address of the target terminal (the SMS address is used for subsequent SMS reception, which can be a mobile phone number, Bluetooth information, etc.), and the set of encryption algorithms supported by the target terminal. The initiating terminal and the target terminal will subsequently negotiate an encryption algorithm in the encryption algorithm set for the key exchange process.

[0056] Step S230: Sending a text message request to the target terminal based on the text message address, so that the target terminal generates a first key according to the text message request and the identifier of the target terminal.

[0057] In this embodiment, after receiving the basic information of the target terminal, the initiating terminal sends a text message request to the target terminal through a base station according to the text message address in the basic information. The base station can be a base station of any operator. The text message request includes a session identifier, a random number, and a target encryption algorithm selected by the initiating terminal from the encryption algorithm set. The random number is a large random prime number.

[0058] After receiving the SMS request, the target terminal searches the stored information for the identifier of the initiating terminal (the target terminal saves the content of the initial session request in step S210) and its own identifier according to the session identifier, and then generates a first key according to a pre-established key rule using the identifier of the initiating terminal, the identifier of the target terminal and the random number. The key rule may be obtained through negotiation between the initiating terminal and the target terminal during the transmission of the initial session request and the basic information, or may be obtained by pre-setting the same key rule for the initiating terminal and the target terminal. For example, in one embodiment, the key rule for generating the first key is: Key1=SHA256(A-IP+B-IP+Nonce), where key1 is the first key, SHA256 is a hash algorithm with a hash value length of 256 bits, A-IP is the identifier of the initiating terminal, B-IP is the identifier of the target terminal, and Nonce is the random number in the SMS request. Of course, in other embodiments, the first key may be obtained by other rules, such as different hash algorithms, different combinations of terminals and random numbers, etc., which are not specifically limited here.

[0059] In this embodiment, the SMS request can be composed of a valid character set, that is, half-width numbers, uppercase and lowercase English letters, and a vertical line separator "|". For example, the structure of a SMS request is "IKE|[Session-ID]|[Nonce]|[SelectedAlgorithm]", where "IKE" is the fixed part of the key exchange protocol, "[Session-ID]" is the session identifier, "[Nonce]" is a random number, and "[SelectedAlgorithm]" is a random number. Algorithm]" is the target encryption algorithm. For example, in one embodiment, the initiating terminal sends a text message request to the target terminal: "IKE|14A6D4E4450B5823B55D214975D47CA3|634635948813411|AES256". It can be seen that "14A6D4E4450B5823B55D214975D47CA3" is the session identifier, "634635948813411" is a random number, and "AES256" is the target encryption algorithm.

[0060] Step S250: receiving a notification message returned by the target terminal in response to the SMS request, and generating a second key that is the same as the first key according to the basic information and the SMS request.

[0061] In this step, after generating the first key, the target terminal returns a notification message to the base station, and the base station sends the notification message to the initiating terminal, informing the initiating terminal that the session with the target terminal is successfully established. At this time, the initiating terminal generates a second key through the same key rule. For example, in one embodiment, the second key is generated through the SHA256 (A-IP + B-IP + Nonce) key rule proposed in step S230. Specifically, the initiating terminal can obtain the identifier of the target terminal from the basic information in step S210, and obtain the identifier of the initiating terminal in the initial session request or session identifier, and obtain the random number in the SMS request, and then generate a second key that is the same as the first key according to the key rule using the identifier of the initiating terminal, the identifier of the target terminal and the random number.

[0062] In this embodiment, by generating a second key that is identical to the first key in the target terminal, encryption and decryption of the subsequent exchange of intermediate public keys between the initiating terminal and the target terminal are facilitated.

[0063] Step S270: performing public key exchange between the initiating terminal and the target terminal according to the second key and the first key.

[0064] In this embodiment, after the initiating terminal and the target terminal generate the first key and the second key respectively, the public key exchange between the initiating terminal and the target terminal can be completed through the first key and the second key.

[0065] For example, in one embodiment, the initiating terminal encrypts the public key of the initiating terminal through the encryption algorithm and the second key selected in the SMS request to obtain a second ciphertext, and then sends the second ciphertext to the target terminal through the communication server. The target terminal can decrypt the second ciphertext through the encryption algorithm and the first key selected in the SMS request to obtain the public key of the initiating terminal.

[0066] Similarly, the target terminal encrypts the public key of the target terminal through the target encryption algorithm and the second key selected in the SMS request to obtain a first ciphertext, and then sends the first ciphertext to the initiating terminal through the communication server. The initiating terminal can decrypt the first ciphertext through the target encryption algorithm and the second key selected in the SMS request to obtain the public key of the target terminal.

[0067] In this embodiment, the communication server and the base station are used as two centralized services in the key exchange process, and can only obtain part of the original basis information for key negotiation between the initiating terminal and the target terminal. No CA intervention is required, which can effectively avoid the security risks caused by the compromise of a single centralized service. As long as the two centers are not controlled by the same attacker at the same time, even if the center on either side is untrustworthy (that is, the attacker has mastered the end-to-end key exchange information of one center), end-to-end secure communication can still be guaranteed, and the security of key exchange is higher.

[0068] Figure 3 yes Figure 2 The flowchart of step S270 in the embodiment shown is in an exemplary embodiment. Figure 3 As shown, in an exemplary embodiment, the process of exchanging the public key between the initiating terminal and the target terminal according to the second key and the first key may include steps S310 to S330, which are described in detail as follows:

[0069] Step S310: Encrypt the second preset public key using the target encryption algorithm and the second key to obtain a second ciphertext, and send the second ciphertext to the target terminal, so that the target terminal decrypts the second ciphertext using the target encryption algorithm and the first key to obtain the second preset public key.

[0070] The target encryption algorithm in this implementation is the encryption algorithm in the SMS request sent by the initiating terminal, that is, the encryption algorithm selected from the encryption algorithm set. The encryption algorithm can be a symmetric encryption algorithm or other encryption algorithms. No specific restrictions are made here. For example, in one embodiment, the target encryption algorithm is a symmetric encryption algorithm. In order to simplify the key generation process and the SMS message format, the grouping mode in the symmetric encryption algorithm can be set to be fixed to ECB (an encryption mode) and the padding mode can be fixed to no padding (a data padding mode, which is responsible for determining whether the data can be completely grouped. If it cannot be completely grouped, an error will be reported or an exception will be thrown).

[0071] The second preset public key in this embodiment is the public key that already exists in the initiating terminal itself. After encrypting the second preset public key into a second ciphertext through the target encryption algorithm and the second key, the initiating terminal sends the second ciphertext to the communication server, and the communication server forwards the second ciphertext to the target terminal. The target terminal then decrypts the second ciphertext through the target encryption algorithm and the first key in the SMS request to obtain the second preset public key of the initiating terminal.

[0072] Step S330: Obtain a first ciphertext sent by the target terminal, and decrypt the first ciphertext using a target encryption algorithm and a second key to obtain a first preset public key of the target terminal.

[0073] In this embodiment, after obtaining the second preset public key, the target terminal also encrypts the first preset public key using the target encryption algorithm and the first key to obtain a first ciphertext, and forwards the first ciphertext to the initiating terminal through the communication server. The first preset public key is the public key of the target terminal itself.

[0074] After obtaining the first ciphertext, the initiating terminal also decrypts the first ciphertext using the target encryption algorithm and the second key, thereby obtaining the first preset public key of the target terminal.

[0075] At this point, the initiating terminal and the target terminal complete the public key exchange, and subsequently the initiating terminal and the target terminal can complete information transmission through the exchanged public key. For example, the initiating terminal encrypts the message to be transmitted through the first preset public key, and then sends the encrypted information to the target terminal. The target terminal can decrypt the encrypted information through its own private key to obtain the message to be transmitted, or the target terminal encrypts the message to be transmitted through the second preset public key, and then sends the encrypted information to the initiating terminal. The initiating terminal can decrypt the encrypted information through its own private key to obtain the message to be transmitted. Of course, the above example is for encrypted transmission of the message to be transmitted through asymmetric encryption. In some methods, the encryption can also be used to encrypt the message to be transmitted.

[0076] This embodiment proposes a public key exchange method between the initiating terminal and the target terminal, which can safely complete the public key exchange between the initiating terminal and the target terminal, thereby effectively ensuring subsequent end-to-end communication between the initiating terminal and the target terminal.

[0077] Figure 4 FIG. 4 is a flow chart showing a key exchange method according to another exemplary embodiment. Figure 4 As shown, in an exemplary embodiment, the method can be implemented in Figure 3 Before step S310, the method may include steps S410 to S430, which are described in detail as follows:

[0078] Step S410: Obtain the encryption algorithm set supported by the target terminal from the basic information.

[0079] In this embodiment, before exchanging public keys, the initiating terminal and the target terminal need to negotiate an encryption algorithm, and then encrypt their respective public keys using the encryption algorithm for exchange.

[0080] Specifically, the encryption algorithm set supported by the target terminal can be obtained from the basic information returned by the communication server in response to the initial session request by the target terminal, and then an encryption algorithm can be selected from the encryption algorithm set as the encryption algorithm used jointly by the initiating terminal and the target terminal later.

[0081] Step S430: Select a target encryption algorithm from the encryption algorithm set, and send the target encryption algorithm to the target terminal via a text message request.

[0082] In this embodiment, the initiating terminal selects a target encryption algorithm from the encryption algorithm set, and the initiating terminal can subsequently encrypt the public key of the initiating terminal through the target encryption algorithm. The target encryption algorithm can be a symmetric encryption algorithm or other encryption algorithms, such as an asymmetric encryption algorithm, etc., and no specific restrictions are made here; at the same time, in order for the target terminal to decrypt the ciphertext obtained by the initiating terminal by encrypting the public key of the initiating terminal through the target encryption algorithm, the target terminal also needs to use the target encryption algorithm. Therefore, the initiating terminal can send the selected target encryption algorithm to the target terminal through the base station via a text message request, informing the target terminal to use the target encryption algorithm when decrypting the ciphertext encrypted by the public key of the initiating terminal or encrypting its own public key.

[0083] In this embodiment, a target encryption algorithm is negotiated between the initiating terminal and the target terminal through a communication server and SMS communication. The target encryption algorithm can be used to encrypt the respective public keys so that the initiating terminal and the target terminal can subsequently complete the exchange of their respective public keys. At the same time, using the communication server and SMS communication dual centers to negotiate the encryption algorithm can improve the security of communication.

[0084] Figure 5 yes Figure 2 The flowchart of step S270 in the embodiment shown is in an exemplary embodiment. Figure 5 As shown, in an exemplary embodiment, the process of exchanging the public key between the initiating terminal and the target terminal according to the second key and the first key may include steps S510 to S550, which are described in detail as follows:

[0085] Step S510: Generate a second asymmetric key pair.

[0086] In this embodiment, in order to improve the security of public key exchange and the security of subsequent data transmission, the initiating terminal can be set to generate a second asymmetric key pair, which is a one-time asymmetric key pair used by the initiating terminal, that is, the second asymmetric key pair is only used for a single key exchange process to realize a public key exchange between the initiating terminal and the target terminal and a single data transmission process to complete the data transmission between the initiating terminal and the target terminal through the exchanged public key; before another round of key exchange and data transmission, a new second asymmetric key pair is generated.

[0087] The second asymmetric key pair includes a second target public key and a second target private key.

[0088] Step S530: Encrypt the second target public key using the target encryption algorithm and the second key to obtain a second target ciphertext, and send the second target ciphertext to the target terminal, so that the target terminal decrypts the second target ciphertext using the target encryption algorithm and the first key to obtain the second target public key.

[0089] The target encryption algorithm in this embodiment is still a target encryption algorithm negotiated between the initiating terminal and the target terminal, as can be seen in Figure 4 The target encryption algorithm is obtained by the method in .

[0090] Step S550: Obtain a first target ciphertext sent by the target terminal, and decrypt the first target ciphertext using a target encryption algorithm and a second key to obtain a first target public key of the target terminal.

[0091] In this embodiment, the target terminal also generates a first asymmetric key pair, which includes a first target public key and a first target private key. The first asymmetric key pair is also only used for a one-time key exchange process to realize the public key exchange between the initiating terminal and the target terminal and a data transmission process to complete the data transmission between the initiating terminal and the target terminal through the exchanged public key.

[0092] After the target terminal generates the first asymmetric key pair, the target terminal encrypts the first target public key into a first target ciphertext through the target encryption algorithm, and then sends the first target ciphertext to the initiating terminal through the communication server. The initiating terminal decrypts the first target ciphertext through the target encryption algorithm and the second key to obtain the first target public key of the target terminal.

[0093] After the initiating terminal and the target terminal respectively obtain the other party's target public key, they can transmit data through the other party's target public key and target private key. For example, if the initiating terminal encrypts data through the first target public key and transmits it to the target terminal, the target terminal can decrypt the encrypted data through the first target private key. Similarly, if the target terminal encrypts data through the second target public key and transmits it to the initiating terminal, the initiating terminal can decrypt the encrypted data through the second target private key.

[0094] In this embodiment, a one-time asymmetric key pair is generated by the initiating terminal and the target terminal respectively, and a public key exchange and data transmission are completed through the one-time asymmetric key pair. Moreover, the one-time asymmetric key pair for each public key exchange and data transmission is different, which greatly improves the security of public key exchange and data transmission.

[0095] Figure 6 is a flow chart showing a key exchange method according to another exemplary embodiment. Figure 6 The embodiments shown in the figure can be implemented in Figure 2 After step S270 in Figure 6 As shown, in an exemplary embodiment, the method may include step S610 and step S630, which are described in detail as follows:

[0096] Step S610: encrypt the first data to be transmitted using the first target public key, and send the encrypted first data to be transmitted to the target terminal, so that the target terminal decrypts the encrypted first data to be transmitted using the first target private key to obtain the data to be transmitted.

[0097] In this embodiment, the first target public key is a public key in the first asymmetric key pair pre-generated by the target terminal, and the first target private key is a private key in the first asymmetric key pair. That is, all steps in this embodiment can be implemented in Figure 5 After the public key exchange is completed by the initiating terminal and the target terminal each generating a one-time asymmetric key pair.

[0098] In this embodiment, the initiating terminal obtains the first target public key of the target terminal, and the target terminal obtains the second target public key of the initiating terminal. If the initiating terminal transmits data to the target terminal, the initiating terminal can encrypt the first data to be transmitted by using the first target public key, and then send the encrypted first data to be transmitted to the target terminal. The target terminal can then decrypt the encrypted first data to be transmitted by using the first target private key to obtain the first data to be transmitted that the initiating terminal actually wants to transmit to the target terminal.

[0099] Step S630: receiving the encrypted second data to be transmitted sent by the target terminal, and decrypting the encrypted second data to be transmitted using the second target private key to obtain the second data to be transmitted.

[0100] In this embodiment, the second target private key is a private key in a pre-generated second asymmetric key pair, and the second target public key is a public key in a pre-generated second asymmetric key pair.

[0101] In this embodiment, when the target terminal transmits data to the initiating terminal, the target terminal can encrypt the second data to be transmitted by using the second target public key, and then send the encrypted second data to be transmitted to the initiating terminal. The initiating terminal can then decrypt the encrypted first data to be transmitted by using the second target private key to obtain the second data to be transmitted that the target terminal actually wants to transmit to the initiating terminal.

[0102] In this embodiment, step S610 and step S630 may be implemented simultaneously or separately, and the order of implementing step S610 and step S630 is not specifically limited, for example, step S610 may be implemented first or before step S630.

[0103] This embodiment provides a method for data transmission by having an initiating terminal and a target terminal each generate a one-time asymmetric key pair. Since a one-time asymmetric key pair is used, the asymmetric key pair used each time data is transmitted is different, which can greatly improve the security of end-to-end communication between the initiating terminal and the target terminal.

[0104] Figure 7 FIG. 4 is a flow chart showing a key exchange method according to another exemplary embodiment. Figure 7 As shown, in an exemplary embodiment, the method is applied to a target terminal, and the method may specifically include step S710 and step S770, which are described in detail as follows:

[0105] Step S710: Send basic information to the initiating terminal in response to the initial session request.

[0106] In this embodiment, after receiving the initial session request sent by the initiating terminal and forwarded to the target terminal through the communication server, the target terminal sends basic information to the initiating terminal, and the basic information is forwarded to the initiating terminal through the communication server.

[0107] In this embodiment, the initial session request includes the session identifier generated by the initiating terminal, the identity information of the target terminal, the identity information of the initiating terminal, and the identifier of the initiating terminal; the basic information includes the identifier of the target terminal, the SMS address of the target terminal, and the encryption algorithm set supported by the target terminal. That is, in this step, the information exchange between the initiating terminal and the target terminal is completed.

[0108] Step S730: receiving a text message request sent by the initiating terminal based on the text message address, and generating a first key according to the text message request and the identifier.

[0109] In this embodiment, after receiving the basic information of the target terminal, the initiating terminal sends a text message request to the target terminal through the base station according to the text message address in the basic information. The text message request includes a session identifier, a random number, and an encryption algorithm selected by the initiating terminal from the encryption algorithm set. The random number is a large random prime number.

[0110] After receiving the SMS request, the target terminal searches the stored information for the initiating terminal identifier and its own identifier according to the session identifier, and then generates a first key according to a pre-defined key rule using the initiating terminal identifier, the target terminal identifier and a random number.

[0111] Step S750: After the first key is generated, a notification is sent to the initiating terminal in response to the SMS request, so that the initiating terminal generates a second key that is the same as the first key according to the basic information and the SMS request.

[0112] After generating the first key, the target terminal returns a notification message to the base station, and the base station sends the notification message to the initiating terminal to inform the initiating terminal that the session with the target terminal is successfully established. The initiating terminal then generates a second key using the same key rule.

[0113] Step S770: performing public key exchange between the target terminal and the initiating terminal according to the second key and the first key.

[0114] In this embodiment, after the initiating terminal and the target terminal generate the first key and the second key respectively, the public key exchange between the initiating terminal and the target terminal can be completed through the first key and the second key.

[0115] If the initiating terminal encrypts the public key of the initiating terminal through the encryption algorithm and the second key selected in the SMS request to obtain the second ciphertext, and then sends the second ciphertext to the target terminal through the communication server, the target terminal can decrypt the second ciphertext through the encryption algorithm and the first key selected in the SMS request to obtain the public key of the initiating terminal. Using the same method, the initiating terminal can also obtain the public key of the target terminal. Of course, the above is only a proposed public key exchange method, and the public key exchange between the initiating terminal and the target terminal can also be performed through a one-time asymmetric key pair.

[0116] After the public key is exchanged between the initiating terminal and the target terminal, data transmission between the initiating terminal and the target terminal can be completed through the exchanged public key.

[0117] It should be noted that the key exchange process proposed in this embodiment is similar to Figure 2 - Figure 6 The key exchange process provided in the embodiment belongs to the same concept, and the specific method of each step has been described in Figure 2 - Figure 6The above embodiments have been described in detail and will not be described in detail here.

[0118] Similarly, the target terminal encrypts the public key of the target terminal through the encryption algorithm and the second key selected in the SMS request to obtain a first ciphertext, and then sends the first ciphertext to the initiating terminal through the communication server. The initiating terminal can decrypt the first ciphertext through the encryption algorithm and the second key selected in the SMS request to obtain the public key of the target terminal.

[0119] In this embodiment, the communication server and the base station are used as two centralized service points in the key exchange process. A single centralized service point can only obtain part of the original basis information for key negotiation between the initiating terminal and the target terminal, which can effectively avoid the security risks caused by the compromise of a single centralized service and improve the security of key exchange.

[0120] Figure 8 FIG. 1 is a schematic diagram showing a structure of a key exchange device according to an exemplary embodiment. Figure 8 As shown, in an exemplary embodiment, the key exchange device is applied to an initiating terminal, including:

[0121] The first initial module 810 is configured to send an initial session request to the communication server, so that the communication server sends the initial session request to the target terminal, and receives basic information returned by the target terminal for the initial session request, the basic information including the SMS address and identifier of the target terminal;

[0122] A first key generation module 830 is configured to send a text message request to a target terminal based on the text message address, so that the target terminal generates a first key according to the text message request and the identifier of the target terminal, the text message request includes a session identifier and a random number, and the first key is generated by the target terminal according to the session identifier, the random number, and the identifier of the target terminal;

[0123] A second key generation module 850 is configured to receive a notification message returned by the target terminal in response to the SMS request, and generate a second key that is the same as the first key according to the basic information and the SMS request;

[0124] The first exchange module 870 is configured to perform a public key exchange between the initiating terminal and the target terminal according to the second key and the first key.

[0125] In this embodiment, the key exchange device with the above structure can effectively avoid the security risks caused by the single centralized service being hacked, and improve the security of key exchange and data transmission.

[0126] In one embodiment, the first switching module 870 includes:

[0127] A second preset public key acquisition unit is configured to encrypt the second preset public key by using a target encryption algorithm and a second key to obtain a second ciphertext, and send the second ciphertext to a target terminal, so that the target terminal decrypts the second ciphertext by using the target encryption algorithm and the first key to obtain the second preset public key;

[0128] The first preset public key acquisition unit is configured to acquire a first ciphertext sent by a target terminal, decrypt the first ciphertext by a target encryption algorithm and a second key to obtain a first preset public key of the target terminal, and the first ciphertext is obtained by encrypting the first preset public key by a target encryption algorithm and a first key.

[0129] In one embodiment, the key exchange device further includes:

[0130] An encryption algorithm set acquisition module, configured to acquire an encryption algorithm set supported by a target terminal from basic information;

[0131] The target encryption algorithm acquisition module is configured to select a target encryption algorithm from the encryption algorithm set and send the target encryption algorithm to the target terminal via a text message request.

[0132] In one embodiment, the first switching module 870 includes:

[0133] A second asymmetric key pair generating unit, configured to generate a second asymmetric key pair, the second asymmetric key pair including a second target public key;

[0134] A second target public key acquisition unit is configured to encrypt the second target public key by using a target encryption algorithm and a second key to obtain a second target ciphertext, and send the second target ciphertext to a target terminal, so that the target terminal decrypts the second target ciphertext by using the target encryption algorithm and the first key to obtain the second target public key;

[0135] The first target public key acquisition unit is configured to acquire a first target ciphertext sent by a target terminal, and decrypt the first target ciphertext by using a target encryption algorithm and a second key to obtain a first target public key of the target terminal, wherein the first target ciphertext is obtained by encrypting the first target public key by the target terminal using a target encryption algorithm and a first key, and the first target public key is a public key in a first asymmetric key pair generated by the target terminal.

[0136] In one embodiment, the key exchange device further includes:

[0137] A first data transmission module is configured to encrypt the first data to be transmitted by using a first target public key, and send the encrypted first data to be transmitted to a target terminal, so that the target terminal decrypts the encrypted first data to be transmitted by using a first target private key to obtain the first data to be transmitted, wherein the first target public key is a public key in a first asymmetric key pair pre-generated by the target terminal, and the first target private key is a private key in the first asymmetric key pair; or,

[0138] The second data transmission module is configured to receive the encrypted second data to be transmitted sent by the target terminal, decrypt the encrypted second data to be transmitted by using the second target private key to obtain the second transmission data, the encrypted second data to be transmitted is obtained by the target terminal encrypting the second data to be transmitted by using the second target public key, the second target private key is a private key in the pre-generated second asymmetric key pair, and the second target public key is a public key in the pre-generated second asymmetric key pair.

[0139] Fig. 9 FIG. 1 is a schematic diagram showing the structure of a key exchange device according to another exemplary embodiment. Fig. 9 As shown, in an exemplary embodiment, the key exchange device is applied to a target terminal, including:

[0140] A second initial module 910 is configured to send basic information to the initiating terminal in response to the initial session request, wherein the initial session request is sent by the initiating terminal to the communication server and forwarded based on the communication server, and the basic information includes a short message address and an identifier;

[0141] A first key acquisition module 930, configured to receive a text message request sent by an initiating terminal based on a text message address, and generate a first key according to the text message request and an identifier;

[0142] The second key acquisition module 950 is configured to send a notification to the initiating terminal in response to the SMS request after generating the first key, so that the initiating terminal generates a second key that is the same as the first key according to the basic information and the SMS request;

[0143] The second exchange module 970 is configured to perform a public key exchange between the target terminal and the initiating terminal according to the second key and the first key.

[0144] It should be noted that the key exchange device provided in the above embodiment and the key exchange method provided in the above embodiment belong to the same concept, and the specific manner in which each module and unit performs operations has been described in detail in the method embodiment and will not be repeated here.

[0145] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the electronic device implements the key exchange method provided in the above-mentioned embodiments.

[0146] Fig.10 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.

[0147] It should be noted that Fig.10 The computer system 1600 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0148] like Fig.10 As shown, the computer system 1600 includes a central processing unit (CPU) 1601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1602 or the program loaded from the storage part 1608 to the random access memory (RAM) 1603, such as executing the method in the above embodiment. In RAM 1603, various programs and data required for system operation are also stored. CPU 1601, ROM 1602 and RAM 1603 are connected to each other through bus 1604. Input / output (I / O) interface 1605 is also connected to bus 1604.

[0149] The following components are connected to the I / O interface 1605: an input section 1606 including a keyboard, a mouse, etc.; an output section 1607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1608 including a hard disk, etc.; and a communication section 1609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1609 performs communication processing via a network such as the Internet. A drive 1610 is also connected to the I / O interface 1605 as needed. A removable medium 1611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1610 as needed so that a computer program read therefrom is installed into the storage section 1608 as needed.

[0150] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1609, and / or installed from a removable medium 1611. When the computer program is executed by a central processing unit (CPU) 1601, various functions defined in the system of the present application are executed.

[0151] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0152] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0153] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0154] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the key exchange method as described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0155] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the key exchange method provided in each of the above embodiments.

[0156] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.

Claims

1. A key exchange method, characterized in that: Applied to an initiating terminal, the method comprises: Sending an initial session request to a communication server, so that the communication server sends the initial session request to a target terminal, and receives basic information returned by the target terminal in response to the initial session request, wherein the basic information includes a short message address and an identifier of the target terminal; Sending a text message request to the target terminal based on the text message address, so that the target terminal generates a first key according to the text message request and an identifier of the target terminal; receiving a notification message returned by the target terminal in response to the SMS request, and generating a second key that is the same as the first key according to the basic information and the SMS request; Performing a public key exchange between the initiating terminal and the target terminal according to the second key and the first key; The exchanging of the public key between the initiating terminal and the target terminal according to the second key and the first key includes: Encrypting the second preset public key by using the target encryption algorithm and the second key to obtain a second ciphertext, and sending the second ciphertext to the target terminal, so that the target terminal decrypts the second ciphertext by using the target encryption algorithm and the first key to obtain the second preset public key; Obtain a first ciphertext sent by the target terminal, decrypt the first ciphertext using the target encryption algorithm and the second key to obtain a first preset public key of the target terminal, wherein the first ciphertext is obtained by encrypting the first preset public key using the target encryption algorithm and the first key.

2. The method according to claim 1, characterized in that The SMS request includes a session identifier and a random number, and the first key is generated by the target terminal according to the session identifier, the random number, and an identifier of the target terminal.

3. The method according to claim 2, characterized in that Before encrypting the second preset public key by using the target encryption algorithm and the second key to obtain a second ciphertext, and sending the second ciphertext to the target terminal so that the target terminal decrypts the second ciphertext by using the target encryption algorithm and the first key to obtain the second preset public key, the method further includes: Acquire a set of encryption algorithms supported by the target terminal from the basic information; The target encryption algorithm is selected from the encryption algorithm set, and the target encryption algorithm is sent to the target terminal through the SMS request.

4. The method according to claim 1, characterized in that The exchanging of the public key between the initiating terminal and the target terminal according to the second key and the first key includes: generating a second asymmetric key pair, the second asymmetric key pair comprising a second target public key; Encrypting the second target public key by using the target encryption algorithm and the second key to obtain a second target ciphertext, and sending the second target ciphertext to the target terminal, so that the target terminal decrypts the second target ciphertext by using the target encryption algorithm and the first key to obtain the second target public key; Obtain a first target ciphertext sent by the target terminal, and decrypt the first target ciphertext through the target encryption algorithm and the second key to obtain a first target public key of the target terminal, wherein the first target ciphertext is obtained by encrypting the first target public key by the target terminal through the target encryption algorithm and the first key, and the first target public key is a public key in a first asymmetric key pair generated by the target terminal.

5. The method according to claim 1, characterized in that After performing the public key exchange between the initiating terminal and the target terminal according to the second key and the first key, the method further includes: Encrypting the first data to be transmitted by using a first target public key, and sending the encrypted data to be transmitted to the target terminal, so that the target terminal decrypts the encrypted first data to be transmitted by using a first target private key to obtain the first data to be transmitted, wherein the first target public key is a public key in a first asymmetric key pair pre-generated by the target terminal, and the first target private key is a private key in the first asymmetric key pair; or Receive the encrypted second data to be transmitted sent by the target terminal, decrypt the encrypted second data to be transmitted by using the second target private key to obtain the second data to be transmitted, wherein the encrypted data to be transmitted is obtained by the target terminal encrypting the second data to be transmitted by using the second target public key, wherein the second target private key is a private key in a pre-generated second asymmetric key pair, and the second target public key is a public key in a pre-generated second asymmetric key pair.

6. A key exchange method, characterized in that: Applied to a target terminal, the method comprises: Sending basic information to the initiating terminal in response to the initial session request, wherein the initial session request is sent by the initiating terminal to the communication server and forwarded based on the communication server, and the basic information includes a short message address and an identifier; receiving a text message request sent by the initiating terminal based on the text message address, and generating a first key according to the text message request and the identifier; After generating the first key, sending a notification to the initiating terminal in response to the SMS request, so that the initiating terminal generates a second key that is the same as the first key according to the basic information and the SMS request; Performing a public key exchange between the target terminal and the initiating terminal according to the second key and the first key; The exchanging of the public key between the target terminal and the initiating terminal according to the second key and the first key includes: Encrypting the first preset public key by using the target encryption algorithm and the first key to obtain a first ciphertext, and sending the first ciphertext to the initiating terminal, so that the initiating terminal decrypts the first ciphertext by using the target encryption algorithm and the second key to obtain the first preset public key; Obtain a second ciphertext sent by the initiating terminal, decrypt the second ciphertext using the target encryption algorithm and the first key to obtain a second preset public key of the initiating terminal, wherein the second ciphertext is obtained by encrypting the second preset public key using the target encryption algorithm and the second key.

7. A key exchange device, characterized in that: Applied to an initiating terminal, the device comprises: A first initial module is configured to send an initial session request to a communication server, so that the communication server sends the initial session request to a target terminal, and receives basic information returned by the target terminal in response to the initial session request, wherein the basic information includes a short message address and an identifier of the target terminal; a first key generation module, configured to send a text message request to the target terminal based on the text message address, so that the target terminal generates a first key according to the text message request and an identifier of the target terminal; A second key generation module is configured to receive a notification message returned by the target terminal in response to the SMS request, and generate a second key that is the same as the first key according to the basic information and the SMS request; a first exchange module, configured to perform a public key exchange between the initiating terminal and the target terminal according to the second key and the first key; The exchanging of the public key between the initiating terminal and the target terminal according to the second key and the first key includes: Encrypting the second preset public key by using the target encryption algorithm and the second key to obtain a second ciphertext, and sending the second ciphertext to the target terminal, so that the target terminal decrypts the second ciphertext by using the target encryption algorithm and the first key to obtain the second preset public key; Obtain a first ciphertext sent by the target terminal, decrypt the first ciphertext using the target encryption algorithm and the second key to obtain a first preset public key of the target terminal, wherein the first ciphertext is obtained by encrypting the first preset public key using the target encryption algorithm and the first key.

8. A key exchange device, characterized in that: Applied to a target terminal, the device comprises: A second initial module is configured to send basic information to the initiating terminal in response to an initial session request, wherein the initial session request is sent by the initiating terminal to the communication server and forwarded based on the communication server, and the basic information includes a short message address and an identifier; A first key acquisition module, configured to receive a text message request sent by the initiating terminal based on the text message address, and generate a first key according to the text message request and the identifier; A second key acquisition module is configured to send a notification to the initiating terminal in response to the SMS request after generating the first key, so that the initiating terminal generates a second key that is the same as the first key according to the basic information and the SMS request; a second exchange module, configured to perform a public key exchange between the target terminal and the initiating terminal according to the second key and the first key; The exchanging of the public key between the target terminal and the initiating terminal according to the second key and the first key includes: Encrypting the first preset public key by using the target encryption algorithm and the first key to obtain a first ciphertext, and sending the first ciphertext to the initiating terminal, so that the initiating terminal decrypts the first ciphertext by using the target encryption algorithm and the second key to obtain the first preset public key; Obtain a second ciphertext sent by the initiating terminal, decrypt the second ciphertext using the target encryption algorithm and the first key to obtain a second preset public key of the initiating terminal, wherein the second ciphertext is obtained by encrypting the second preset public key using the target encryption algorithm and the second key.

9. An electronic device, characterized in that: include: one or more processors; A storage device, used to store one or more computer programs, when the one or more computer programs are executed by the one or more processors, enables the electronic device to implement the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Short message encrypting communication system, method and secret key center

    CN101867898A

  • Method and system for communication information transmission

    CN103259711A

  • Communication method, communication system and communication terminals

    CN104135370A

  • Text message channel based authentication system and method

    CN106878964A

  • Method and apparatus for acquiring verification information

    WO2015180689A1