Data communication method and device, equipment and storage medium

By using the key dynamic library to manage keys in data communication and loading in a sandbox environment, the problems of key leakage and low data security under symmetric encryption are solved, achieving higher data security and flexibility.

CN119094120AActive Publication Date: 2024-12-06CHINA CONSTRUCTION BANK +1

Patent Information

Application Number
CN202411236808.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2024-12-06
Estimated Expiration
2044-09-04

AI Technical Summary

Technical Problem

In the existing data communication methods, the use of symmetric encryption means high risk of key leakage, low data security, and the key exchange process is susceptible to the risk of abnormal interception or tampering.

Method used

Use key dynamic library to generate and manage keys, and realize key exchange in the application by loading the key dynamic library, avoid key sending and receiving processes, use asymmetric encryption to increase the difficulty of key leakage, and load dynamics in a sandbox environment. library for enhanced security.

Benefits of technology

It reduces the possibility of key leakage and abnormal interception, improves data security during data communication, and improves the flexibility of key management and memory resource utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094120A_ABST
    Figure CN119094120A_ABST
Patent Text Reader

Abstract

The invention provides a data communication method and device, equipment and a storage medium, can be applied to the field of data analysis and the like, and is used for solving the problem of relatively low data security in a data communication process. The method at least comprises the following steps: acquiring a first private key and a second public key based on a key dynamic library loaded in a target application; encrypting a data request generated by the target application by adopting the second public key to obtain an encrypted data request; sending the encrypted data request to the server, so that the server decrypts the received encrypted data request by using a second private key in a second key pair to obtain a data request, and returns an encrypted data response encrypted by using a pre-stored first public key based on the data request; wherein the first public key is a public key in the first key pair; and when the encrypted data response is received, decrypting the encrypted data response by using the first private key to obtain a data response of the target application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data analysis, and in particular to a data communication method, apparatus, device and storage medium. Background Art

[0002] With the continuous development of technology, more and more devices can communicate with each other, so that multiple devices can collaborate to process data. For example, a client with an application installed can send transaction data to a server running the application through a network request, so that the server can process the transaction data.

[0003] Under the relevant technology, in order to ensure data security during data communication between devices and avoid data leakage or abnormal interception or abnormal tampering of data, the data communication method is usually that the server generates a symmetric key and sends the symmetric key to the client; the client stores the symmetric key, and when generating a data request, uses the stored symmetric key to encrypt the data request, obtains the encrypted data request, and sends the encrypted data request to the server; the server uses the symmetric key to decrypt the received encrypted data request, obtains the corresponding data request, and returns a data response based on the data request.

[0004] However, since the symmetric encryption method uses the same key for encryption and decryption, there are many channels for the key to be leaked, which can easily affect data security. In addition, the key sending and receiving process is also completed by sending and receiving data between devices. Therefore, in the process of sending and receiving data, it is easy for abnormal interception or abnormal tampering of data to occur, which can also easily affect data security.

[0005] Therefore, the data security of the data communication process under the related art is low. Summary of the invention

[0006] Embodiments of the present application provide a data communication method, apparatus, device, and storage medium for solving the problem of low data security in a data communication process.

[0007] In a first aspect, a data communication method is provided, which is applied to a client having a target application installed thereon, comprising:

[0008] Based on the key dynamic library loaded in the target application, a first private key and a second public key are obtained; wherein the first private key is: a private key in a first key pair generated by the key dynamic library for the target application; and the second public key is: a public key in a second key pair generated by a server running the target application for the target application;

[0009] Using the second public key, encrypting the data request generated by the target application to obtain an encrypted data request;

[0010] Sending the encrypted data request to the server, so that the server uses the second private key in the second key pair to decrypt the received encrypted data request, obtain the data request, and return an encrypted data response encrypted by using the pre-stored first public key based on the data request; wherein the first public key is: the public key in the first key pair;

[0011] When the encrypted data response is received, the encrypted data response is decrypted using the first private key to obtain the data response of the target application.

[0012] Optionally, before acquiring the first private key and the second public key based on the key dynamic library loaded in the target application, the method further includes:

[0013] Based on a pre-stored dynamic library acquisition interface, obtain the download address and reference hash value of the key dynamic library from the server;

[0014] Download the key dynamic library from the download address;

[0015] Based on the binary format, the key dynamic library is formatted and a binary file of the key dynamic library is obtained;

[0016] Performing hash processing on the binary file to obtain a target hash value;

[0017] When it is determined that the target hash value matches the reference hash value, the key dynamic library is loaded into the sandbox environment of the target application.

[0018] Optionally, obtaining the first private key and the second public key based on the key dynamic library loaded in the target application includes:

[0019] Using the key dynamic library, perform the following steps:

[0020] Generate a first key pair based on the key generation strategy; wherein the first key pair includes: a first public key and a first private key;

[0021] Using the symmetric key obtained from the server to encrypt the first public key, to obtain a symmetric encryption public key;

[0022] Sending the symmetric encryption public key to the server, so that the server uses the symmetric key to decrypt the received symmetric encryption public key to obtain the first public key, and based on the key generation strategy, generates a second key pair, and uses the first public key to encrypt the second public key in the second key pair to obtain a second encrypted public key, and returns the second encrypted public key; wherein the second key pair includes the second public key and the second private key;

[0023] The second encrypted public key is decrypted using the first private key to obtain a second public key.

[0024] Optionally, before encrypting the first public key by using the symmetric key obtained from the server to obtain the symmetric encryption public key, the method further includes:

[0025] Sending a symmetric key acquisition instruction to the server, so that the server returns a symmetric encryption key and a reference key; wherein the symmetric encryption key is obtained by: the server uses the reference key to encrypt the generated symmetric key;

[0026] Using the key dynamic library, perform the following steps:

[0027] Segmenting the symmetric encryption key to obtain multiple encryption key segments;

[0028] Reverse-process the multiple encryption key segments respectively to obtain corresponding reverse-order key segments;

[0029] The obtained reverse key segments and the reference key are stored.

[0030] Optionally, the using the symmetric key obtained from the server to encrypt the first public key to obtain the symmetric encryption public key includes:

[0031] Obtaining the stored reverse key segments and the reference key;

[0032] Reverse processing is performed on each of the reverse key segments to obtain a corresponding encryption key segment;

[0033] Concatenate the obtained encryption key segments to obtain the symmetric encryption key;

[0034] Decrypting the symmetric encryption key using the reference key to obtain the symmetric key;

[0035] The first public key is encrypted using the obtained symmetric key to obtain a symmetric encryption public key.

[0036] In a second aspect, a data communication method is provided, which is applied to a server running a target application, comprising:

[0037] Receiving an encrypted data request sent by a client having the target application installed; wherein the encrypted data request is obtained by encrypting the data request generated by the target application by the client using a second public key; the second public key is a public key in a second key pair generated by the server for the target application and obtained based on a key dynamic library loaded in the target application;

[0038] Decrypting the encrypted data request using the second private key in the second key pair to obtain a data request;

[0039] Using a pre-stored first public key to encrypt a data response obtained based on the data request to obtain an encrypted data response;

