Communication method, device, system and readable storage medium

By storing the server's public key in the adaptive multi-rate audio file on the mobile side and performing two-way authentication, and combining the national secret SM2 and SM4 algorithms to generate session keys, the problems of one-way authentication and easy key leakage in the communication between the mobile side and the server side are solved, achieving higher communication security and preventing man-in-the-middle attacks.

CN114331456BActive Publication Date: 2025-09-19AGRICULTURAL BANK OF CHINA
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111635273.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-09-19
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

In the existing technology, the communication security between the mobile terminal and the server is low, and there is a problem that the one-way authentication process and key information are easily obtained by attackers.

Method used

By pre-storing the server's public key in an adaptive multi-rate audio file on the mobile terminal and using the mobile terminal's private key to sign the encryption result, communication is achieved after two-way authentication, and the national encryption SM2 and SM4 algorithms are combined to generate session keys for encrypted communication.

Benefits of technology

It improves the communication security between the mobile terminal and the server, prevents man-in-the-middle attacks, and ensures the security and privacy of the communication channel after successful two-way authentication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114331456B_ABST
    Figure CN114331456B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention disclose a communication method, device, system, and readable storage medium. The communication method applied to a mobile terminal includes generating a first random number and encrypting the first random number using a public key of a server to obtain a first encryption result, wherein the public key of the server is pre-stored in an adaptive multi-rate audio file, and the adaptive multi-rate audio file is set on the mobile terminal; signing the first encryption result using a private key of the mobile terminal to obtain a first signature result; sending the first signature result to the server for authentication; receiving a second signature result sent by the server and authenticating the second signature result; and executing a communication action with the server after successful two-way authentication. This application achieves the technical effect of improving communication security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of network communication technology, and in particular, to a communication method, device, system, and readable storage medium. Background Art

[0002] With the rapid development of e-commerce and the increasing volume of online transactions, people's demand for information and information technology continues to grow. Information security has become a critical guarantee for stable system operation, customer transactions, and various e-commerce activities. At the e-commerce system level, a secure and robust operating environment is a key support for online transactions and business expansion. E-commerce systems are primarily network-based and contain a large amount of important information, including user information and transaction information, which must be transmitted over the network. Therefore, maintaining information security is a top priority for business security.

[0003] Currently, the communication security between mobile apps (applications) and servers is under great threat from hackers. Most apps on the market do not implement standardized secure communication and simply use HTTPS (Hyper Text Transfer Protocol over Secure Socket Layer) to transmit messages. The main problems with using HTTPS to transmit messages are as follows:

[0004] (1) Most apps with high security only implement one-way SSL (Security Sock Layer) authentication, that is, the mobile app authenticates the server, but the server does not authenticate the mobile app;

[0005] (2) Simply using the HTTPS protocol cannot prevent Man-in-the-Middle Attacks (MITM attacks). After a MITM attack is carried out, the attacker can obtain the plaintext messages between the app and the server;

[0006] (3) Information related to digital certificates, passwords, and keys is hard-coded in the code or directly stored in the installation package file, which cannot prevent attackers from decompiling the code to obtain information such as certificates, passwords, and keys. Summary of the Invention

[0007] The embodiments of the present invention provide a communication method, device, system and readable storage medium, which solve the technical problems in the prior art that when a mobile terminal and a server terminal communicate, there is only a one-way authentication process for the server terminal, and the key information is directly stored in the installation package file and can be easily obtained by attackers, resulting in low communication security.

[0008] In a first aspect, an embodiment of the present invention provides a communication method, applied to a mobile terminal, the communication method comprising:

[0009] generating a first random number and encrypting the first random number using a public key of a server to obtain a first encryption result, wherein the public key of the server is pre-stored in an adaptive multi-rate audio file, and the adaptive multi-rate audio file is set on the mobile terminal;

[0010] Signing the first encryption result using the private key of the mobile terminal to obtain a first signature result;

[0011] Sending the first signature result to the server for authentication;

[0012] Receiving a second signature result sent by the server, and authenticating the second signature result, wherein the second signature result is obtained by the server encrypting a second random number generated by the mobile terminal using the public key of the mobile terminal, and then signing the second encryption result using the private key of the server;

[0013] After the two-way authentication is successful, the communication action between the server and the server is performed.

[0014] In a second aspect, an embodiment of the present invention provides a communication method, applied to a server, the communication method comprising:

[0015] Generate a second random number, and encrypt the second random number using a pre-stored public key of the mobile terminal to obtain a second encryption result;

[0016] Signing the second encryption result using the server's private key to obtain a second signature result;

[0017] Sending the second signature result to the mobile terminal for authentication;

[0018] Receiving a first signature result sent by the mobile terminal and authenticating the first signature result, wherein the first signature result is obtained by the mobile terminal encrypting a first random number generated by the server terminal using the public key of the server terminal, and then signing the first encryption result using the private key of the server terminal;

[0019] After the two-way authentication is successful, the communication action with the mobile terminal is performed.

[0020] In a third aspect, an embodiment of the present invention provides a communication device, applied to a mobile terminal, the communication device comprising:

[0021] a first generating unit, configured to generate a first random number and encrypt the first random number using a public key of a server to obtain a first encryption result, wherein the public key of the server is pre-stored in an adaptive multi-rate audio file, and the adaptive multi-rate audio file is set on the mobile terminal;

