Data transmission method, device, electronic device and storage medium
By using temporary public and private key pairs for data encryption and decryption in the Internet of Vehicles, and generating key indexes instead of data transmission, the security risks and efficiency problems of data transmission in the Internet of Vehicles are solved, and information security and data transmission efficiency are improved.
Patent Information
- Application Number
- CN202310606073.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-26
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2043-05-26
AI Technical Summary
There are security risks in data transmission in the Internet of Vehicles, especially due to the risk of man-in-the-middle attacks during HTTPS communication, and high-level encryption methods will affect the efficiency and bandwidth of data unpacking and unpacking, limiting the active transmission of massive data.
By receiving the first session token sent after the authentication request sent by the terminal has been verified by the server, the second session token is generated and sent to the server to generate a temporary public key and private key pair. The temporary public key is used to encrypt the data. Receive The server generates a key index based on decryption of the temporary private key, and subsequently uses the key index instead of data transmission to avoid repeated authentication.
It improves the security and efficiency of data transmission, reduces the risk of user data leakage, improves information security, and eliminates the need for repeated authentication and additional overhead.
Smart Images

Figure CN116865993B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information security technology, and in particular to a data transmission method, device, electronic device and storage medium. Background Art
[0002] With the development of the Internet of Vehicles, cars have more and more attributes as driving tools. In particular, the concept of "software-defined cars" has become popular in recent years, making cars more "intelligent" and "car-cloud integrated". As a result, more and more user data and vehicle data are transmitted between the car, the cloud, and the user's mobile phone. The data involves user privacy, including license plate number, frame number, user mobile phone number, ID number, user address, etc. Therefore, how to ensure user data security is an important task of the Internet of Vehicles. Summary of the invention
[0003] In view of this, the embodiments of the present application provide a data transmission method, device, electronic device and storage medium to solve the problem of security risks in data transmission in the Internet of Vehicles in the prior art.
[0004] According to a first aspect of an embodiment of the present application, a data transmission method is provided. The method is performed by a terminal and includes:
[0005] Sending an authentication request to a server, and receiving a first session token sent by the server after verifying the authentication request;
[0006] Performing digest calculation on the first session token to obtain a second session token;
[0007] Sending the second session token to the server so that the server generates a temporary public key and private key pair according to the session identifier and the terminal identifier in the second session token;
[0008] Receive the temporary public key sent by the server and use the temporary public key to encrypt the data;
[0009] Sending the encrypted data to the server so that the server generates a key index of the data based on the decrypted data after decrypting the data using the temporary private key;
[0010] Receive the key index sent by the server.
[0011] A second aspect of an embodiment of the present application provides a data transmission method, which is executed by a server and includes:
[0012] Receiving an authentication request from a terminal, and sending a first session token to the terminal after verifying the authentication request;
[0013] Receiving a second session token sent by the terminal, where the second session token is obtained by the terminal performing a digest calculation on the first session token;
[0014] Generate a temporary public key and private key pair according to the session identifier and the terminal identifier in the second session token, and send the temporary public key to the terminal;
[0015] The data sent by the receiving terminal is encrypted using a temporary public key;
[0016] Decrypt the data based on the temporary private key, and generate a key index of the data based on the decrypted data;
[0017] Send key index to the endpoint.
[0018] According to a third aspect of the embodiments of the present application, a data transmission device is provided, including:
[0019] A sending module, configured to send an authentication request to a server;
[0020] A receiving module is configured to receive a first session token sent by the server after the authentication request is successfully verified;
[0021] A calculation module, configured to perform a digest calculation on the first session token to obtain a second session token;
[0022] The sending module is further configured to send the second session token to the server, so that the server generates a temporary public key and private key pair according to the session identifier and the terminal identifier in the second session token;
[0023] The receiving module is also configured to receive a temporary public key sent by the server and encrypt the data using the temporary public key;
[0024] The sending module is further configured to send the encrypted data to the server, so that the server generates a key index of the data based on the decrypted data after decrypting the data using the temporary private key;
[0025] The receiving module is also configured to receive the key index sent by the server.
[0026] A fourth aspect of the embodiments of the present application provides a data transmission device, including:
[0027] A receiving module, configured to receive an authentication request from a terminal;
[0028] A sending module, configured to send a first session token to the terminal after verifying the authentication request;
[0029] The receiving module is further configured to receive a second session token sent by the terminal, where the second session token is obtained by the terminal performing a digest calculation on the first session token;
[0030] A computing module configured to generate a temporary public key and private key pair according to the session identifier and the terminal identifier in the second session token;
[0031] The sending module is also configured to send the temporary public key to the terminal;
[0032] The receiving module is also configured to receive data sent by the terminal, the data being encrypted by a temporary public key;
[0033] The computing module is further configured to decrypt the data based on the temporary private key and generate a key index of the data based on the decrypted data;
[0034] The sending module is further configured to send the key index to the terminal.
[0035] According to a fifth aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0036] In a sixth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0037] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the embodiments of the present application receive the first session token sent by the server after verifying the authentication request sent by the terminal, generate a second session token based on the first session token, and send the second session token to the server so that the server generates a temporary public key and private key pair based on the second session token and the terminal identifier, encrypts data with the temporary public key and sends it to the server, receives the key index generated by the server after decrypting the data based on the temporary private key, and can replace the data with the key index when subsequently transmitting the data between the server, thereby improving the security of data transmission and eliminating the need for repeated authentication, thereby improving the efficiency of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0039] Figure 1 It is a scenario diagram of an application scenario of an embodiment of the present application.
[0040] Figure 2 This is a schematic diagram of vehicle-cloud interaction.
[0041] Figure 3 It is a flow chart of a data transmission method provided in an embodiment of the present application.
[0042] Figure 4 It is a flow chart of a data transmission method provided in an embodiment of the present application.
[0043] Figure 5 It is a flow chart of a data transmission method provided in an embodiment of the present application.
[0044] Figure 6 It is a flow chart of a data transmission method provided in an embodiment of the present application.
[0045] Figure 7 It is a flow chart of a data transmission method provided in an embodiment of the present application.
[0046] Figure 8 It is an interaction diagram of the data transmission method provided in an embodiment of the present application.
[0047] Fig. 9 It is a schematic diagram of a data transmission device provided in an embodiment of the present application.
[0048] Fig.10 It is a schematic diagram of a data transmission device provided in an embodiment of the present application.
[0049] Fig.11 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0051] A data transmission method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.
[0052] Figure 1 1 is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario may include a cloud server 1, a mobile terminal 2, a vehicle 3 and a network 4.
[0053] The cloud server 1 may be a server that provides vehicle management services, for example, a backend server that receives a request sent by a mobile terminal 2 or a vehicle 3 that establishes a communication connection with the backend server, and the backend server may receive and analyze the request sent by the mobile terminal 2 or the vehicle 3, and generate a processing result. The cloud server 1 may be a single server, or a server cluster composed of several servers, or a cloud computing service center, and these servers together constitute a vehicle management platform, which is not limited in the present application embodiment.
[0054] The mobile terminal 2 can be hardware or software. When the mobile terminal 2 is hardware, it can be various electronic devices with a display screen and supporting communication with the server 1 and the vehicle 3, including but not limited to smart phones, tablet computers, laptop computers and desktop computers; when the mobile terminal 2 is software, it can be installed in the above electronic devices. The mobile terminal 2 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present application are not limited to this. Furthermore, various applications can be installed on the mobile terminal 2, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.
[0055] Vehicle 3 can be hardware or software. When vehicle 3 is hardware, it can be various electronic devices with a display screen and supporting communication with server 1 and mobile terminal 2, including but not limited to a vehicle-mounted control unit, a vehicle-mounted entertainment system, etc.; when vehicle 3 is software, it can be installed in the above electronic devices. Vehicle 3 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present application are not limited to this. Vehicle 3 has a vehicle-mounted unit. The vehicle-mounted unit has a communication function, a simple processing function and a limited storage function.
[0056] The network 4 can be a wired network connected by coaxial cable, twisted pair and optical fiber, or it can be a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present application.
[0057] The user can directly establish a communication connection with the server 1 via the network 4 through the vehicle 3 to receive or send information related to the vehicle data. On the other hand, the user can establish a communication connection with the server 1 via the network 4 through the mobile terminal 2 to receive or send information related to the vehicle data.
[0058] It should be noted that the specific types, quantities and combinations of the server 1, mobile terminal 2, vehicle 3 and network 4 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present application do not limit this.
[0059] As mentioned above, more and more user data and vehicle data are being transmitted between the vehicle, the cloud, and the user's mobile phone. The data involves user privacy, including license plate number, frame number, user mobile phone number, ID number, user address, etc. The current Internet of Vehicles architecture includes the vehicle, cloud, and user terminal, and the cloud is composed of many different business systems. The data facing the user side mainly includes the vehicle and user terminals. The vehicle-side data involves user privacy, including license plate number, frame number, etc. The user terminal involves user privacy data including user name, mobile phone number, ID number, home address, driver's license number, insurance policy information, etc.
[0060] In related technologies, the communication between the vehicle side (Telematics BOX, TBOX) and the cloud, and between the user terminal application (Application, APP) and the cloud usually uses Hypertext Transfer Protocol (HTTP) + Secure Sockets Layer (SSL), namely Hypertext Transfer Protocol Secure (HTTPS). HTTPS can ensure communication security to a certain extent, but there are still loopholes. In recent years, there have been many man-in-the-middle attacks on the vehicle side and user terminals, which is a wake-up call for the security of the Internet of Vehicles.
[0061] Figure 2 This is a schematic diagram of vehicle-cloud interaction. Figure 2 As shown, TBOX and the cloud, APP and the cloud can respectively perform two-way data transmission. In other words, the vehicle side can communicate with the cloud, and similarly, the user terminal can also communicate with the cloud. Furthermore, the vehicle side and the cloud can communicate based on HTTPS, and the user terminal and the cloud can also communicate based on HTTPS.
[0062] In the Internet of Vehicles, since neither TBOX nor APP can safely pre-set the security certificates (Certificate Authority, CA) of major manufacturers like computer operating systems, and TBOX and APP themselves also have security vulnerabilities, this provides opportunities for man-in-the-middle attacks. At the same time, since asymmetric + symmetric data encryption is usually used in the HTTPS communication process, that is, asymmetric encryption is used for keys and symmetric encryption is used for data, in order to take into account the security of asymmetric encryption and the efficiency of symmetric encryption. However, for the data itself, it is protected by symmetric encryption, and the security is poor. Furthermore, if a higher level of encryption is required, such as the use of private protocols, two-way authentication, asymmetric encryption, etc., it will affect the efficiency of data transmission and data unpacking, and will also limit the size of the transmitted data, which will have an adverse impact on the massive active data in the Internet of Vehicles.
[0063] In view of this, an embodiment of the present application provides a data transmission method, which receives a first session token sent by a server after verifying an authentication request sent by a terminal, generates a second session token based on the first session token, and sends the second session token to the server so that the server generates a temporary public key and private key pair based on the second session token and a terminal identifier, encrypts data with the temporary public key and sends it to the server, receives a key index generated by the server after decrypting the data based on the temporary private key, and can replace the data with the key index when subsequently transmitting the data between the server, thereby improving the security of data transmission and eliminating the need for repeated authentication, thereby improving data transmission efficiency, enhancing information security, and reducing the risk of user data leakage.
[0064] Figure 3 It is a flow chart of a data transmission method provided in an embodiment of the present application. Figure 3 The data transmission method can be Figure 1 The mobile terminal 2 or vehicle 3 in the embodiment is executed. Figure 3 As shown, the method comprises the following steps:
[0065] In step S301, an authentication request is sent to a server, and a first session token is received after the server verifies the authentication request.
[0066] In step S302, a digest calculation is performed on the first session token to obtain a second session token.
[0067] In step S303, the second session token is sent to the server, so that the server generates a temporary public key and private key pair according to the session identifier and the terminal identifier in the second session token.
[0068] In step S304, a temporary public key sent by the server is received, and the data is encrypted using the temporary public key.
[0069] In step S305, the encrypted data is sent to the server, so that the server generates a key index of the data based on the decrypted data after decrypting the data using the temporary private key.
[0070] In step S306, the key index sent by the server is received.
[0071] In the embodiment of the present application, the terminal may be an onboard unit in a vehicle, such as a TBOX, or a user terminal, such as a user's mobile phone. The terminal may communicate with a server based on the Internet of Vehicles, and the terminal may transmit data with the server based on the Internet of Vehicles, and the data may be private data of the vehicle and the user.
[0072] In the embodiment of the present application, in order to realize the transmission of private data, the terminal first needs to perform security authentication with the server. The terminal can send an authentication request to the server, and the server sends a first session token to the terminal after verifying the authentication request. The first session token can be a session token generated by the server based on the authentication request. The terminal receives the first session token and generates a second session token based on the first session token.
[0073] In the embodiment of the present application, a software development kit (SDK) may be installed in the terminal to provide data security transmission capability. On the other hand, an encryption system may be pre-installed in the server, and an SDK interface may also be installed in the server to communicate with the SDK in the terminal through the SDK interface.
[0074] After receiving the first session token, the terminal can send the first session token to the SDK in the terminal. After the SDK in the terminal initializes the first session token, it obtains the second session token. Among them, the specific implementation method of the SDK in the terminal to initialize the first session token can be to perform a summary calculation on the session identifier (tokenUuid) of the first session token and the environment identifier of the SDK. Among them, the environment identifier of the SDK can be the external Internet Protocol (InternetProtocol, IP) address of the SDK, the device where the SDK is located, etc. Among them, the external IP of the SDK can be determined by the IP of the encryption server connected to the SDK, and the device where the SDK is located can be determined by the device number, such as the terminal identifier. Therefore, the summary calculation of the first session token can further be to perform a summary calculation on the tokenUuid of the first session token, the IP of the encryption server connected to the SDK in the terminal, and the terminal identifier. That is, the second session token = [sha256 (tokenUuid of the first session token + IP of the encryption server connected to the SDK in the terminal + terminal identifier)], where sha256() is a summary calculation function. The specific code implementation can be:
[0075] <xml>
[0076] <project>
[0077] <model> X1< / model>
[0078] <vehicle>
[0079] #First session token
[0080] <tokenone> 88212a0b-4f01-42ab-9595-17d8ad84592e4d703f12< / tokenone>
[0081] #Second session token
[0082] <tokentwo> eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtb2JpbGUiOiIyYjA wMGEyOC01YjczLTRlZDYtOGZlOS02NDIzZjg2NjhiN2YiLCJ1c2VyU2Vzc2lvbklkIjoiNWFkZDM3Y< / tokentwo>
[0083] < / vehicle>
[0084] < / project>
[0085] < / xml>
[0086] In the embodiment of the present application, the terminal sends the second session token to the server. After receiving the second session token, the server obtains the unique session identifier in the second session token, generates a temporary public key and private key pair in combination with the terminal identifier, such as the current device number of the terminal, and sends the temporary public key to the terminal, so that the terminal can encrypt data based on the temporary public key.
[0087] In the embodiment of the present application, the terminal sends the data encrypted by the temporary public key to the server, and the server decrypts the data by using the temporary private key and generates a key index of the data based on the decrypted data. The server saves the key index in the cache and sends the key index to the terminal.
[0088] According to the technical solution provided in the embodiment of the present application, a first session token is sent by the receiving server after verifying the authentication request sent by the terminal, a second session token is generated based on the first session token, and the second session token is sent to the server so that the server generates a temporary public key and private key pair based on the second session token and the terminal identifier, data is encrypted using the temporary public key and sent to the server, and a key index is generated after the receiving server decrypts the data based on the temporary private key. When the data is subsequently transmitted between the server, the key index can be used instead of the data, which improves the security of data transmission and does not require repeated authentication, thereby improving data transmission efficiency, enhancing information security, and reducing the risk of user data leakage.
[0089] In the embodiment of the present application, the terminal and the server can communicate based on the Transmission Control Protocol (TCP) and SSL, and use the preset public key to encrypt the communication message. Further, the server uses the preset private key to decrypt the communication message.
[0090] As before, SDK can be installed in the terminal, encryption system and SDK interface can be installed in the server, wherein the SDK of the terminal and the SDK interface of the server can communicate via TCP+SSL, and a preset public key is stored in the SDK of the terminal, and a preset private key is stored in the encryption system of the server. When the terminal transmits a message to the server through SDK, the message is encrypted by the preset public key, and the server uses the preset private key to decrypt and verify the received message. At the same time, if the message carries data, the data can be further encrypted based on the temporary public key, and the server decrypts the received data based on the temporary private key. In this way, both the message and the data are protected by asymmetric encryption, and since the data is transmitted in the form of key index, there is no need for repeated authentication during this authentication period, so it will not bring too much additional overhead.
[0091] Figure 4 : is a flow chart of a data transmission method provided in an embodiment of the present application. Figure 4 Steps S401 to S404 of the embodiment shown are similar to Figure 3 Steps S301 to S304 of the illustrated embodiment are the same. Figure 4 Step S407 of the embodiment shown is Figure 3 Step S306 of the embodiment shown is the same and will not be described again here. Figure 4 As shown, the method also includes the following steps:
[0092] In step S405, the data is encapsulated using a custom extensible markup language format to obtain a message to be sent.
[0093] In step S406, the message to be sent is sent to the server, so that the server verifies the message using the preset private key and decrypts the data in the message using the temporary private key, and then generates a key index of the data based on the decrypted data.
[0094] In the embodiment of the present application, a custom Extensible Markup Language (XML) format can be used to encapsulate data. Different from the traditional HTTP mode in which data is encapsulated in the format of a data packet header (Head) and a data packet body (Body), in the embodiment of the present application, the data can be encapsulated in a custom XML format in combination with the characteristics of the data itself.
[0095] In traditional data transmission, data may need to be forwarded at multiple layers, or the data number needs to be recorded when the data is split and forwarded. Therefore, the Head+Body method is used for encapsulation, so that the content of the next processing can be determined only by the information carried in the Head each time it is forwarded.
[0096] Different from this, the data transmission method of the embodiment of the present application is to transmit the private data of vehicles or users in the Internet of Vehicles, usually without secondary forwarding, and is directly sent from the terminal to the server, or from the server to the terminal. At the same time, private data is mostly identification data or location data, and the amount of data is not too large, so it is rarely split into multiple data packets for transmission. In view of this, for private data in the Internet of Vehicles, there is no need to use the traditional Head+Body method for encapsulation, but instead a custom XML format is used for encapsulation. At the same time, the encapsulation rules of the custom XML format are pre-set in the terminal's SDK and the server's encryption system, respectively, so as to effectively avoid man-in-the-middle attacks.
[0097] In the embodiment of the present application, the terminal encrypts the data using a temporary public key and encapsulates it using a custom XML format. When sending the encapsulated data, the message for sending the data is encrypted using a preset public key. After receiving the encrypted message, the server first uses a preset private key to decrypt and verify the message, then decapsulates the data using a custom XML format, and finally decrypts the data using a temporary private key, thereby obtaining the private data uploaded by the terminal.
[0098] According to the technical solution provided in the embodiment of the present application, the messages transmitted between the terminal and the server are encrypted and verified by presetting public and private key pairs, and the data is encapsulated in a custom XML format, thereby further improving the security of data transmission.
[0099] Figure 5 : is a flow chart of a data transmission method provided in an embodiment of the present application. Figure 5 Steps S501 to S506 of the embodiment shown are similar to Figure 3 Steps S301 to S306 of the illustrated embodiment are the same and will not be described in detail herein. Figure 5 As shown, the method also includes the following steps:
[0100] In step S507, the key index is sent to the server so that the server determines the data based on the key index.
[0101] In the embodiment of the present application, after receiving the key index sent by the server, the terminal can directly send the key index when it needs to send the data to the server again within the validity period of this authentication. After receiving the key index, the server can determine the data by searching in the server's cache.
[0102] In an embodiment of the present application, when sending a key index, only a preset public key may be used to encrypt the encryption index. After receiving the key index, the server first decrypts it using a preset private key, and then searches for certain data in the cache.
[0103] According to the technical solution provided in the embodiment of the present application, by constructing a key index to replace the private data for transmission in the Internet of Vehicles, the authentication and encryption process is simplified and the data transmission efficiency is improved while ensuring the security of data transmission.
[0104] Figure 6 : is a flow chart of a data transmission method provided in an embodiment of the present application. Figure 6 Steps S601 to S606 of the embodiment shown are similar to Figure 3 Steps S301 to S306 of the illustrated embodiment are the same and will not be described in detail herein. Figure 6 As shown, the method also includes the following steps:
[0105] In step S607, in response to the current authentication failure, the key index and the temporary public key are deleted.
[0106] In step S608, a data deletion request is sent to the server.
[0107] In an embodiment of the present application, when the current session between the terminal and the server ends, for example, when the vehicle ends, or a session of the user terminal ends, the token for this authentication will become invalid at the same time. To ensure data security, the terminal can delete the key index and temporary public key stored in its SDK at this time, and send a request to delete data to the server at the same time. After receiving the request to delete data, the server also performs a deletion operation on the key index and temporary public key-private key pair stored in the server. When the next journey of the vehicle begins, or the user terminal initiates a session again, the data transmission operation provided in the embodiment of the present application is re-executed.
[0108] According to the technical solution provided in the embodiment of the present application, the security of data transmission can be further improved by deleting the key index and temporary public key saved in the terminal SDK when the current authentication expires, and sending a deletion request to the server so that the server deletes the key index and temporary public key-private key pair saved by it.
[0109] In the embodiment of the present application, when the cloud sends data to the terminal, the key index can also be used instead of the data for sending. The terminal can also cache the corresponding relationship between the key index and the data when it first receives the key index sent by the cloud, and query the corresponding data in the cache when it receives the key index again. On the other hand, the cloud can also first desensitize the data and then send the desensitized data to the terminal.
[0110] Figure 7 It is a flow chart of a data transmission method provided in an embodiment of the present application. Figure 7 The data transmission method can be Figure 1 Server 1 in the example is executed. Figure 7 As shown, the method comprises the following steps:
[0111] In step S701, an authentication request from a terminal is received, and a first session token is sent to the terminal after the authentication request is verified.
[0112] In step S702, a second session token sent by the terminal is received.
[0113] The second session token is obtained by the terminal performing a digest calculation on the first session token.
[0114] In step S703, a temporary public key and private key pair is generated according to the session identifier and the terminal identifier in the second session token, and the temporary public key is sent to the terminal.
[0115] In step S704, data sent by the terminal is received.
[0116] Among them, the data is encrypted by a temporary public key.
[0117] In step S705, the data is decrypted based on the temporary private key, and a key index of the data is generated based on the decrypted data.
[0118] In step S706, the key index is sent to the terminal.
[0119] In an embodiment of the present application, the server may receive an authentication request sent by the terminal. After verifying the authentication request, the server sends a first session token to the terminal. The first session token may be a session token generated by the server based on the authentication request. The terminal receives the first session token, performs a digest calculation on the first session token, and obtains a second session token.
[0120] In an embodiment of the present application, the server receives a second session token sent by the terminal, obtains a unique session identifier in the second session token, generates a temporary public key and private key pair in combination with the terminal identifier, such as the current device number of the terminal, and sends the temporary public key to the terminal so that the terminal can encrypt data based on the temporary public key.
[0121] In the embodiment of the present application, the server receives data sent by the terminal that is encrypted using a temporary public key, decrypts the data using a temporary private key, and generates a key index for the data based on the decrypted data. The server stores the key index in a cache and sends the key index to the terminal.
[0122] According to the technical solution provided in the embodiment of the present application, a first session token is sent to the terminal after the authentication request sent by the terminal is verified, a second session token sent by the terminal is received, a temporary public key and private key pair is generated based on the second session token and the terminal identifier, the data sent by the terminal is decrypted based on the temporary private key, and a key index is generated and sent to the terminal. When the data is subsequently transmitted between the terminal, the key index can be used instead of the data, which improves the security of data transmission and does not require repeated authentication, thereby improving data transmission efficiency, enhancing information security, and reducing the risk of user data leakage.
[0123] In the embodiment of the present application, the server and the terminal communicate based on the transmission control protocol and the secure socket layer, and use a preset private key to verify the communication message.
[0124] In an embodiment of the present application, the data transmission method also includes: receiving a message sent by a terminal, the message is encrypted by a preset public key and the message carries data, the data is encrypted by a temporary public key, and the data is encapsulated based on a custom extensible markup language format; using a preset private key to verify the data, using a temporary private key to decrypt the data, and generating a key index of the data based on the decrypted data.
[0125] In the embodiment of the present application, the data transmission method also includes: receiving a key index sent by a terminal; and determining data based on the key index.
[0126] In the embodiment of the present application, the data transmission method also includes: in response to the failure of the current authentication, receiving a data deletion request sent by the terminal; deleting the key index and the temporary public key and private key pair.
[0127] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0128] Figure 8 is an interactive diagram of the data transmission method provided in the embodiment of the present application. Figure 8As shown, the terminal-side SDK can be installed in TBOX and APP, the encryption system can be installed in the cloud server, and the SDK interface can be installed. The SDK in TBOX and APP can communicate with the cloud server through the SDK interface, for example, sending an authentication request to the cloud server. After the authentication is passed, the cloud server generates a temporary public key and private key pair, and sends the temporary public key to TBOX and APP, so that TBOX and APP can encrypt the transmitted data based on the temporary public key. For example, TBOX encrypts the data using the temporary public key, and uses the preset public key saved in the SDK to encrypt the message carrying the data, and then sends the data to the encryption system of the cloud server. The encryption system of the cloud server verifies the message using the saved preset private key, decrypts the data using the temporary private key, and then generates a key index for the data, and sends the key index to TBOX. The encryption system of the cloud server can cache the key index and the corresponding relationship between the key index and the data. Subsequently, TBOX can use the key index to transmit the data, thereby avoiding the security risks caused by direct transmission of data. After receiving the key index, TBOX can send the key index to the cloud server the next time it sends the same data. After receiving the key index, the cloud server sends a request to query the data to the encryption system of the cloud server. The encryption system queries the corresponding data based on the key index and returns the data.
[0129] On the other hand, when the cloud server needs to send data to the APP, the cloud server can first send a desensitizing request to the encryption system. After desensitizing the data, the encryption system returns the desensitized data to the cloud server, and the cloud server sends the desensitized data to the APP.
[0130] In the embodiment of the present application, the encryption system in the cloud server can only perform high-level secure encryption communication on data involving user privacy, and then cache and respond to the key index corresponding to the user privacy data. Then the TBOX or APP on the user side uses the data key index to interact with the cloud. After the key index reaches the cloud, the cloud obtains the data itself from the encryption system according to the key index. In this way, user privacy data will not be leaked during the transmission process, and high-intensity encryption only for user privacy data also reduces encryption and network overhead.
[0131] During the entire interaction process, the following points need to be achieved in order to protect user privacy:
[0132] 1. Ensure the security of communication between the end user and the encryption system. The communication between the user side and the encryption system uses a private protocol and relies on the SDK interface of the encryption system to complete the communication.
[0133] 2. The encryption system will only encrypt user privacy data, including name, phone number, license plate, etc.
[0134] 3. The data on the user side and the encryption system communicate in a one-way encrypted manner. The encryption system only provides encryption but not decryption for the user side.
[0135] 4. The decryption channel of the encryption system only exposes the intranet port. The cloud and the encryption system communicate via the intranet, and the original data can be obtained based on the data key index.
[0136] Among them, the encryption-related capabilities of the encryption system include: providing SDK to ensure the security of communication with the encryption system; providing the ability to obtain, parse, store and respond to the key index of encrypted data; providing the ability to obtain the original data according to the key index to the intranet cloud system; providing the ability to desensitize data to the intranet cloud system; in order to ensure the security of communication with the encryption system, the encryption system provides a custom communication protocol, and achieves the purpose of secure communication by providing SDK to the terminals that need encryption. The capabilities of the SDK and the encryption system are basically symmetrical, mainly including the terminal authentication module, communication module, data encryption / decryption module, and key index cache module.
[0137] Among them, the terminal authentication module is used to improve the security of the encryption system itself, prevent the middleman from maliciously accessing or attacking the encryption system with the SDK, causing unnecessary waste of resources in the encryption system. The terminal device cannot communicate directly with the encryption system after getting the SDK. After the device terminal and the cloud communicate and log in to authenticate to get the first session token, the first session token is passed to the SDK for initialization to get the second session token. The SDK transmits the second session token to the encryption system. After the encryption system communicates with the cloud and verifies that the second session token data is authentic and valid, the encryption system generates a temporary public key (for example, public key_0) and private key (for example, private key_0) pair based on the current device number and the unique session identification parameters in the second session token, and responds to the public key_0 to the SDK. The SDK is then able to communicate securely with the encryption system.
[0138] The communication module communicates with the user. Among them, the encryption system's SDK has a built-in system public key of the encryption system (for example, public key_1), and at the same time obtains a temporarily generated public key_0 based on the second session token authentication. Public key_1 is responsible for completing SSL communication with the encryption system, and public key_0 is responsible for encrypting the data. In the embodiment of the present application, the method of communicating with the encryption system is no longer the traditional HTTPS, but TCP+SSL is used. At the same time, the encapsulation of the data packet is no longer a combination of Head and Body in HTTP mode, but a private protocol in a custom XML format. The custom protocol has higher security and uses the Internet of Vehicles related data structure to store the encrypted data in XML. After receiving the request, the encryption system uses the corresponding system private key (ie, private key_1) to verify the data and uses private key_0 to parse the private protocol data in XML format, and then obtains the encrypted data to complete the cache and respond to the corresponding key index.
[0139] The data encryption / decryption module is used to encrypt and decrypt data. In the encryption system, the encryption public key and private key pair of user privacy data, that is, the above-mentioned public key_0 and private key_0 pair, can be generated using the national cryptography algorithm SM2. SM2 is an advanced and secure algorithm, which is used to replace the RSA algorithm in our country's commercial cryptography system. SM2 has better performance and higher security, with high password complexity, fast processing speed, and less consumption of machine performance. The SDK obtains the generated temporary public key_0 according to the token authentication, encrypts the target data using this public key and encapsulates it into the private protocol XML. When the encrypted data packet is transmitted to the encryption system, the encryption system obtains the encrypted data from the data packet and decrypts it using the corresponding private key_0 to obtain the original data, and then responds to the user with a uniquely generated key index in real time. This key index itself has no meaning and is only used for the storage and query of key-value pairs (key-value) with the original data.
[0140] The key index cache module is used to cache the key-value pairs of the key index and the original data. The communication with the encryption system involves high encryption complexity, so there is a certain time overhead. If an encryption request is initiated for each piece of data, it will have a certain impact on the data transmission efficiency of the Internet of Vehicles. Therefore, the SDK has a built-in cache module. When a response is obtained for an encryption request, the relevant key index and the encrypted data itself will be cached in the SDK. For security reasons, the encryption system only caches the data and does not persist it. Similarly, the SDK only caches the data. That is, when a vehicle journey ends or a user terminal session ends, the token becomes invalid at the same time. The data in the SDK cache will be cleared, and the corresponding public key_0 will also be cleared. At the same time, the SDK also actively initiates a request to clear the data to the encryption system, and the encryption system随之 clears all the data involved in this session and the private key_0. When the next journey starts or the user terminal session starts, the encryption communication operation is carried out again.
[0141] For example, when the user side, such as the vehicle side, depends on the SDK and conducts secure encryption communication with the encryption system, after the vehicle is powered on, the TBOX will send a login request to the cloud. After successful login, the first session token is obtained. After the SDK gets the first session token, it completes the relevant verification with the encryption system and then starts to provide encryption communication capabilities. For example, if the license plate number of the vehicle side (Sichuan A L8888) needs to be transmitted to the cloud, first, the license plate is encrypted by the SDK into an encrypted string such as "101020103040364281…", and then it is encapsulated into XML data. The encapsulation code can be:
[0142]
[0143] Among them, the XML-related data structures involve relevant material information such as vehicle models, vehicle series, and vehicles. After the encryption system obtains the data packet, it verifies the data packet, obtains the encrypted data and restores the original data "Chuan A L8888". At the same time, a unique key index "encode_2b000a28-5b73-4ed6-8fe9-6423f8668b7f" is generated and cached. At this time, the cached key-value pair can be (encode_2b000a28-5b73-4ed6-8fe9-6423f8668b7f: Chuan A L8888). Subsequently, the key index is responded to the vehicle side. After receiving the response, the vehicle side caches the key index locally. For the communication in the entire subsequent session, the license plate data involved is transmitted using this key index. When the cloud receives this encrypted data, it will query the encryption system according to the key index. Since the cloud and the encryption system are in the same internal network, they can be accessed through the internal network, and the original data "Chuan A L8888" can be quickly obtained, and the entire encrypted communication process ends.
[0144] The above method can meet the security requirements for data transmission from the user side to the cloud. However, for the data sent from the cloud, including the data sent to the vehicle side and the user terminal, if encrypted data or data key indexes are used, what the user sees will be a string of completely meaningless characters. Therefore, for the data sent from the cloud to the user terminal, it is considered to go through the data desensitization process, that is, the encryption system can also include a "data desensitization module". The cloud calls the desensitization interface of the encryption system to obtain the desensitized data, and then sends the desensitized data to the user side. This processing method can be adopted for mobile phone numbers, license plate numbers, and vehicle identification numbers.
[0145] For the data sent from the cloud to the user terminal, the data desensitization process is followed. The encryption system provides a complete set of desensitization specifications for user data such as names, phones, ID cards, license plates, and vehicle frames. The cloud system directly obtains the desensitized data from the original data. The entire process only provides data desensitization and does not provide reverse operations. The desensitized data is mainly for the user to view, but the data is quite hidden.
[0146] For example, the desensitization specification for the name is to only retain the surname. For example, "Zhang San" becomes "Zhang *" after desensitization. For the phone number, the last four digits are desensitized and retained. For example, "18782013825" becomes "1878201****" after desensitization. For the ID card number, the birthday-related information is removed. For example, "510111199912312310" becomes "51011119******2310". The same applies to license plates, vehicle frames, insurance policies, and so on.
[0147] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For the details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0148] Fig. 9 Schematic diagram of a data transmission device provided in an embodiment of the present application. Fig. 9 As shown, the data transmission device includes:
[0149] The sending module 901 is configured to send an authentication request to a server.
[0150] The receiving module 902 is configured to receive a first session token sent by the server after the authentication request is successfully verified.
[0151] The calculation module 903 is configured to perform digest calculation on the first session token to obtain a second session token.
[0152] Furthermore, the sending module is also configured to send the second session token to the server, so that the server generates a temporary public key and private key pair according to the session identifier and the terminal identifier in the second session token.
[0153] The receiving module is also configured to receive a temporary public key sent by the server and use the temporary public key to encrypt data.
[0154] Furthermore, the sending module is also configured to send the encrypted data to the server, so that the server generates a key index of the data based on the decrypted data after decrypting the data using the temporary private key.
[0155] The receiving module is also configured to receive the key index sent by the server.
[0156] According to the technical solution provided in the embodiment of the present application, a first session token is sent by the receiving server after verifying the authentication request sent by the terminal, a second session token is generated based on the first session token, and the second session token is sent to the server so that the server generates a temporary public key and private key pair based on the second session token and the terminal identifier, data is encrypted using the temporary public key and sent to the server, and a key index is generated after the receiving server decrypts the data based on the temporary private key. When the data is subsequently transmitted between the server, the key index can be used instead of the data, which improves the security of data transmission and does not require repeated authentication, thereby improving data transmission efficiency, enhancing information security, and reducing the risk of user data leakage.
[0157] Fig.10 Schematic diagram of a data transmission device provided in an embodiment of the present application. Fig.10 As shown, the data transmission device includes:
[0158] The receiving module 1001 is configured to receive an authentication request from a terminal.
[0159] The sending module 1002 is configured to send the first session token to the terminal after the authentication request is verified.
[0160] The receiving module is further configured to receive a second session token sent by the terminal, where the second session token is obtained by the terminal performing a digest calculation on the first session token.
[0161] The calculation module 1003 is configured to generate a temporary public key and private key pair according to the session identifier and the terminal identifier in the second session token.
[0162] Furthermore, the sending module is also configured to send the temporary public key to the terminal.
[0163] The receiving module is also configured to receive data sent by the terminal, and the data is encrypted by a temporary public key.
[0164] The computing module is also configured to decrypt the data based on the temporary private key and generate a key index of the data based on the decrypted data.
[0165] Furthermore, the sending module is also configured to send the key index to the terminal.
[0166] According to the technical solution provided in the embodiment of the present application, a first session token is sent to the terminal after the authentication request sent by the terminal is verified, a second session token sent by the terminal is received, a temporary public key and private key pair is generated based on the second session token and the terminal identifier, the data sent by the terminal is decrypted based on the temporary private key, and a key index is generated and sent to the terminal. When the data is subsequently transmitted between the terminal, the key index can be used instead of the data, which improves the security of data transmission and does not require repeated authentication, thereby improving data transmission efficiency, enhancing information security, and reducing the risk of user data leakage.
[0167] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0168] Fig.11 Schematic diagram of an electronic device provided in an embodiment of the present application. Fig.11 As shown, the electronic device 11 of this embodiment includes: a processor 1101, a memory 1102, and a computer program 1103 stored in the memory 1102 and executable on the processor 1101. When the processor 1101 executes the computer program 1103, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 1101 executes the computer program 1103, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0169] The electronic device 11 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 11 may include, but is not limited to, a processor 1101 and a memory 1102. Those skilled in the art will appreciate that Fig.11 The electronic device 11 is merely an example and does not limit the electronic device 11 , and may include more or fewer components than those shown in the figure, or different components.
[0170] Processor 1101 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0171] The memory 1102 may be an internal storage unit of the electronic device 11, for example, a hard disk or memory of the electronic device 11. The memory 1102 may also be an external storage device of the electronic device 11, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card (FlashCard), etc. equipped on the electronic device 11. The memory 1102 may also include both an internal storage unit of the electronic device 11 and an external storage device. The memory 1102 is used to store computer programs and other programs and data required by the electronic device.
[0172] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0173] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.
[0174] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data transmission method, characterized in that: The method is executed by a terminal, and includes: Sending an authentication request to a server, and receiving a first session token sent by the server after verifying the authentication request; Performing digest calculation on the first session token to obtain a second session token; Sending the second session token to the server, so that the server generates a temporary public key and private key pair according to the session identifier and the terminal identifier in the second session token; Receiving a temporary public key sent by the server, and using the temporary public key to encrypt data; Sending the encrypted data to the server, so that the server generates a key index of the data based on the decrypted data after decrypting the data using the temporary private key; The key index sent by the receiving server.
2. The method according to claim 1, characterized in that: The terminal communicates with the server based on the transmission control protocol and the secure socket layer, and uses a preset public key to encrypt communication messages.
3. The method according to claim 2, characterized in that The method further comprises: After encrypting the data using the temporary public key, encapsulating the data using a custom extensible markup language format to obtain a message to be sent; The message to be sent is sent to the server, so that the server verifies the message using a preset private key, decrypts the data in the message using a temporary private key, and then generates a key index for the data based on the decrypted data.
4. The method according to claim 1, characterized in that: The performing digest calculation on the first session token to obtain a second session token includes: A digest calculation is performed on the session identifier of the first session token and the environment identifier of the software development kit in the terminal to obtain the second session token.
5. The method according to claim 1, characterized in that The method further comprises: The key index is sent to the server, so that the server determines the data based on the key index.
6. The method according to claim 1, characterized in that The method further comprises: In response to the current authentication failure, deleting the key index and the temporary public key; Sending a delete data request to the server.
7. A data transmission method, characterized in that: The method is executed by a server and includes: Receiving an authentication request from a terminal, and sending a first session token to the terminal after verifying the authentication request; Receiving a second session token sent by a terminal, where the second session token is obtained by the terminal performing a digest calculation on the first session token; Generate a temporary public key and private key pair according to the session identifier and the terminal identifier in the second session token, and send the temporary public key to the terminal; receiving data sent by the terminal, the data being encrypted by the temporary public key; Decrypting the data based on the temporary private key, and generating a key index of the data based on the decrypted data; The key index is sent to the terminal.
8. The method according to claim 7, characterized in that The server communicates with the terminal based on the transmission control protocol and the secure socket layer, and uses a preset private key to verify the communication message.
9. The method according to claim 8, characterized in that The method further comprises: Receiving a message sent by the terminal, the message being encrypted by a preset public key and carrying data, the data being encrypted by the temporary public key, and encapsulating the data based on a custom extensible markup language format; The data is verified using a preset private key, the data is decrypted using the temporary private key, and a key index of the data is generated based on the decrypted data.
10. The method according to claim 7, characterized in that The method further comprises: Receiving a key index sent by the terminal; The data is determined based on the key index.
11. The method according to claim 7, characterized in that: The method further comprises: In response to the authentication failure, receiving a data deletion request sent by the terminal; Delete the key index and temporary public key and private key pair.
12. A data transmission device, characterized in that: include: A sending module, configured to send an authentication request to a server; A receiving module, configured to receive a first session token sent by the server after the authentication request is verified; a calculation module, configured to perform a digest calculation on the first session token to obtain a second session token; The sending module is further configured to send the second session token to the server, so that the server generates a temporary public key and private key pair according to the session identifier and the terminal identifier in the second session token; The receiving module is further configured to receive a temporary public key sent by the server, and use the temporary public key to encrypt data; The sending module is further configured to send the encrypted data to the server, so that the server generates a key index of the data based on the decrypted data after decrypting the data using the temporary private key; The receiving module is further configured to receive the key index sent by the server.
13. A data transmission device, characterized in that: include: A receiving module, configured to receive an authentication request from a terminal; A sending module, configured to send a first session token to the terminal after verifying the authentication request; The receiving module is further configured to receive a second session token sent by the terminal, where the second session token is obtained by the terminal performing a digest calculation on the first session token; A computing module, configured to generate a temporary public key and private key pair according to the session identifier and the terminal identifier in the second session token; The sending module is further configured to send the temporary public key to the terminal; The receiving module is further configured to receive data sent by the terminal, the data being encrypted by the temporary public key; The computing module is further configured to decrypt the data based on the temporary private key, and generate a key index of the data based on the decrypted data; The sending module is further configured to send the key index to the terminal.
14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 11 are implemented.
15. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Information verification method, related device, equipment and storage medium
CN112733107A
Secure data interaction method and system
WO2015161699A1