[0040] The encrypted data response is sent to the client so that the client uses the first private key to decrypt the received encrypted data response to obtain the data response of the target application; wherein the first private key is: the private key in the first key pair generated by the key dynamic library for the target application.

[0041] Optionally, before using the second private key in the second key pair to decrypt the encrypted data request to obtain the data request, the method further includes:

[0042] Generate a symmetric key based on the symmetric encryption strategy;

[0043] When receiving a symmetric key acquisition instruction from the key dynamic library for the symmetric key, returning the symmetric key to the key dynamic library, so that the key dynamic library uses the symmetric key to encrypt the first public key to obtain a symmetric encryption public key;

[0044] When receiving the symmetric encryption public key, decrypting the symmetric encryption public key using the symmetric key to obtain the first public key;

[0045] Based on the key generation strategy, generate a second key pair; wherein the second key pair includes a second public key and a second private key;

[0046] Encrypting the second public key using the first public key to obtain a second encrypted public key;

[0047] The second encrypted public key is returned to the key dynamic library, so that the key dynamic library uses the first private key to decrypt the second encrypted public key to obtain a second public key.

[0048] Optionally, when receiving the symmetric key acquisition instruction from the key dynamic library for the symmetric key, before returning the symmetric key to the key dynamic library, the method further includes:

[0049] Using a preset reference key to encrypt the symmetric key to obtain a symmetric encryption key;

[0050] Segmenting the symmetric encryption key to obtain multiple encryption key segments;

[0051] Reverse order processing is performed on the plurality of encryption key segments respectively to obtain corresponding reverse order key segments;

[0052] The obtained multiple reverse key segments and the reference key are stored.

[0053] Optionally, when receiving a symmetric key acquisition instruction for the symmetric key from the key dynamic library loaded in the client, returning the symmetric key to the key dynamic library includes:

[0054] Based on the symmetric key acquisition instruction, acquiring a plurality of reverse key segments and the reference key;

[0055] Reverse processing is performed on the multiple reverse key segments respectively to obtain corresponding encryption key segments;

[0056] Concatenate the obtained multiple encryption key segments to obtain the symmetric encryption key;

[0057] Decrypting the symmetric encryption key using the reference key to obtain the symmetric key;

[0058] The symmetric key is returned to the key dynamic store.

[0059] In a third aspect, a data communication device is provided, which is applied to a client having a target application installed thereon, comprising:

[0060] A processing module: used to obtain a first private key and a second public key based on a key dynamic library loaded in the target application; wherein the first private key is: a private key in a first key pair generated by the key dynamic library for the target application; and the second public key is: a public key in a second key pair generated by a server running the target application for the target application;

[0061] The processing module is further used to: use the second public key to encrypt the data request generated by the target application to obtain an encrypted data request;

[0062] The transceiver module is used to send the encrypted data request to the server, so that the server uses the second private key in the second key pair to decrypt the received encrypted data request, obtain the data request, and return an encrypted data response encrypted by using the pre-stored first public key based on the data request; wherein the first public key is: the public key in the first key pair;

[0063] The transceiver module is further configured to: upon receiving the encrypted data response, decrypt the encrypted data response using the first private key to obtain a data response of the target application.

[0064] Optionally, the processing module is further used for:

[0065] Before acquiring the first private key and the second public key based on the key dynamic library loaded in the target application, acquiring the download address and the reference hash value of the key dynamic library from the server based on a pre-stored dynamic library acquisition interface;

[0066] Download the key dynamic library from the download address;

[0067] Based on the binary format, the key dynamic library is formatted and a binary file of the key dynamic library is obtained;

[0068] Performing hash processing on the binary file to obtain a target hash value;

[0069] When it is determined that the target hash value matches the reference hash value, the key dynamic library is loaded into the sandbox environment of the target application.

[0070] Optionally, the processing module is specifically used for:

[0071] Using the key dynamic library, perform the following steps:

[0072] Generate a first key pair based on the key generation strategy; wherein the first key pair includes: a first public key and a first private key;

[0073] Using the symmetric key obtained from the server to encrypt the first public key, to obtain a symmetric encryption public key;

[0074] Sending the symmetric encryption public key to the server, so that the server uses the symmetric key to decrypt the received symmetric encryption public key to obtain the first public key, and based on the key generation strategy, generates a second key pair, and uses the first public key to encrypt the second public key in the second key pair to obtain a second encrypted public key, and returns the second encrypted public key; wherein the second key pair includes the second public key and the second private key;

[0075] The second encrypted public key is decrypted using the first private key to obtain a second public key.

[0076] Optionally, the transceiver module is further used for:

[0077] Before the symmetric key obtained from the server is used to encrypt the first public key to obtain the symmetric encryption public key, a symmetric key acquisition instruction is sent to the server to enable the server to return a symmetric encryption key and a reference key; wherein the symmetric encryption key is obtained by the server using the reference key to encrypt the generated symmetric key;

[0078] The processing module is also used for:

[0079] Using the key dynamic library, perform the following steps:

[0080] Segmenting the symmetric encryption key to obtain multiple encryption key segments;

[0081] Reverse-process the multiple encryption key segments respectively to obtain corresponding reverse-order key segments;

[0082] The obtained reverse key segments and the reference key are stored.

[0083] Optionally, the processing module is specifically used for:

[0084] Obtaining the stored reverse key segments and the reference key;

[0085] Reverse processing is performed on each of the reverse key segments to obtain a corresponding encryption key segment;

[0086] Concatenate the obtained encryption key segments to obtain the symmetric encryption key;

[0087] Decrypting the symmetric encryption key using the reference key to obtain the symmetric key;

[0088] The first public key is encrypted using the obtained symmetric key to obtain a symmetric encryption public key.

[0089] In a fourth aspect, a data communication device is provided, which is applied to a server running a target application, comprising:

[0090] The transceiver module is used to receive an encrypted data request sent by a client having the target application installed thereon; wherein the encrypted data request is obtained by encrypting the data request generated by the target application by the client using a second public key; the second public key is a public key in a second key pair generated by the server for the target application and obtained based on a key dynamic library loaded in the target application;

[0091] Processing module: used to use the second private key in the second key pair to decrypt the encrypted data request to obtain a data request;

[0092] The processing module is further used to: encrypt the data response obtained based on the data request using a pre-stored first public key to obtain an encrypted data response;

[0093] The transceiver module is also used to: send the encrypted data response to the client, so that the client uses the first private key to decrypt the received encrypted data response to obtain the data response of the target application; wherein, the first private key is: the private key in the first key pair generated by the key dynamic library for the target application.

[0094] Optionally, the processing module is further used for:

[0095] Before decrypting the encrypted data request using the second private key in the second key pair to obtain the data request, generating a symmetric key based on a symmetric encryption strategy;

[0096] The transceiver module is also used for:

[0097] When receiving a symmetric key acquisition instruction from the key dynamic library for the symmetric key, returning the symmetric key to the key dynamic library, so that the key dynamic library uses the symmetric key to encrypt the first public key to obtain a symmetric encryption public key;

[0098] The processing module is also used for:

[0099] When receiving the symmetric encryption public key, decrypting the symmetric encryption public key using the symmetric key to obtain the first public key;