[0022] A first signature unit, configured to sign the first encryption result using a private key of the mobile terminal to obtain a first signature result;

[0023] A first transmitting unit, configured to send the first signature result to the server for authentication;

[0024] a first receiving unit, configured to receive a second signature result sent by the server, and authenticate the second signature result, wherein the second signature result is obtained by the server encrypting a second random number generated by the mobile terminal using the public key of the mobile terminal, and then signing the second encryption result using the private key of the server;

[0025] The first communication unit is used to perform communication with the server after the two-way authentication is successful.

[0026] In a fourth aspect, an embodiment of the present invention provides a communication device, applied to a server, the communication device comprising:

[0027] A second generating unit, configured to generate a second random number, and encrypt the second random number using a pre-stored public key of the mobile terminal to obtain a second encryption result;

[0028] A second signature unit is configured to sign the second encryption result using a private key of the server to obtain a second signature result;

[0029] A second transmitting unit, configured to send the second signature result to the mobile terminal for authentication;

[0030] a second receiving unit, configured to receive a first signature result sent by the mobile terminal and authenticate the first signature result, wherein the first signature result is obtained by the mobile terminal encrypting a first random number generated by the server terminal using the public key of the server terminal, and then signing the first encryption result using the private key of the server terminal;

[0031] The second communication unit is used to perform a communication action with the mobile terminal after the two-way authentication is successful.

[0032] In a fifth aspect, an embodiment of the present invention provides a communication system, which includes a mobile terminal in any communication method according to the first aspect of the embodiment of the present invention, and a server terminal in any communication method according to the second aspect of the embodiment of the present invention.

[0033] In the sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, it implements any communication method applied to a mobile terminal as described in the first aspect of the embodiment of the present invention, or implements any communication method applied to a server terminal as described in the second aspect of the embodiment of the present invention.

[0034] The embodiment of the present invention discloses a communication method, device, system and readable storage medium. The communication method applied to a mobile terminal includes generating a first random number and encrypting the first random number using a public key of a server to obtain a first encryption result, wherein the public key of the server is pre-stored in an adaptive multi-rate audio file, and the adaptive multi-rate audio file is set on the mobile terminal; signing the first encryption result using a private key of the mobile terminal to obtain a first signature result; sending the first signature result to the server for authentication; receiving a second signature result sent by the server, and authenticating the second signature result; after successful two-way authentication, executing a communication action with the server. This application stores the key information of the mobile terminal in an adaptive multi-rate audio file in advance, and performs communication interaction between the mobile terminal and the server after completing the two-way authentication between the mobile terminal and the server. This solves the technical problems in the prior art that when the mobile terminal and the server communicate, there is only a one-way authentication process for the server, and the key information is directly stored in the installation package file and can be easily obtained by attackers, resulting in low communication security, thereby achieving the technical effect of improving communication security. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 is a structural diagram of a communication system provided by an embodiment of the present invention;

[0036] Figure 2 is a flow chart of a communication method provided by an embodiment of the present invention;

[0037] Figure 3 This is a schematic diagram of an implementation process of a communication method provided by an embodiment of the present invention;

[0038] Figure 4 is a flow chart of another communication method provided by an embodiment of the present invention;

[0039] Figure 5 This is a flow chart of communication interaction between a mobile terminal and a server terminal using a communication method provided by an embodiment of the present invention;

[0040] Figure 6 is a structural diagram of a communication device provided by an embodiment of the present invention;

[0041] Figure 7It is a structural diagram of another communication device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0042] The present invention will be further described in detail below with reference to the accompanying drawings and examples. It will be understood that the specific embodiments described herein are intended only to illustrate the present invention and are not intended to limit the present invention. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions relevant to the present invention, not all structures.

[0043] It should be noted that the terms "first," "second," and so on, in the specification, claims, and drawings of the present invention are used to distinguish different objects, and are not intended to limit a specific order. The following embodiments of the present invention can be implemented independently or in combination with each other, and the present invention does not impose specific limitations on this.

[0044] Figure 1 This is a structural diagram of a communication system provided by an embodiment of the present invention. Figure 1 As shown, the communication system includes the mobile terminal 10 in the communication method of any embodiment of the present invention, and the server terminal 20 in the communication method of any embodiment of the present invention. The mobile terminal 10 and the server terminal 20 are connected in communication. The mobile terminal 10 can be a smart mobile terminal such as a mobile phone, a tablet computer, or a smart wearable device such as a smart bracelet, a smart watch, a Bluetooth headset, etc., and this application does not limit it.

[0045] In order to achieve two-way authentication between the mobile terminal and the server terminal, it is necessary to apply for the mobile terminal's key library and the server terminal's key library from the CA (Certificate Authority) in advance. Among them, the CA is the authority responsible for issuing and managing digital certificates, and as a trusted third party in e-commerce transactions, it bears the responsibility of verifying the legitimacy of the public key in the public key system. The key library of the mobile terminal carries the mobile terminal's digital certificate, and the mobile terminal's authentication certificate carries the corresponding public key. The key library of the server terminal carries the server terminal's digital certificate, and the server terminal's key library carries the server terminal's public key. Import the mobile terminal's authentication certificate into the server terminal's key library in advance, and import the server terminal's authentication certificate into the mobile terminal's key library, to achieve digital certificate exchange between the server and mobile terminals.