[0100] Based on the key generation strategy, generate a second key pair; wherein the second key pair includes a second public key and a second private key;

[0101] Encrypting the second public key using the first public key to obtain a second encrypted public key;

[0102] The transceiver module is also used for:

[0103] The second encrypted public key is returned to the key dynamic library, so that the key dynamic library uses the first private key to decrypt the second encrypted public key to obtain a second public key.

[0104] Optionally, the processing module is further used for:

[0105] When receiving the symmetric key acquisition instruction for the symmetric key from the key dynamic library, before returning the symmetric key to the key dynamic library, encrypting the symmetric key with a preset reference key to obtain a symmetric encryption key;

[0106] Segmenting the symmetric encryption key to obtain multiple encryption key segments;

[0107] Reverse order processing is performed on the plurality of encryption key segments respectively to obtain corresponding reverse order key segments;

[0108] The obtained multiple reverse key segments and the reference key are stored.

[0109] Optionally, the processing module is specifically used for:

[0110] Based on the symmetric key acquisition instruction, acquiring a plurality of reverse key segments and the reference key;

[0111] Reverse processing is performed on the multiple reverse key segments respectively to obtain corresponding encryption key segments;

[0112] Concatenate the obtained multiple encryption key segments to obtain the symmetric encryption key;

[0113] Decrypting the symmetric encryption key using the reference key to obtain the symmetric key;

[0114] The symmetric key is returned to the key dynamic store.

[0115] According to a fifth aspect, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the method described in the first aspect or the second aspect.

[0116] A sixth aspect provides a computer device, including:

[0117] A memory for storing program instructions;

[0118] The processor is used to call the program instructions stored in the memory and execute the method as described in the first aspect or the second aspect according to the obtained program instructions.

[0119] In a seventh aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method as described in the first aspect or the second aspect.

[0120] In the embodiment of the present application, keys are generated and managed through a key dynamic library, and key exchange is achieved by loading the key dynamic library into an application. There is no need to perform the key sending and receiving process, which reduces the possibility of abnormal situations such as key leakage and improves data security during data communication.

[0121] Furthermore, the use of asymmetric encryption methods can increase the difficulty of key leakage, which can improve data security in the data communication process to a certain extent.

[0122] Furthermore, since the key dynamic library is not bound to the target application but loaded in the target application, it can be linked to the target application during the operation of the target application, and each application can share the key dynamic library to generate and manage each application's own password, reducing unnecessary occupation of memory resources, and the key dynamic library can be updated without recompiling the target program, thereby improving the flexibility of data communication. BRIEF DESCRIPTION OF THE DRAWINGS

[0123] Figure 1 An application scenario of the data communication method provided in the embodiment of the present application;

[0124] Figure 2 A flow chart of a data communication method provided in an embodiment of the present application Figure 1 ;

[0125] Figure 3 A schematic diagram of a principle of a data communication method provided in an embodiment of the present application;

[0126] Figure 4 A flow chart of a data communication method provided in an embodiment of the present application Figure 2 ;

[0127] Figure 5 An interactive schematic diagram of a data communication method provided in an embodiment of the present application;

[0128] Figure 6 A structural diagram of a data communication method provided in an embodiment of the present application Figure 1 ;

[0129] Figure 7 A structural diagram of a data communication device provided in an embodiment of the present application Figure 2 ;

[0130] Figure 8 A structural diagram of a data communication device provided in an embodiment of the present application Figure 3 . DETAILED DESCRIPTION

[0131] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be arbitrarily combined with each other. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.

[0132] The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. "Multiple" in the present application can mean at least two, for example, two, three or more, and the embodiments of the present application are not limited.

[0133] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description. It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0134] In the technical solution of this application, the acquisition, transmission, storage, and use of data are in compliance with the requirements of relevant national laws and regulations.

[0135] The following is a brief introduction to the application fields of the data communication method provided in the embodiments of the present application.

[0136] With the continuous development of technology, more and more devices can communicate with each other, so that multiple devices can collaborate to process data. For example, a client with an application installed can send transaction data to a server running the application through a network request, so that the server can process the transaction data.

[0137] Under the relevant technology, in order to ensure data security during data communication between devices and avoid data leakage or abnormal interception or abnormal tampering of data, the data communication method is usually that the server generates a symmetric key and sends the symmetric key to the client; the client stores the symmetric key, and when generating a data request, uses the stored symmetric key to encrypt the data request, obtains the encrypted data request, and sends the encrypted data request to the server; the server uses the symmetric key to decrypt the received encrypted data request, obtains the corresponding data request, and returns a data response based on the data request.

[0138] For example, the server uses the Advanced Encryption Standard (AES) algorithm to generate a symmetric key AESKey_01; the server provides the symmetric key AESKey_01 to the client offline; the client writes the symmetric key AESKey_01 into the source code; after the client generates a data request, it uses the symmetric key AESKey_01 to package the data request into an encryption request message and generate a key update request; the client sends the encryption request message and the key update request to the server, and the server receives the encryption request message and the key update request sent by the client. Based on the key update request, the server uses the AES algorithm to generate a symmetric key AESKey_02. The server uses the symmetric key AESKey_01 to encrypt the symmetric key AESKey_02 and obtain the encrypted symmetric key AESKey_02. The server sends the encrypted symmetric key AESKey_02 to the client, and the client uses the symmetric key AESKey_01 to decrypt the received encrypted symmetric key AESKey_02 and obtain the symmetric key AESKey_02. The client replaces the symmetric key AESKey_01 written in the source code with the symmetric key AESKey_02, and then uses the symmetric key AESKey_02 for encryption and decryption. The server uses the symmetric key AESKey_01 to decrypt the encrypted request message, obtain the data request, and obtain the data response based on the data request. The server uses the symmetric key AESKey_02 to package the data response into an encrypted response message. The server sends the encrypted response message to the client, and the client uses the symmetric key AESKey_02 to decrypt the received encrypted response message to obtain the data response.

[0139] However, since the symmetric encryption method uses the same key for encryption and decryption, there are many channels for the key to be leaked, which can easily affect data security. In addition, the key sending and receiving process is also completed by sending and receiving data between devices. Therefore, in the process of sending and receiving data, it is easy for abnormal interception or abnormal tampering of data to occur, which can also easily affect data security.

[0140] Therefore, the data security of the data communication process under the related art is low.

[0141] In order to solve the problem of low data security during data communication, the present application proposes a data communication method. When the method is applied to a client with a target application installed, the method obtains a first private key and a second public key based on a key dynamic library loaded in the target application. The first private key is: a private key in a first key pair generated by the key dynamic library for the target application; the second public key is: a public key in a second key pair generated by a server running the target application for the target application.

[0142] The second public key is used to encrypt the data request generated by the target application to obtain the encrypted data request. The encrypted data request is sent to the server so that the server uses the second private key in the second key pair to decrypt the received encrypted data request to obtain the data request, and returns an encrypted data response encrypted by the pre-stored first public key based on the data request. The first public key is: the public key in the first key pair. When the encrypted data response is received, the encrypted data response is decrypted by the first private key to obtain the data response of the target application.

[0143] When the method is applied to a server running a target application, in the method, an encrypted data request sent by a client having the target application installed is received. The encrypted data request is obtained by the client encrypting the data request generated by the target application using the second public key; the second public key is a public key in a second key pair generated by the server for the target application and obtained based on a key dynamic library loaded in the target application.

[0144] The encrypted data request is decrypted using the second private key in the second key pair to obtain the data request. The data response obtained based on the data request is encrypted using the pre-stored first public key to obtain the encrypted data response. The encrypted data response is sent to the client so that the client uses the first private key to decrypt the received encrypted data response to obtain the data response of the target application. The first private key is: the private key in the first key pair generated by the key dynamic library for the target application.

[0145] In the embodiment of the present application, keys are generated and managed through a key dynamic library, and key exchange is achieved by loading the key dynamic library into an application. There is no need to perform the key sending and receiving process, which reduces the possibility of abnormal situations such as key leakage and improves data security during data communication.

[0146] Furthermore, the use of asymmetric encryption methods can increase the difficulty of key leakage, which can improve data security in the data communication process to a certain extent.

[0147] Furthermore, since the key dynamic library is not bound to the target application but loaded in the target application, it can be linked to the target application during the operation of the target application, and each application can share the key dynamic library to generate and manage each application's own password, reducing unnecessary occupation of memory resources, and the key dynamic library can be updated without recompiling the target program, thereby improving the flexibility of data communication.

[0148] The application scenarios of the data communication method provided by this application are described below.

[0149] Please refer to Figure 1, is a schematic diagram of an application scenario of the data communication method provided in the present application. The application scenario includes a client 101 and a server 102. The client 101 and the server 102 can communicate with each other, and the communication method can be to use wired communication technology for communication, for example, by connecting a network cable or a serial port line for communication; or to use wireless communication technology for communication, for example, by using Bluetooth or wireless fidelity (wireless fidelity, WIFI) and other technologies for communication, without specific limitation.

[0150] Client 101 generally refers to a device on which a target application is installed, such as a terminal device, a third-party application program accessible to a terminal device, or a web page accessible to a terminal device. Terminal devices include, but are not limited to, mobile phones, computers, smart medical devices, smart home appliances, vehicle-mounted terminals, or aircraft. Server 102 generally refers to a device running a target application, such as a terminal device or a server. Servers include, but are not limited to, cloud servers, local servers, or associated third-party servers. Both client 101 and server 102 can use cloud computing to reduce the occupation of local computing resources; cloud storage can also be used to reduce the occupation of local storage resources.

[0151] As an embodiment, the client 101 and the server 102 may be the same device or different devices, without any specific limitation.

[0152] The following is based on Figure 1 , from the perspective of the client with the target application installed, the data communication method provided by the embodiment of the present application is specifically introduced. Please refer to Figure 2 , which is a flow chart of a data communication method provided in an embodiment of the present application.

[0153] S201, obtaining a first private key and a second public key based on a key dynamic library loaded in a target application.

[0154] The first private key is a private key in the first key pair generated by the key dynamic library for the target application. Each application can be associated with a key dynamic library for generating a key pair for it. Before being loaded in the corresponding application, each key dynamic library is the same dynamic library and executes the same key generation strategy. After being loaded in the corresponding application, it is the key dynamic library corresponding to the corresponding application, and generates and manages the corresponding key for the corresponding application. In the embodiment of the present application, only the key dynamic library of the target application is introduced. The key dynamic libraries of other applications are similar and will not be repeated here.

[0155] The second public key is a public key in the second key pair generated by the server running the target application for the target application. The second public key in the second key pair generated by the server for the target application can be stored in the key dynamic library, so that key exchange can be achieved without sending and receiving messages between the client and the server, reducing the possibility of key leakage and improving data security during data communication.

[0156] As an embodiment, before loading the key dynamic library, the client may first verify whether the key dynamic library has been tampered with, etc., to ensure data security.

[0157] The server can provide a dynamic library acquisition interface for the client. The client can obtain the download address and reference hash value of the key dynamic library from the server based on the pre-stored dynamic library acquisition interface. The client downloads the key dynamic library from the download address. Based on the binary format, the key dynamic library is formatted and the binary file of the key dynamic library is obtained. The binary file is hashed to obtain the target hash value. When it is determined that the target hash value matches the reference hash value, the key dynamic library is loaded into the sandbox environment of the target application.

[0158] By loading in the sandbox environment of the target application, the permissions of the application can be restricted to prevent other malicious or erroneous applications from accessing the private data in the target application or causing damage to the target application.

[0159] As an embodiment, when obtaining the first private key and the second public key based on the key dynamic library loaded in the target application, the key dynamic library may be used to perform the following steps:

[0160] Generate a first key pair based on the key generation strategy. The first key pair includes: a first public key and a first private key. Use the symmetric key obtained from the server to encrypt the first public key to obtain a symmetric encryption public key. Send the symmetric encryption public key to the server so that the server uses the symmetric key to decrypt the received symmetric encryption public key to obtain the first public key, and generate a second key pair based on the key generation strategy, and use the first public key to encrypt the second public key in the second key pair to obtain a second encrypted public key, and return the second encrypted public key; wherein the second key pair includes the second public key and the second private key. Use the first private key to decrypt the second encrypted public key to obtain the second public key.

[0161] The key generation strategy is, for example, a GMSM library, etc., which is not specifically limited. The symmetric key can be generated based on the symmetric key generation strategy, which is, for example, a commercial cryptography SM4 (Cryptography Algorithm SM4, SM4) strategy or an AES strategy, etc., which is not specifically limited.

[0162] As an embodiment, before using the symmetric key obtained from the server to encrypt the first public key and obtain the symmetric encryption public key, the symmetric key can be obtained from the server for storage. For example, the symmetric key can be pre-acquired when the computing resource occupancy of the client is low; for another example, the symmetric key can be pre-acquired when the communication resource occupancy rate between the client and the server is low, etc., for subsequent direct use, thereby improving data processing efficiency during data communication.

[0163] The client can send a symmetric key acquisition instruction to the server, so that the server returns a symmetric encryption key and a reference key. The symmetric encryption key is obtained by the server using the reference key to encrypt the generated symmetric key.

[0164] Then the client can use the key dynamic library to perform the following steps: segment the symmetric encryption key to obtain multiple encryption key segments. Reverse the multiple encryption key segments to obtain corresponding reverse key segments. Store the obtained reverse key segments and the reference key.

[0165] Please refer to Figure 3 , the symmetric encryption key includes 01, 02, ... and 16. The symmetric encryption key can be segmented according to the preset number of segments (such as 4) to obtain 4 encryption key segments, including the first encryption key segment, the second encryption key segment, the third encryption key segment and the fourth encryption key segment. The first encryption key segment includes 01, 02, 03 and 04; the second encryption key segment includes 05, 06, 07 and 08; the third encryption key segment includes 09, 10, 11 and 12; the fourth encryption key segment includes 13, 14, 15 and 16.