[0046] Figure 2 This is a flow chart of a communication method provided by an embodiment of the present invention. The communication method is applied to a mobile terminal and can be executed by a communication device applied to the mobile terminal. The device can be implemented in hardware and / or software and can generally be integrated into a server.

[0047] like Figure 2As shown, the communication method specifically includes the following steps:

[0048] S101, generate a first random number, and encrypt the first random number using a public key of the server to obtain a first encryption result, wherein the public key of the server is pre-stored in an Adaptive Multi-Rate (AMR) audio file, and the Adaptive Multi-Rate audio file is set on the mobile terminal.

[0049] Specifically, because the mobile terminal and the server have exchanged digital certificates, the mobile terminal's keystore stores the server's digital certificate, which in turn carries the server's public key. To improve security, the mobile terminal's keystore uses a custom hidden storage scheme, storing it within the AMR audio file. After the mobile terminal generates a first random number, it extracts the server's public key from the AMR audio file and encrypts the first random number to produce a first encrypted result.

[0050] Optionally, pre-storing the server's public key in the adaptive multi-rate audio file includes:

[0051] The mobile terminal's key library is stored in the audio data area of ​​the adaptive multi-rate audio file, and the key library key corresponding to the mobile terminal's key library is encrypted and stored in the key-exclusive storage area of ​​the adaptive multi-rate audio file, wherein the mobile terminal's key library carries the server's public key.

[0052] Specifically, the mobile terminal's keystore acts as a "safe" that stores the server's digital certificate, while the keystore key corresponding to the mobile terminal's keystore acts as the safe's "key." To further enhance communication security, the "safe" and "key" are stored in different areas of the AMR audio file, and the "key" is encrypted. Specifically, the mobile terminal's keystore is first parsed into binary data, which is then stored as the "safe" in the audio data area of ​​the AMR audio file. The keystore key corresponding to the mobile terminal's keystore is then encrypted as the "key" and stored in the AMR audio file's dedicated key storage area. Because the digital certificate carries the server's public key, the mobile terminal's keystore also carries the server's public key.

[0053] It should be noted that when the mobile terminal needs to extract the server's public key from the AMR audio file, it first needs to parse the mobile terminal's key library stored in the "safe" in the audio data area to obtain the mobile terminal's key library; then decrypt the "key" key library key stored in the key-exclusive storage area to obtain the decrypted key library key; finally, use the key library key to decrypt the mobile terminal's key library to obtain the server's digital certificate, and finally obtain the server's public key.

[0054] S102: Use the private key of the mobile terminal to sign the first encryption result to obtain a first signature result.

[0055] S103: Send the first signature result to the server for authentication.

[0056] Specifically, after obtaining the first encryption result, the first encryption result is signed using the private key of the mobile terminal to obtain a first signature result, and the first signature result is sent to the server terminal for authentication.

[0057] S104, receiving the second signature result sent by the server and authenticating the second signature result, wherein the second signature result is obtained by the server encrypting the second random number generated by the mobile terminal using the public key of the mobile terminal, and then signing the second encryption result using the private key of the server.

[0058] Specifically, when the mobile terminal executes steps S101-S103, the server terminal also generates a second random number, and uses the pre-exchanged public key of the mobile terminal stored in the key library of the server terminal to encrypt the second random number to obtain a second encryption result. Finally, the second encryption result is signed using the private key of the server terminal to obtain a second signature result, and the second signature result is sent to the mobile terminal for authentication.

[0059] After receiving the second signature result, the mobile terminal verifies the second signature result. At the same time, the server also verifies the first signature result sent by the mobile terminal.

[0060] It should be noted that if any error occurs in any link of the two-way authentication process, the two-way authentication fails. By authenticating the mobile terminal's identity at the application level on the server side, and the server's identity at the application level on the mobile side, the legitimacy of both the mobile terminal and the server side is checked, effectively preventing man-in-the-middle attacks.

[0061] S105: After the two-way authentication is successful, the communication action with the server is performed.

[0062] Specifically, after the mobile terminal and the server terminal complete the two-way authentication and the authentication is successful, it indicates that both the mobile terminal and the server terminal are legal communication terminals, and the communication channel between the two is secure, and subsequent communication actions can be performed.

[0063] This application stores the key information of the mobile terminal in an adaptive multi-rate audio file in advance, and performs communication interaction between the mobile terminal and the server after completing the two-way authentication between the mobile terminal and the server. This solves the technical problems in the prior art that when the mobile terminal and the server communicate, there is only a one-way authentication process for the server, and the key information is directly stored in the installation package file and can be easily obtained by attackers, resulting in low communication security, thereby achieving the technical effect of improving communication security.

[0064] On the basis of the above technical solutions, Figure 3 This is a schematic diagram of the implementation process of a communication method provided by an embodiment of the present invention, such as Figure 3 As shown, the above S105 specifically includes:

[0065] S301: Generate a third random number.

[0066] S302: Obtain a public key of the server from the adaptive multi-rate audio file, encrypt the third random number, and obtain a third encryption result.

[0067] Specifically, the mobile terminal will generate a third random number, and obtain the server-side national secret SM2 public key from the AMR audio file to encrypt the third random number to obtain a third encryption result. Among them, the national secret SM2 is an elliptic curve public key cryptography algorithm released by the State Cryptography Administration in 2010, which is an asymmetric encryption algorithm.