[0166] After reversing each encryption key segment, four reverse key segments are obtained, including the first reverse key segment, the second reverse key segment, the third reverse key segment and the fourth reverse key segment. The first reverse key segment contains 04, 03, 02 and 01; the second reverse key segment contains 08, 07, 06 and 05; the third reverse key segment contains 12, 11, 10 and 09; the fourth reverse key segment contains 16, 15, 14 and 13.

[0167] As an embodiment, when a symmetric key is needed, each stored reverse key segment and reference key can be obtained from the key dynamic library. Each reverse key segment is processed in reverse order to obtain a corresponding encryption key segment. Each obtained encryption key segment is spliced ​​to obtain a symmetric encryption key. The reference key is used to decrypt the symmetric encryption key to obtain the symmetric key. Thus, the obtained symmetric key can be used to encrypt the first public key to obtain a symmetric encryption public key.

[0168] S202: Use the second public key to encrypt the data request generated by the target application to obtain an encrypted data request.

[0169] Since the second public key is generated by the server, the server also stores the corresponding second private key. After receiving the encrypted data request, the server can use the second private key to decrypt and obtain the data request to return the corresponding response data.

[0170] S203, sending an encrypted data request to the server.

[0171] The client sends an encrypted data request to the server, and the server receives the encrypted data request sent by the client. The server can use the second private key in the second key pair to decrypt the received encrypted data request, obtain the data request, and return an encrypted data response encrypted by the pre-stored first public key based on the data request. The first public key is: the public key in the first key pair. After generating the first key pair, the key dynamic library can upload the first public key to the server so that the server obtains the pre-stored first public key.

[0172] The encrypted data request may be sent in the form of a network request or in the form of a message, without any specific restriction.

[0173] S204, when the encrypted data response is received, the encrypted data response is decrypted using the first private key to obtain a data response of the target application.

[0174] After receiving the encrypted data response returned by the server, the client can use the first private key to decrypt the encrypted data response to obtain the data response of the target application, thereby realizing data communication between the client and the server.

[0175] Next, we will continue based on Figure 1 , from the perspective of the server running the target application, the data communication method provided by the embodiment of the present application is specifically introduced. Please refer to Figure 4 , which is a flow chart of a data communication method provided in an embodiment of the present application.

[0176] S401, receiving an encrypted data request sent by a client having a target application installed thereon.

[0177] The encrypted data request is obtained by the client using the second public key to encrypt the data request generated by the target application. For details, please refer to the previous introduction and will not be repeated here. The second public key is the public key in the second key pair generated by the server for the target application, which is obtained by the client based on the key dynamic library loaded in the target application. For details, please refer to the previous introduction and will not be repeated here.

[0178] After the client with the target application installed sends an encrypted data request to the server, the server receives the encrypted data request sent by the client.

[0179] S402: Use the second private key in the second key pair to decrypt the encrypted data request to obtain a data request.

[0180] The server uses the second private key in the second key pair to decrypt the encrypted data request and obtain the data request, thereby obtaining corresponding response data based on the data request.

[0181] As an embodiment, when the server exchanges the first public key and the second public key with the client through the key dynamic library, encryption may be performed to ensure key security.

[0182] After the server generates a symmetric key based on the symmetric encryption strategy, it can wait to receive a symmetric key acquisition instruction for the symmetric key from the key dynamic library of the target application. The symmetric encryption strategy is, for example, the SM4 strategy or the AES strategy, which is not specifically limited.

[0183] When receiving a symmetric key acquisition instruction for a symmetric key from the key dynamic library, the symmetric key is returned to the key dynamic library, so that the key dynamic library uses the symmetric key to encrypt the first public key to obtain the symmetric encryption public key. Thus, when the server receives the symmetric encryption public key, it uses the symmetric key to decrypt the symmetric encryption public key to obtain the first public key.

[0184] The server generates a second key pair based on the key generation strategy. The second key pair includes a second public key and a second private key. The key generation strategy is, for example, a GMSM library, etc., which is not specifically limited.

[0185] The server uses the first public key to encrypt the second public key to obtain the second encrypted public key. The server returns the second encrypted public key to the key dynamic library, so that the key dynamic library uses the first private key to decrypt the second encrypted public key to obtain the second public key.

[0186] As an embodiment, the server may save multiple reverse key segments and reference keys for the symmetric key to reduce the storage resource usage of the key dynamic library. For details, please refer to the above introduction and will not be repeated here.

[0187] The server uses a preset reference key to encrypt the symmetric key to obtain a symmetric encryption key. The symmetric encryption key is segmented to obtain multiple encryption key segments. The multiple encryption key segments are reversed to obtain corresponding reversed key segments. The multiple reversed key segments and the reference key are stored.

[0188] As an embodiment, when receiving the symmetric key acquisition instruction sent by the client, the server can obtain multiple reverse key segments and a reference key based on the symmetric key acquisition instruction. The multiple reverse key segments are respectively reversed to obtain corresponding encryption key segments. The obtained multiple encryption key segments are spliced ​​to obtain a symmetric encryption key. The reference key is used to decrypt the symmetric encryption key to obtain the symmetric key. Thus, the symmetric key can be returned to the key dynamic library.

[0189] S403: Use a pre-stored first public key to encrypt a data response obtained based on the data request to obtain an encrypted data response.

[0190] The server uses the first public key uploaded by the key dynamic library of the target application to encrypt the data response obtained based on the data request, and can obtain the encrypted data response.

[0191] S404, sending an encrypted data response to the client.

[0192] The server sends an encrypted data response to the client so that the client uses the first private key to decrypt the received encrypted data response to obtain a data response of the target application.

[0193] The server sends an encrypted data response to the client, for example, in the form of a network protocol or a message, so that the client uses the first private key to decrypt the received encrypted data response to obtain the data response of the target application. The first private key is a private key in the first key pair generated by the key dynamic library for the target application.

[0194] The following is an example of the data communication method provided in the embodiment of the present application. Figure 5 .

[0195] S501: The first server that creates a key dynamic library may first create an initial dynamic library.

[0196] S502, adding function codes to the initial dynamic library to complete the creation of the key dynamic library.

[0197] The adding function code includes, for example, generating an SM2 key pair based on the GMSM library, which are a first public key SM2_PublicKey_C and a first private key SM2_PrivateKey_C. Obtaining a symmetric key SM4Key from a second server running the target application. Encrypting the first public key SM2_PublicKey_C using the symmetric key SM4Key to obtain a symmetric encrypted public key SM2_PublicKey_C_E. The symmetric encryption public key SM2_PublicKey_C_E is uploaded to the second server, so that after receiving the symmetric encryption public key SM2_PublicKey_C_E, the second server uses the symmetric key SM4Ke to decrypt the symmetric encryption public key SM2_Public_C_E to obtain the first public key SM2_Public_C; and the second server generates an SM2 key pair based on the GMSM library, including the second public key SM2_PublicKey_S and the second private key SM2_PrivateKey_S; and the second server uses the first public key SM2_PublicKey_C to encrypt the second public key SM2_PublicKey_S to obtain the second encrypted public key SM2_PublicKey_S_E; and the second encrypted public key SM2_PublicKey_S_E is returned to the key dynamic library. The key dynamic library uses the first private key SM2_PrivateKey_C to decrypt the second encrypted public key SM2_PublicKey_S_E to obtain the second public key SM2_PublicKey_S. Therefore, after loading the key dynamic library, the client having the target application installed thereon can obtain the first private key and the second public key based on the key dynamic library.

[0198] The first server packages the initial dynamic library with the above function code added into a key dynamic library, which is recorded as DynamicCrypto.framework.

[0199] S503, the first server calculates the hash value of the key dynamic library DynamicCrypto.framework to obtain a reference hash value.

[0200] S504: The first server sends the key dynamic library DynamicCrypto.framework and its reference hash value to the second server, so that the second server records the download address of the key dynamic library DynamicCrypto.framework and the reference hash value of the key dynamic library DynamicCrypto.framework.

[0201] S505: The client starts the target application.

[0202] S506, after the client starts the target application, it can obtain the download address of the key dynamic library DynamicCrypto.framework and the reference hash value of the key dynamic library DynamicCrypto.framework through the interface provided by the second server.

[0203] S507, after the client downloads the key dynamic library DynamicCrypto.framework from the download address, it calculates the hash value of the key dynamic library DynamicCrypto.framework to obtain the target hash value.

[0204] S508, when it is determined that the target hash value is the same as or similar to the reference hash value obtained from the second server, the key dynamic library DynamicCrypto.framework is loaded into the sandbox environment of the target application; otherwise, the download address of the key dynamic library DynamicCrypto.framework and the hash value of the key dynamic library DynamicCrypto.framework are re-acquired; or the key dynamic library DynamicCrypto.framework is re-downloaded, etc.

[0205] S509: The client obtains the first private key and the second public key based on the loaded key dynamic library DynamicCrypto.framework.

[0206] S510: When the target application generates a data request, the data request is encrypted using the second public key to generate a data encryption request.

[0207] S511: The client sends an encrypted data request to the second server, and the second server receives the encrypted data request sent by the client.

[0208] S512: The second server uses the second private key to decrypt the encrypted data request to obtain a data request.

[0209] S513: The second server obtains a corresponding data response based on the data request.

[0210] S514: Encrypt the data response using the first public key to obtain an encrypted data response.

[0211] S515, the second server sends an encrypted data response to the client, and the client receives the encrypted data response sent by the second server.

[0212] S516, the client uses the first private key to decrypt the encrypted data response to obtain a data response, thereby completing the data communication between the client and the second server.

[0213] In the embodiment of the present application, the logic of key exchange is implemented by means of a dynamic library, thereby ensuring the logical security of key exchange. The key used to encrypt the public key is not directly hard-coded in the application source code, and the key used to encrypt the public key cannot be obtained by means of shelling, decompilation, etc., thereby avoiding logical security vulnerabilities. The SM4Key used to encrypt the public key is encrypted and saved in segments to the dynamic library. The dynamic library is dynamically loaded during runtime and will not be directly packaged into the application, thereby protecting the SM4Key.

[0214] Based on the same inventive concept, the embodiment of the present application provides a data communication device that can implement the functions corresponding to the aforementioned data communication method applied to the client. Figure 6 , the device includes a processing module 601 and a transceiver module 602, wherein:

[0215] Processing module 601: used to obtain a first private key and a second public key based on a key dynamic library loaded in a target application; wherein the first private key is: a private key in a first key pair generated by the key dynamic library for the target application; and the second public key is: a public key in a second key pair generated by a server running the target application for the target application;

[0216] The processing module 601 is further used to: use the second public key to encrypt the data request generated by the target application to obtain the encrypted data request;

[0217] The transceiver module 602 is used to send an encrypted data request to the server, so that the server uses the second private key in the second key pair to decrypt the received encrypted data request, obtain the data request, and return an encrypted data response encrypted by using the pre-stored first public key based on the data request; wherein the first public key is: the public key in the first key pair;

[0218] The transceiver module 602 is further used to: upon receiving an encrypted data response, decrypt the encrypted data response using the first private key to obtain a data response of the target application.

[0219] Optionally, the processing module 601 is further used for:

[0220] Before obtaining the first private key and the second public key based on the key dynamic library loaded in the target application, obtaining the download address and the reference hash value of the key dynamic library from the server based on a pre-stored dynamic library acquisition interface;

[0221] Download the key dynamic library from the download address;

[0222] Based on the binary format, the key dynamic library is converted into a format to obtain a binary file of the key dynamic library;

[0223] Hash the binary file to obtain the target hash value;

[0224] When it is determined that the target hash value matches the reference hash value, the key dynamic library is loaded in the sandbox environment of the target application.

[0225] Optionally, the processing module 601 is specifically used for:

[0226] Using the key dynamic library, perform the following steps:

[0227] Generate a first key pair based on the key generation strategy; wherein the first key pair includes: a first public key and a first private key;

[0228] Using the symmetric key obtained from the server to encrypt the first public key, obtaining a symmetric encryption public key;

[0229] Sending the symmetric encryption public key to the server, so that the server uses the symmetric key to decrypt the received symmetric encryption public key to obtain the first public key, and based on the key generation strategy, generates a second key pair, and uses the first public key to encrypt the second public key in the second key pair to obtain the second encrypted public key, and returns the second encrypted public key; wherein the second key pair includes the second public key and the second private key;

[0230] The second encrypted public key is decrypted using the first private key to obtain the second public key.

[0231] Optionally, the transceiver module 602 is further used for:

[0232] Before using the symmetric key obtained from the server to encrypt the first public key to obtain the symmetric encryption public key, sending a symmetric key acquisition instruction to the server so that the server returns the symmetric encryption key and the reference key; wherein the symmetric encryption key is obtained by: the server uses the reference key to encrypt the generated symmetric key;

[0233] The processing module 601 is further used for:

[0234] Using the key dynamic library, perform the following steps:

[0235] Segmenting the symmetric encryption key to obtain multiple encryption key segments;

[0236] Reverse processing is performed on the plurality of encryption key segments respectively to obtain corresponding reverse key segments;

[0237] The obtained reverse key segments and reference keys are stored.

[0238] Optionally, the processing module 601 is specifically used for:

[0239] Obtaining the stored reverse key segments and reference keys;

[0240] Reverse the order of each reverse key segment to obtain the corresponding encryption key segment;

[0241] Concatenate the obtained encryption key segments to obtain a symmetric encryption key;

[0242] Decrypting the symmetric encryption key using the reference key to obtain the symmetric key;

[0243] The obtained symmetric key is used to encrypt the first public key to obtain a symmetric encryption public key.

[0244] Based on the same inventive concept, the embodiment of the present application provides a data communication device that can implement the functions corresponding to the aforementioned data communication method applied to the server. Figure 7 , the device includes a transceiver module 701 and a processing module 702, wherein:

[0245] The transceiver module 701 is used to receive an encrypted data request sent by a client having a target application installed thereon; wherein the encrypted data request is obtained by encrypting a data request generated by the target application by the client using a second public key; the second public key is a public key in a second key pair generated by the server for the target application and obtained based on a key dynamic library loaded in the target application;

[0246] Processing module 702: used to decrypt the encrypted data request using the second private key in the second key pair to obtain a data request;