[0068] S303: Use the private key of the mobile terminal to sign the third encryption result to obtain a third signature result.

[0069] S304: Send the third encryption result and the third signature result to the server.

[0070] Specifically, after obtaining the third encryption result, the third encryption result is signed using the national secret SM2 private key of the mobile terminal to obtain a third signature result, and both the third encryption result and the third signature result are sent to the server terminal.

[0071] After receiving the third encryption result and the third signature result, the server will first use the public key of the mobile terminal in the server's key library to verify the third signature result. After successful verification, the server will use the private key of the server to decrypt the third encryption result to obtain a third random number. The server will then generate a fourth random number. Finally, the server will use the public key of the mobile terminal to encrypt the fourth random number to obtain a fourth encryption result, and use the server's national secret SM2 private key to sign the fourth random number to obtain a fourth signature result, and return the fourth encryption result and the fourth signature result to the mobile terminal. The server will also use the third random number and the fourth random number to generate a session key for standby use.

[0072] S305: Receive the fourth encryption result and the fourth signature result sent by the server.

[0073] S306: Use the public key of the server to verify the fourth signature result.

[0074] S307: After successful verification, the fourth encryption result is decrypted using the private key of the mobile terminal to obtain a fourth random number, wherein the fourth random number is randomly generated by the server terminal.

[0075] Specifically, the mobile terminal receives the fourth encryption result and the fourth signature result sent by the server terminal, and uses the public key of the server terminal in the key library of the mobile terminal to verify the fourth signature result. After the verification is successful, the fourth encryption result is decrypted using the private key of the mobile terminal to obtain the fourth random number randomly generated by the server terminal.

[0076] S308: Generate a session key using the third random number and the fourth random number.

[0077] Specifically, how to use the third random number and the fourth random number to generate the corresponding session key is pre-set on the mobile terminal and the server terminal, and then after the mobile terminal obtains the third random number and the fourth random number, the session key is generated according to the preset method for standby use.

[0078] S309: Use the session key to encrypt the communication message.

[0079] S310: Send the encrypted message to be communicated to the server.

[0080] Specifically, after obtaining the session key, the mobile terminal uses the national secret SM4 algorithm to encrypt the communication message with the session key and sends the encrypted communication message to the server. After receiving the communication message, the server also uses the national secret SM4 algorithm to decrypt the communication message with the session key, obtains the service carried in the communication message, and sends a response message to the mobile terminal after completing the corresponding service. It should be noted that this response message is encrypted with the session key using the national secret SM4 algorithm and then sent to the mobile terminal.

[0081] On the basis of the above technical solutions, Figure 3 As shown, after the above S310, the following steps are further included:

[0082] S311, receiving a response message, wherein the response message is a response message sent by the server and encrypted using a session key.

[0083] S312: Decrypt the response message using the session key to obtain a decrypted response message.

[0084] Specifically, the mobile terminal receives the response message sent by the server and decrypts it using the national encryption SM4 algorithm with the session key to obtain the decrypted corresponding message. At this point, the mobile terminal and the server complete a communication interaction.

[0085] After that, if the mobile terminal and the server terminal want to continue communicating, they can repeat steps S309-S312.

[0086] Figure 4 This is a flow chart of another communication method provided by an embodiment of the present invention. The communication method is applied to a server side and can be executed by a communication device applied to the server side. The device can be implemented in hardware and / or software and can generally be integrated into the server.

[0087] like Figure 4 As shown, the communication method specifically includes the following steps:

[0088] S401: Generate a second random number, and encrypt the second random number using a pre-stored public key of the mobile terminal to obtain a second encryption result.

[0089] Specifically, since the mobile terminal and the server have exchanged digital certificates, the server's keystore stores the mobile terminal's digital certificate, which in turn carries the mobile terminal's public key. To implement the server-to-mobile authentication process, the server generates a second random number and encrypts it using the mobile terminal's public key to obtain a second encrypted result.

[0090] S402: Use the server-side private key to sign the second encryption result to obtain a second signature result.

[0091] S403: Send the second signature result to the mobile terminal for authentication.

[0092] Specifically, after obtaining the second encryption result, the second encryption result is signed using the private key of the server to obtain a second signature result, and the second signature result is sent to the mobile terminal for authentication.

[0093] S404, receiving the first signature result sent by the mobile terminal and authenticating the first signature result, wherein the first signature result is obtained by the mobile terminal encrypting a first random number generated by the public key of the server terminal, and then signing the first encryption result using the private key of the server terminal.

[0094] Specifically, when the server side executes steps S401-S403, the mobile side also generates a first random number, and uses the pre-exchanged public key of the server side stored in the key library of the mobile side to encrypt the first random number to obtain a first encryption result, and finally uses the private key of the mobile side to sign the first encryption result to obtain a first signature result, and sends the first signature result to the server side for authentication.

[0095] After receiving the first signature result, the server verifies the first signature result. At the same time, the mobile terminal also verifies the second signature result sent by the server.

[0096] It should be noted that during the two-way authentication process, if an error occurs in any link of either party, the two-way authentication will fail.

[0097] S405: After the two-way authentication is successful, the communication action with the mobile terminal is performed.

[0098] Specifically, after the mobile terminal and the server terminal complete the two-way authentication and the authentication is successful, it indicates that both the mobile terminal and the server terminal are legal communication terminals, and the communication channel between the two is secure, and subsequent communication actions can be performed.

[0099] On the basis of the above technical solutions, Figure 3 As shown, the above S405 specifically includes:

[0100] S4051, receiving the third encryption result and the third signature result sent by the mobile terminal, wherein the third encryption result is obtained by encrypting the third random number generated by the mobile terminal using the public key of the server terminal, and the third signature result is obtained by signing the third encryption result by the mobile terminal using the private key of the mobile terminal.

[0101] Specifically, the mobile terminal will generate a third random number, and obtain the server-side national secret SM2 public key from the AMR audio file to encrypt the third random number to obtain a third encryption result. After obtaining the third encryption result, the mobile terminal's national secret SM2 private key will be used to sign the third encryption result to obtain a third signature result, and both the third encryption result and the third signature result will be sent to the server.

[0102] S4052: Use the public key of the mobile terminal to verify the third signature result, and use the private key of the server terminal to decrypt the third encryption result to obtain a third random number.

[0103] Specifically, after the server receives the third encryption result and the third signature result, it will first use the public key of the mobile terminal in the server's key library to verify the third signature result. After successful verification, it will use the server's private key to decrypt the third encryption result to obtain a third random number.

[0104] S4053: Generate a fourth random number.

[0105] S4054: Use the public key of the mobile terminal to encrypt the fourth random number to obtain a fourth encryption result, and use the private key of the server terminal to sign the fourth random number to obtain a fourth signature result.

[0106] S4055: Generate a session key using the third random number and the fourth random number.

[0107] Specifically, after obtaining the third random number on the server side, it will randomly generate a fourth random number, and use the public key of the mobile side to encrypt the fourth random number to obtain a fourth encryption result, and use the national secret SM2 private key of the server side to sign the fourth random number to obtain a fourth signature result, and finally return the fourth encryption result and the fourth signature result to the mobile side; then, the server side will use the third random number and the fourth random number to generate a session key for standby use.

[0108] S4056: Send the fourth encryption result and the fourth signature result to the mobile terminal.

[0109] S4057: Receive the encrypted message to be communicated sent by the mobile terminal, and decrypt the message to be communicated using the session key.

[0110] Specifically, after receiving the fourth encryption result and fourth signature result sent by the server, the mobile terminal will use the server's public key in the mobile terminal's key library to verify the fourth signature result. After successful verification, the mobile terminal will use the mobile terminal's private key to decrypt the fourth encryption result to obtain a fourth random number randomly generated by the server. The mobile terminal also uses the third and fourth random numbers to generate a session key, and uses the session key to encrypt the communication message using the national secret SM4 algorithm. By using the third random number randomly generated by the mobile terminal and the fourth random number randomly generated by the server to generate the session key for encrypting the communication message, communication security is further improved.

[0111] After the mobile terminal sends the encrypted communication message to the server, the server decrypts the communication message using the session key using the same national encryption SM4 algorithm to obtain the business carried in the communication message.

[0112] S4058: After decryption is complete, the service carried in the message to be communicated is executed;

[0113] S4059: After the service is completed, a response message encrypted with the session key is sent to the mobile terminal.

[0114] Specifically, after completing the service in the pending communication message, the server will send a response message to the mobile terminal to inform the mobile terminal that the service has been completed. It should be noted that the response message is also encrypted using the national encryption SM4 algorithm with the session key and then sent to the mobile terminal.

[0115] A communication method provided by an embodiment of the present invention is described in detail below using a specific embodiment. Figure 5 This is a flow chart of a mobile terminal and a server terminal communicating and interacting using a communication method provided by an embodiment of the present invention.

[0116] like Figure 5 As shown in the figure, the numbers in brackets are the order of steps in the flowchart, where:

[0117] (1.1) The developer obtains the keystore on the server side; (1.2) The developer obtains the keystore on the mobile side;

[0118] (2) Export the digital certificate in the key store of the mobile terminal and the digital certificate in the key store of the server terminal respectively;

[0119] (3.1) Exchange the digital certificate of the mobile terminal with the digital certificate of the server terminal; (3.2) Import the digital certificate of the mobile terminal into the key store of the server terminal, and import the digital certificate of the server terminal into the key store of the mobile terminal;

[0120] (4) storing the key store and the key store key of the mobile terminal in different areas of the AMR audio file, wherein the key store key needs to be encrypted;

[0121] (5.1) The mobile terminal generates a first random number; (5.2) The first random number is encrypted and signed; (5.3) The encrypted and signed first random number is sent to the server;

[0122] (6) The server authenticates the encrypted and signed first random number;

[0123] (7.1) The server generates a second random number; (7.2) encrypts and signs the second random number; (7.1) sends the encrypted and signed second random number to the mobile terminal;

[0124] (8) The mobile terminal authenticates the encrypted and signed second random number;

[0125] (9.1) The mobile terminal generates a third random number; (9.2) The third random number is encrypted and signed; (9.3) The encrypted and signed third random number is sent to the server;

[0126] (10.1) The server generates a fourth random number; (10.2) encrypts and signs the fourth random number; (10.3) sends the encrypted and signed fourth random number to the mobile terminal;