[0247] The processing module 702 is further used to: use a pre-stored first public key to encrypt a data response obtained based on the data request to obtain an encrypted data response;

[0248] The transceiver module 701 is also used to send an encrypted data response to the client, so that the client uses the first private key to decrypt the received encrypted data response to obtain a data response of the target application; wherein the first private key is: the private key in the first key pair generated by the key dynamic library for the target application.

[0249] Optionally, the processing module 702 is further configured to:

[0250] Before decrypting the encrypted data request using the second private key in the second key pair to obtain the data request, generating a symmetric key based on the symmetric encryption strategy;

[0251] The transceiver module 701 is also used for:

[0252] When receiving a symmetric key acquisition instruction for the symmetric key from the key dynamic library, returning the symmetric key to the key dynamic library, so that the key dynamic library uses the symmetric key to encrypt the first public key to obtain the symmetric encryption public key;

[0253] The processing module 702 is further configured to:

[0254] When receiving the symmetric encryption public key, decrypt the symmetric encryption public key using the symmetric key to obtain the first public key;

[0255] Based on the key generation strategy, generate a second key pair; wherein the second key pair includes a second public key and a second private key;

[0256] Encrypting the second public key using the first public key to obtain a second encrypted public key;

[0257] The transceiver module 701 is also used for:

[0258] The second encrypted public key is returned to the key dynamic library, so that the key dynamic library uses the first private key to decrypt the second encrypted public key to obtain the second public key.

[0259] Optionally, the processing module 702 is further configured to:

[0260] Upon receiving a symmetric key acquisition instruction from the key dynamic library for a symmetric key, before returning the symmetric key to the key dynamic library, encrypting the symmetric key using a preset reference key to obtain a symmetric encryption key;

[0261] Segmenting the symmetric encryption key to obtain multiple encryption key segments;

[0262] Reverse the order of the multiple encryption key segments to obtain corresponding reverse order key segments;

[0263] The obtained multiple reverse key segments and reference keys are stored.

[0264] Optionally, the processing module 702 is specifically configured to:

[0265] Based on the symmetric key acquisition instruction, a plurality of reverse key segments and a reference key are acquired;

[0266] Reverse processing is performed on the multiple reverse key segments respectively to obtain corresponding encryption key segments;

[0267] Concatenate the obtained multiple encryption key segments to obtain a symmetric encryption key;

[0268] Decrypting the symmetric encryption key using the reference key to obtain the symmetric key;

[0269] Returns a symmetric key to the key dynamic store.

[0270] Please refer to Figure 8 , is a computer device 800 provided in an embodiment of the present application, and the computer device 800 can be, for example, Figure 1The client 101 or the server 102 in the data storage program. The current version and the historical version of the data storage program and the application software corresponding to the data storage program can be installed on the computer device 800, and the computer device 800 includes a processor 880 and a memory 820. In some embodiments, the computer device 800 may include a display unit 840, and the display unit 840 includes a display panel 841 for displaying a user interactive operation interface, etc.

[0271] In a possible embodiment, the display panel 841 may be configured in the form of a liquid crystal display (LCD) or an organic light-emitting diode (OLED).

[0272] The processor 880 is used to read the computer program and then execute the method defined by the computer program. For example, the processor 880 reads the data storage program or file, so as to run the data storage program on the computer device 800 and display the corresponding interface on the display unit 840. The processor 880 may include one or more general-purpose processors and may also include one or more DSPs (Digital Signal Processors) to perform related operations to implement the technical solutions provided in the embodiments of the present application.

[0273] The memory 820 generally includes internal memory and external memory, and the internal memory may be a random access memory (RAM), a read-only memory (ROM), and a cache (CACHE), etc. The external memory may be a hard disk, an optical disk, a USB disk, a floppy disk, or a tape drive, etc. The memory 820 is used to store computer programs and other data, and the computer program includes applications corresponding to each client, etc. Other data may include data generated after the operating system or application is run, and the data includes system data (such as configuration parameters of the operating system) and user data. In the embodiment of the present application, the computer program is stored in the memory 820, and the processor 880 executes the computer program in the memory 820 to implement any of the methods discussed in the previous figure.

[0274] The display unit 840 is used to receive input digital information, character information or contact touch operation / contactless gesture, and generate signal input related to user settings and function control of the computer device 800. Specifically, in the embodiment of the present application, the display unit 840 may include a display panel 841. The display panel 841 is, for example, a touch screen, which can collect user touch operations on or near it (such as operations performed by the user using fingers, stylus, or any other suitable object or accessory on or on the display panel 841), and drive corresponding connection devices according to a pre-set program.

[0275] In a possible embodiment, the display panel 841 may include two parts: a touch detection device and a touch controller. The touch detection device detects the touch position of the player, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 880, and can receive and execute the command sent by the processor 880.

[0276] The display panel 841 may be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the display unit 840, in some embodiments, the computer device 800 may further include an input unit 830, which may include an image input device 831 and other input devices 832, wherein the other input devices may include, but are not limited to, one or more of a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0277] In addition to the above, the computer device 800 may also include a power supply 890 for supplying power to other modules, an audio circuit 860, a near field communication module 870, and an RF circuit 810. The computer device 800 may also include one or more sensors 850, such as an acceleration sensor, a light sensor, a pressure sensor, etc. The audio circuit 860 specifically includes a speaker 861 and a microphone 862, etc. For example, the computer device 800 can collect the user's voice through the microphone 862 and perform corresponding operations.

[0278] As an embodiment, the number of processors 880 may be one or more, and the processor 880 and the memory 820 may be coupled or relatively independently configured.

[0279] As an example, Figure 8 The processor 880 in the embodiment may be used to implement the following Figure 6 The functions of the processing module 601 and the transceiver module 602 in FIG. 601 can also be used to implement the following Figure 7 The functions of the transceiver module 701 and the processing module 702 in.

[0280] As an example, Figure 8 The processor 880 in can be used to implement the corresponding functions of the server or terminal device discussed above.

[0281] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by a computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When the computer program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: a mobile storage device, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0282] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product, for example, through a computer program product, which is stored in a storage medium, including a computer program for a computer device to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.

[0283] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A data communication method, It is characterized in that Applied to the client with the target application installed, including: Based on the key dynamic library loaded in the target application, a first private key and a second public key are obtained; wherein the first private key is: a private key in a first key pair generated by the key dynamic library for the target application; and the second public key is: a public key in a second key pair generated by a server running the target application for the target application; Using the second public key, encrypting the data request generated by the target application to obtain an encrypted data request; Sending the encrypted data request to the server, so that the server uses the second private key in the second key pair to decrypt the received encrypted data request, obtain the data request, and return an encrypted data response encrypted by using the pre-stored first public key based on the data request; wherein the first public key is: the public key in the first key pair; When the encrypted data response is received, the encrypted data response is decrypted using the first private key to obtain the data response of the target application.