[0127] (11.1) The mobile terminal authenticates and decrypts the encrypted and signed fourth random number to obtain a fourth random number; (11.2) The server terminal authenticates and decrypts the encrypted and signed third random number to obtain a third random number;

[0128] (12.1) The mobile terminal uses the third random number and the fourth random number to generate a session key based on a preset algorithm; (12.2) The server terminal uses the third random number and the fourth random number to generate a session key based on a preset algorithm;

[0129] (13.1) The mobile terminal uses the session key to encrypt the communication message and sends it to the server. (13.2) The server decrypts the encrypted communication message and performs the corresponding service.

[0130] (14.1) The server encrypts the response message using the session key and sends it to the mobile terminal. (14.2) The mobile terminal decrypts the encrypted response message to obtain the response message.

[0131] An embodiment of the present invention further provides a communication device, which is applied to a mobile terminal and is used to execute the communication method applied to the mobile terminal provided in the above embodiment of the present invention. The communication device provided in the embodiment of the present invention is specifically introduced below.

[0132] Figure 6 This is a structural diagram of a communication device provided by an embodiment of the present invention. Figure 6 As shown, the communication device mainly includes: a first generation unit 61, a first signature unit 62, a first transmission unit 63, a first receiving unit 64, and a first communication unit 65, wherein:

[0133] a first generating unit 61 configured to generate a first random number and encrypt the first random number using a public key of the server to obtain a first encryption result, wherein the public key of the server is pre-stored in an adaptive multi-rate audio file, and the adaptive multi-rate audio file is set on the mobile terminal;

[0134] A first signature unit 62 is configured to sign the first encryption result using the private key of the mobile terminal to obtain a first signature result;

[0135] A first transmitting unit 63 is configured to send the first signature result to a server for authentication;

[0136] The first receiving unit 64 is configured to receive a second signature result sent by the server and authenticate the second signature result, wherein the second signature result is obtained by the server encrypting a second random number generated by the mobile terminal using the public key of the mobile terminal, and then signing the second encrypted result using the private key of the server;

[0137] The first communication unit 65 is used to perform communication with the server after the two-way authentication is successful.

[0138] Optionally, the first communication unit 65 specifically includes:

[0139] The first generating subunit is configured to generate a third random number, and obtain a public key of the server from the adaptive multi-rate audio file to encrypt the third random number to obtain a third encryption result;

[0140] The first signing subunit is configured to sign the third encryption result using the private key of the mobile terminal to obtain a third signature result, and send the third encryption result and the third signature result to the server terminal;

[0141] A first receiving subunit, configured to receive the fourth encryption result and the fourth signature result sent by the server;

[0142] A first verification subunit is configured to verify the fourth signature result using the public key of the server and decrypt the fourth encryption result using the private key of the mobile terminal to obtain a fourth random number, wherein the fourth random number is randomly generated by the server;

[0143] a first key generating subunit, configured to generate a session key using a third random number and a fourth random number;

[0144] The first encryption subunit is used to encrypt the message to be communicated using the session key and send the encrypted message to be communicated to the server.

[0145] Optionally, the first communication unit 65 further includes:

[0146] A second receiving subunit is configured to receive a response message, wherein the response message is a response message sent by the server and encrypted using the session key;

[0147] The first decryption subunit is configured to decrypt the response message using the session key to obtain a decrypted response message.

[0148] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those in the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference can be made to the corresponding content in the aforementioned method embodiment.

[0149] The communication method applied to a mobile terminal provided in an embodiment of the present invention has the same technical features as the communication device applied to a mobile terminal provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.

[0150] An embodiment of the present invention further provides a communication device, which is applied to a server side and is used to execute the communication method applied to the server side provided in the above embodiment of the present invention. The communication device provided in the embodiment of the present invention is specifically introduced below.

[0151] Figure 7 FIG is a structural diagram of another communication device provided by an embodiment of the present invention. Figure 7 As shown, the communication device mainly includes: a second generation unit 71, a second signature unit 72, a second transmission unit 73, a second receiving unit 74, and a second communication unit 75, wherein:

[0152] The second generating unit 71 is configured to generate a second random number and encrypt the second random number using a pre-stored public key of the mobile terminal to obtain a second encryption result;

[0153] A second signature unit 72 is configured to sign the second encryption result using the server's private key to obtain a second signature result;

[0154] The second transmission unit 73 is used to send the second signature result to the mobile terminal for authentication;

[0155] The second receiving unit 74 is configured to receive a first signature result sent by the mobile terminal and authenticate the first signature result, wherein the first signature result is obtained by the mobile terminal encrypting a first random number generated by the server terminal using the public key of the server terminal, and then signing the first encryption result using the private key of the server terminal;

[0156] The second communication unit 75 is used to perform communication with the mobile terminal after the two-way authentication is successful.

[0157] Optionally, the second communication unit 75 specifically includes:

[0158] a third receiving subunit, configured to receive a third encryption result and a third signature result sent by the mobile terminal, wherein the third encryption result is obtained by encrypting a third random number generated by the mobile terminal using the public key of the server terminal, and the third signature result is obtained by signing the third encryption result by the mobile terminal using the private key of the mobile terminal;

[0159] A second verification subunit is configured to verify the third signature result using the public key of the mobile terminal and decrypt the third encryption result using the private key of the server terminal to obtain a third random number;

[0160] A second generating subunit, configured to generate a fourth random number;

[0161] The second encryption subunit is configured to encrypt the fourth random number using the public key of the mobile terminal to obtain a fourth encryption result, and sign the fourth random number using the private key of the server terminal to obtain a fourth signature result;

[0162] a second key generating subunit, configured to generate a session key using a third random number and a fourth random number;

[0163] The second decryption subunit is used to receive the encrypted communication message sent by the mobile terminal and decrypt the communication message using the session key;

[0164] The first feedback sub-unit is configured to execute the service carried in the message to be communicated after decryption is completed, and send a response message encrypted with the session key to the mobile terminal after execution is completed.

[0165] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those in the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference can be made to the corresponding content in the aforementioned method embodiment.

[0166] The communication method applied to the server side provided in the embodiment of the present invention has the same technical features as the communication device applied to the server side provided in the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.

[0167] An embodiment of the present invention further provides a storage medium comprising computer-executable instructions, which, when executed by a computer processor, are used to execute a communication method applied to a mobile terminal and a communication method applied to a server terminal.

[0168] Specifically, the communication method applied to the mobile terminal includes:

[0169] Generate a first random number and encrypt the first random number using a public key of the server to obtain a first encryption result, wherein the public key of the server is pre-stored in an adaptive multi-rate audio file, and the adaptive multi-rate audio file is set on the mobile terminal;

[0170] Sign the first encryption result using the private key of the mobile terminal to obtain a first signature result;

[0171] Send the first signature result to the server for authentication;

[0172] Receiving a second signature result sent by the server and authenticating the second signature result, wherein the second signature result is obtained by the server encrypting a second random number generated by the mobile terminal using the public key of the mobile terminal, and then signing the second encryption result using the private key of the server;

[0173] After the two-way authentication is successful, the communication action with the server is performed.

[0174] Specifically, the communication method applied to the server side includes:

[0175] Generate a second random number, and encrypt the second random number using the pre-stored public key of the mobile terminal to obtain a second encryption result;

[0176] Sign the second encryption result using the server's private key to obtain a second signature result;

[0177] Send the second signature result to the mobile terminal for authentication;

[0178] Receiving a first signature result sent by the mobile terminal and authenticating the first signature result, wherein the first signature result is obtained by the mobile terminal encrypting a first random number generated by the server terminal using the public key of the server terminal, and then signing the first encryption result using the private key of the server terminal;

[0179] After the two-way authentication is successful, the communication action between the mobile terminal is performed.

[0180] Of course, the storage medium containing computer-executable instructions provided in an embodiment of the present invention is not limited to the method operations described above, and can also execute related operations in the communication method applied to the mobile terminal or the server terminal provided in any embodiment of the present invention.

[0181] Through the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented with the help of software and necessary general-purpose hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0182] It is worth noting that in the embodiment of the above-mentioned search device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0183] In the description of the embodiments of the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed, detachable, or integral connections; mechanical or electrical connections; direct or indirect connections through an intermediate medium; and internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on specific circumstances.

[0184] Finally, it should be noted that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the scope of the present invention. The scope of the present invention is determined by the scope of the appended claims.

Claims

1. A communication method, characterized in that: Applied to a mobile terminal, the communication method includes: generating a first random number and encrypting the first random number using a public key of a server to obtain a first encryption result, wherein the public key of the server is pre-stored in an adaptive multi-rate audio file, and the adaptive multi-rate audio file is set on the mobile terminal; Signing the first encryption result using the private key of the mobile terminal to obtain a first signature result; Sending the first signature result to the server for authentication; Receiving a second signature result sent by the server, and authenticating the second signature result, wherein the second signature result is obtained by the server encrypting a second random number generated by the mobile terminal using the public key of the mobile terminal, and then signing the second encryption result using the private key of the server; After the two-way authentication is successful, executing the communication action with the server side; The step of pre-storing the public key of the server in the adaptive multi-rate audio file includes: The key store of the mobile terminal is parsed into binary data and stored in the audio data area of ​​the adaptive multi-rate audio file, and the key store key corresponding to the key store of the mobile terminal is encrypted and stored in the key-exclusive storage area of ​​the adaptive multi-rate audio file, wherein the key store of the mobile terminal carries the public key of the server.

2. The communication method according to claim 1, wherein: After the two-way authentication is successful, performing the communication action with the server includes: generating a third random number; Obtaining a public key of the server from the adaptive multi-rate audio file to encrypt the third random number to obtain a third encryption result; Sign the third encryption result using the private key of the mobile terminal to obtain a third signature result; Sending the third encryption result and the third signature result to the server; Receiving the fourth encryption result and the fourth signature result sent by the server; Verifying the fourth signature result using the public key of the server; After successful verification, the fourth encryption result is decrypted using the private key of the mobile terminal to obtain a fourth random number, wherein the fourth random number is randomly generated by the server terminal; generating a session key using the third random number and the fourth random number; Encrypting the communication message using the session key; The encrypted message to be communicated is sent to the server.

3. The communication method according to claim 2, wherein: After sending the encrypted message to be communicated to the server, the communication method further includes: receiving a response message, wherein the response message is a response message sent by the server and encrypted using the session key; The response message is decrypted using the session key to obtain the decrypted response message.