2. The method according to claim 1, It is characterized in that Before acquiring the first private key and the second public key based on the key dynamic library loaded in the target application, the method further includes: Based on a pre-stored dynamic library acquisition interface, obtain the download address and reference hash value of the key dynamic library from the server; Download the key dynamic library from the download address; Based on the binary format, the key dynamic library is formatted and a binary file of the key dynamic library is obtained; Performing hash processing on the binary file to obtain a target hash value; When it is determined that the target hash value matches the reference hash value, the key dynamic library is loaded into the sandbox environment of the target application.

3. The method according to claim 1 or 2, It is characterized in that The obtaining of the first private key and the second public key based on the key dynamic library loaded in the target application includes: Using the key dynamic library, perform the following steps: Generate a first key pair based on the key generation strategy; wherein the first key pair includes: a first public key and a first private key; Using the symmetric key obtained from the server to encrypt the first public key, to obtain a symmetric encryption public key; Sending the symmetric encryption public key to the server, so that the server uses the symmetric key to decrypt the received symmetric encryption public key to obtain the first public key, and based on the key generation strategy, generates a second key pair, and uses the first public key to encrypt the second public key in the second key pair to obtain a second encrypted public key, and returns the second encrypted public key; wherein the second key pair includes the second public key and the second private key; The second encrypted public key is decrypted using the first private key to obtain a second public key.

4. The method according to claim 3, It is characterized in that Before the symmetric key obtained from the server is used to encrypt the first public key to obtain the symmetric encryption public key, the method further includes: Sending a symmetric key acquisition instruction to the server, so that the server returns a symmetric encryption key and a reference key; wherein the symmetric encryption key is obtained by: the server uses the reference key to encrypt the generated symmetric key; Using the key dynamic library, perform the following steps: Segmenting the symmetric encryption key to obtain multiple encryption key segments; Reverse-process the multiple encryption key segments respectively to obtain corresponding reverse-order key segments; The obtained reverse key segments and the reference key are stored.

5. The method according to claim 4, It is characterized in that The step of using the symmetric key obtained from the server to encrypt the first public key to obtain the symmetric encryption public key includes: Obtaining the stored reverse key segments and the reference key; Reverse processing is performed on each of the reverse key segments to obtain a corresponding encryption key segment; Concatenate the obtained encryption key segments to obtain the symmetric encryption key; Decrypting the symmetric encryption key using the reference key to obtain the symmetric key; The first public key is encrypted using the obtained symmetric key to obtain a symmetric encryption public key.

6. A data communication method, It is characterized in that Applied to the server running the target application, including: Receiving an encrypted data request sent by a client having the target application installed; wherein the encrypted data request is obtained by encrypting the data request generated by the target application by the client using a second public key; the second public key is a public key in a second key pair generated by the server for the target application and obtained based on a key dynamic library loaded in the target application; Decrypting the encrypted data request using the second private key in the second key pair to obtain a data request; Using a pre-stored first public key to encrypt a data response obtained based on the data request to obtain an encrypted data response; The encrypted data response is sent to the client so that the client uses the first private key to decrypt the received encrypted data response to obtain the data response of the target application; wherein the first private key is: the private key in the first key pair generated by the key dynamic library for the target application.

7. The method according to claim 6, It is characterized in that Before decrypting the encrypted data request using the second private key in the second key pair to obtain the data request, the method further includes: Generate a symmetric key based on the symmetric encryption strategy; When receiving a symmetric key acquisition instruction from the key dynamic library for the symmetric key, returning the symmetric key to the key dynamic library, so that the key dynamic library uses the symmetric key to encrypt the first public key to obtain a symmetric encryption public key; When receiving the symmetric encryption public key, decrypting the symmetric encryption public key using the symmetric key to obtain the first public key; Based on the key generation strategy, generate a second key pair; wherein the second key pair includes a second public key and a second private key; Encrypting the second public key using the first public key to obtain a second encrypted public key; The second encrypted public key is returned to the key dynamic library, so that the key dynamic library uses the first private key to decrypt the second encrypted public key to obtain a second public key.

8. The method according to claim 7, It is characterized in that When receiving the symmetric key acquisition instruction from the key dynamic library for the symmetric key, before returning the symmetric key to the key dynamic library, the method further includes: Using a preset reference key to encrypt the symmetric key to obtain a symmetric encryption key; Segmenting the symmetric encryption key to obtain multiple encryption key segments; Reverse order processing is performed on the plurality of encryption key segments respectively to obtain corresponding reverse order key segments; The obtained multiple reverse key segments and the reference key are stored.

9. The method according to claim 8, It is characterized in that When receiving a symmetric key acquisition instruction for the symmetric key from the key dynamic library loaded in the client, returning the symmetric key to the key dynamic library comprises: Based on the symmetric key acquisition instruction, acquiring a plurality of reverse key segments and the reference key; Reverse processing is performed on the multiple reverse key segments respectively to obtain corresponding encryption key segments; Concatenate the obtained multiple encryption key segments to obtain the symmetric encryption key; Decrypting the symmetric encryption key using the reference key to obtain the symmetric key; The symmetric key is returned to the key dynamic store.

10. A data communication device, It is characterized in that Applied to the client with the target application installed, including: A processing module: used to obtain a first private key and a second public key based on a key dynamic library loaded in the target application; wherein the first private key is: a private key in a first key pair generated by the key dynamic library for the target application; and the second public key is: a public key in a second key pair generated by a server running the target application for the target application; The processing module is further used to: use the second public key to encrypt the data request generated by the target application to obtain an encrypted data request; The transceiver module is used to send the encrypted data request to the server, so that the server uses the second private key in the second key pair to decrypt the received encrypted data request, obtain the data request, and return an encrypted data response encrypted by using the pre-stored first public key based on the data request; wherein the first public key is: the public key in the first key pair; The transceiver module is further configured to: upon receiving the encrypted data response, decrypt the encrypted data response using the first private key to obtain a data response of the target application.

11. A data communication device, It is characterized in that Applied to the server running the target application, including: The transceiver module is used to receive an encrypted data request sent by a client having the target application installed thereon; wherein the encrypted data request is obtained by encrypting the data request generated by the target application by the client using a second public key; the second public key is a public key in a second key pair generated by the server for the target application and obtained based on a key dynamic library loaded in the target application; Processing module: used to use the second private key in the second key pair to decrypt the encrypted data request to obtain a data request; The processing module is further used to: encrypt the data response obtained based on the data request using a pre-stored first public key to obtain an encrypted data response; The transceiver module is also used to: send the encrypted data response to the client, so that the client uses the first private key to decrypt the received encrypted data response to obtain the data response of the target application; wherein, the first private key is: the private key in the first key pair generated by the key dynamic library for the target application.

12. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

13. A computer device, It is characterized in that include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 9 according to the obtained program instructions.

14. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method and apparatus for performing encryption and decryption by using white box library file and white box key file

    CN108183796A

  • Encrypted communication method and device

    CN112968899A

  • Dynamic library processing method and device thereof, electronic equipment and storage medium

    CN113177222A

  • Encryption method and device, equipment and storage medium

    CN115037458A

  • Key loading method, key system and readable storage medium

    CN116506120A

Cited By

  • Record-level encryption scheme for data ownership platform

    EP4679767A1

  • Record-level encryption scheme for data ownership platform

    WO2026003719A1