4. A communication method, characterized in that: Applied to the server side, the communication method includes: Generate a second random number, and encrypt the second random number using a pre-stored public key of the mobile terminal to obtain a second encryption result; Signing the second encryption result using the server's private key to obtain a second signature result; Sending the second signature result to the mobile terminal for authentication; receiving a first signature result sent by the mobile terminal and authenticating the first signature result, wherein the first signature result is obtained by encrypting a first random number generated by the mobile terminal using a public key of the server terminal to obtain the first encryption result, and then signing the first encryption result using a private key of the server terminal; the public key of the server terminal is pre-stored in an adaptive multi-rate audio file, and the adaptive multi-rate audio file is set on the mobile terminal; After the two-way authentication is successful, performing a communication action with the mobile terminal; The step of pre-storing the public key of the server in the adaptive multi-rate audio file includes: The key store of the mobile terminal is parsed into binary data and stored in the audio data area of ​​the adaptive multi-rate audio file, and the key store key corresponding to the key store of the mobile terminal is encrypted and stored in the key-exclusive storage area of ​​the adaptive multi-rate audio file, wherein the key store of the mobile terminal carries the public key of the server.

5. The communication method according to claim 4, wherein: After the two-way authentication is successful, performing the communication action with the mobile terminal includes: receiving a third encryption result and a third signature result sent by the mobile terminal, wherein the third encryption result is obtained by encrypting a third random number generated by the mobile terminal using the public key of the server terminal, and the third signature result is obtained by signing the third encryption result by the mobile terminal using the private key of the mobile terminal; Verify the third signature result using the public key of the mobile terminal, and decrypt the third encryption result using the private key of the server terminal to obtain the third random number; generating a fourth random number; Encrypting the fourth random number using the public key of the mobile terminal to obtain a fourth encryption result, and signing the fourth random number using the private key of the server terminal to obtain a fourth signature result; generating a session key using the third random number and the fourth random number; receiving the encrypted message to be communicated sent by the mobile terminal, and decrypting the message to be communicated using the session key; After decryption is completed, the service carried in the message to be communicated is executed; After the service is completed, a response message encrypted with the session key is sent to the mobile terminal.

6. A communication device, characterized in that: Applied to a mobile terminal, the communication device includes: a first generating unit, configured to generate a first random number and encrypt the first random number using a public key of a server to obtain a first encryption result, wherein the public key of the server is pre-stored in an adaptive multi-rate audio file, and the adaptive multi-rate audio file is set on the mobile terminal; A first signature unit, configured to sign the first encryption result using a private key of the mobile terminal to obtain a first signature result; A first transmitting unit, configured to send the first signature result to the server for authentication; a first receiving unit, configured to receive a second signature result sent by the server, and authenticate the second signature result, wherein the second signature result is obtained by the server encrypting a second random number generated by the mobile terminal using the public key of the mobile terminal, and then signing the second encryption result using the private key of the server; A first communication unit, configured to perform communication with the server after the two-way authentication is successful; The step of pre-storing the public key of the server in the adaptive multi-rate audio file includes: The key store of the mobile terminal is parsed into binary data and stored in the audio data area of ​​the adaptive multi-rate audio file, and the key store key corresponding to the key store of the mobile terminal is encrypted and stored in the key-exclusive storage area of ​​the adaptive multi-rate audio file, wherein the key store of the mobile terminal carries the public key of the server.

7. A communication device, characterized in that: Applied to the server side, the communication device includes: A second generating unit, configured to generate a second random number, and encrypt the second random number using a pre-stored public key of the mobile terminal to obtain a second encryption result; A second signature unit is configured to sign the second encryption result using a private key of the server to obtain a second signature result; A second transmitting unit, configured to send the second signature result to the mobile terminal for authentication; a second receiving unit, configured to receive a first signature result sent by the mobile terminal and authenticate the first signature result, wherein the first signature result is obtained by the mobile terminal encrypting a first random number generated by the mobile terminal using a public key of the server terminal, and then signing the first encryption result using a private key of the server terminal; the public key of the server terminal is pre-stored in an adaptive multi-rate audio file, and the adaptive multi-rate audio file is set on the mobile terminal; A second communication unit, configured to perform a communication operation with the mobile terminal after the two-way authentication is successful; The step of pre-storing the public key of the server in the adaptive multi-rate audio file includes: The key store of the mobile terminal is parsed into binary data and stored in the audio data area of ​​the adaptive multi-rate audio file, and the key store key corresponding to the key store of the mobile terminal is encrypted and stored in the key-exclusive storage area of ​​the adaptive multi-rate audio file, wherein the key store of the mobile terminal carries the public key of the server.

8. A communication system, characterized in that: The communication system includes the mobile terminal in the communication method according to any one of claims 1 to 3, and the server terminal in the communication method according to any one of claims 4 to 5.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, it implements the communication method applied to the mobile terminal as described in any one of claims 1-3, or implements the communication method applied to the server terminal as described in any one of claims 4-5.

Citation Information

Patent Citations

  • File sharing method and file sharing system

    CN103338185A

  • Bidirectional authentication method and apparatus between terminal and server

    CN108512846A

  • One-time pad replaceable encryption algorithm, component and equipment based on password book

    CN112651034A