Internet region symmetric key transmission method, system and device, and storage medium

By passing the symmetric key of the National Secret SM2 algorithm between the client and the server, the problem of low efficiency and insufficient security of the RSA asymmetric algorithm is solved, efficient and secure interface calls are realized, and the security of financial data transmission is met. Require.

CN119254430APending Publication Date: 2025-01-03WUHAN ZBANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411383232.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

In the prior art, the international RSA asymmetric key pair used by the client APP and the server are inefficient in encryption and decryption, which affects the performance of the APP. Once the public key is leaked, it may lead to data leakage and cannot meet the security requirements of financial data transmission.

Method used

The symmetric key delivery method of the Internet area is adopted, and the SM4 symmetric key is passed through the national secret SM2 asymmetric algorithm. The client randomly generates the SM4 key and uses the SM2 private key to encrypt and sign, and the server uses the SM2 public key to decrypt and verify the signature. Ensure the security and efficiency of key delivery.

Benefits of technology

It improves the efficiency and security of client-server interface calls, reduces time-consuming, meets the requirements of national secrets transformation, and ensures data security and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254430A_ABST
    Figure CN119254430A_ABST
Patent Text Reader

Abstract

The invention provides a method, a system and equipment for transmitting a symmetric key of an internet region and a storage medium, and the method comprises the steps: opening a bank system client APP, randomly generating a domestic secret sm4 symmetric key when the APP is started for the first time, encrypting the generated domestic secret sm4 symmetric key by using a domestic secret sm2 private key, and transmitting the encrypted domestic secret sm4 symmetric key to a server; respectively encrypting a system timestamp, a unique request serial number and an equipment unique number by using a domestic password sm4 symmetric key, signing the encrypted domestic password sm4 symmetric key, the system timestamp, the unique request serial number and the equipment unique number in sequence by using an sm2 private key, and sending a request to a server; the server receives the symmetric secret key transmission interface request and performs data verification and processing; and then the client APP processes the interface calling result. According to the method, the symmetric encryption SM4 algorithm secret key is transmitted by using the national secret asymmetric SM2 algorithm, and after the first transmission is successful, the SM4 algorithm is used for performing data encryption and decryption on subsequent interface calling, so that the interface calling efficiency is greatly improved while the safe calling of the interface is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer information technology, and in particular to a method, system, device and storage medium for transmitting symmetric keys in an Internet area. Background Art

[0002] Currently, the client APP and the server use the international algorithm RSA asymmetric key pair to encrypt and decrypt the requested and returned data, ensuring the security of the interface data. However, the efficiency of asymmetric encryption and decryption is much lower than that of symmetric encryption and decryption, which increases time consumption, affects APP performance, and often causes APP to freeze. In addition, all user client APPs store the same public key. Once the key is leaked, the attacker can use the key to decrypt the response data of other users, causing data leakage and endangering data security.

[0003] The international asymmetric RSA algorithm does not meet the country's requirements for financial data transmission. At the same time, the performance and efficiency of the asymmetric RSA algorithm for encrypting and decrypting data are far lower than those of the symmetric encryption algorithm, which affects the data processing speed of the client APP and the customer experience. In addition, when the client configuration is low and the amount of data processed is large, it is easy to cause client freezes, resulting in frequent customer complaints and feedback on APP freezes. Summary of the invention

[0004] In response to the technical problems existing in the prior art, the present invention provides a method, system, device and storage medium for transmitting symmetric keys in the Internet area, so as to solve the interface security call between the client APP and the server, while improving the call efficiency, reducing time consumption, improving user experience, and meeting the requirements of national encryption transformation.

[0005] According to a first aspect of the present invention, the present invention provides a method for transmitting an Internet zone symmetric key, comprising:

[0006] Step S1, the client randomly generates a national secret sm4 symmetric key, uses the national secret sm2 private key to encrypt the generated national secret sm4 symmetric key, uses the national secret sm4 symmetric key to encrypt the client system timestamp, unique request serial number, and device unique number respectively, uses the sm2 private key to sign the encrypted national secret sm4 symmetric key, client system timestamp, unique request serial number, and device unique number in sequence and sends a request to the server;

[0007] Step S2, the server receives the SM2 private key symmetric key transfer interface request, uses the national secret SM2 public key to decrypt the encrypted SM4 symmetric key ciphertext to obtain the SM4 symmetric key, and then uses the SM4 symmetric key to decrypt the client system timestamp, unique request serial number, and device unique number to obtain the original data for verification, verifies the signature data, and responds to the client with the processing result;

[0008] Step S3, when the client receives various types of exceptions responded by the server, the client cache SM4 symmetric key is cleared, the SM4 key is regenerated, and step S1 is repeated until the server key transfer interface responds successfully; when the client receives a successful response from the server, it indicates that the SM4 symmetric key has been successfully transferred, and other interface transactions thereafter directly carry the unique device number and encrypt and decrypt data using the SM4 symmetric encryption key.

[0009] Based on the above technical solution, the present invention can also make the following improvements.

[0010] Optionally, the step S1 includes the following steps:

[0011] When the client APP is started for the first time, it randomly generates a national secret sm4 symmetric key and saves the sm4 symmetric key to the client cache. The client APP uses the national secret sm2 private key it holds to encrypt the sm4 symmetric key to generate the sm4 symmetric key ciphertext;

[0012] Get the client system timestamp, generate a unique request serial number, get the device unique number, use the sm4 symmetric key cached by the client APP to perform national secret sm4 algorithm encryption to generate the system timestamp, unique request serial number, and device unique number ciphertext respectively;

[0013] Use the private key sm2 held by the client APP to sign the data, and generate a digital signature for the encrypted sm4 symmetric key, system timestamp, unique request serial number, and device unique number;

[0014] Call the server-side symmetric key transfer interface, and request parameters including sm4 symmetric key ciphertext, client system timestamp ciphertext, unique request serial number ciphertext, device unique number ciphertext and digital signature. Optionally, using the national secret sm2 public key to decrypt the encrypted sm4 symmetric key ciphertext to obtain the sm4 symmetric key includes:

[0015] The server receives the interface request parameter sm4 symmetric key ciphertext, client system timestamp ciphertext, unique request serial number ciphertext, device unique number ciphertext and digital signature;

[0016] Use the national secret sm2 public key held by the server to decrypt the sm4 symmetric key ciphertext. If the decryption fails, directly respond to the APP request for sm2 key pair error. If the decryption is successful, the sm4 symmetric key is obtained.

[0017] Optionally, the using of the sm4 symmetric key to respectively decrypt the client system timestamp, the unique request serial number, and the device unique number to obtain the original data includes:

[0018] Use the sm4 symmetric key to decrypt the client system timestamp ciphertext, obtain the client system timestamp plaintext, and obtain the current server timestamp. If the time error between the server timestamp and the system timestamp sent by the client is greater than the preset error value, directly respond to the client APP request data timeout, otherwise, continue the process judgment;

[0019] Use the sm4 symmetric key to decrypt the unique request serial number ciphertext, obtain the unique request serial number original text, query the server-side connection key transfer interface request serial table, and determine whether the unique request serial number original text has been used. If it has, directly respond to the APP to repeat the transaction, otherwise, continue the process judgment;

[0020] Use the sm4 symmetric key to decrypt the ciphertext of the device's unique number to obtain the original text of the device's unique number.

[0021] Optionally, verifying the original data, verifying the signature data, and responding the processing result to the client includes:

[0022] Use the national secret sm2 public key held by the server to verify the signature. If the signature verification fails, it directly responds that the APP request data has been tampered with. Otherwise, record the server key transfer interface request flow table, save the unique request serial number, device unique number and request time information, and then record an APP key table data, save the device unique number and the successfully transmitted sm4 symmetric key, and save the corresponding relationship.

[0023] Optionally, the original data includes a digital signature sent by the client and the decrypted ordered data, and the original data includes an sm4 symmetric key, a system timestamp sent by the client, a unique request serial number, and a unique device number.

[0024] Optionally, in step S2, if there are other exceptions in the whole process, all responses will be sent to the client APP as an unknown error and the key transfer will fail. If the relevant verification and data operations of the whole process are successful, the client APP will be responded as the national secret sm4 symmetric key transfer is successful.

[0025] According to a second aspect of the present invention, there is provided a system for delivering an Internet zone symmetric key, comprising:

[0026] The original data encryption module is used to randomly generate a national secret SM4 symmetric key on the client, encrypt the generated national secret SM4 symmetric key with the national secret SM2 private key, and then use the national secret SM4 symmetric key to encrypt the client system timestamp, unique request serial number, and device unique number respectively, and use the SM2 private key to sign the encrypted national secret SM4 symmetric key, client system timestamp, unique request serial number, and device unique number in sequence and send a request to the server;

[0027] The data verification module is used for receiving the SM2 private key symmetric key transfer interface request at the server end, decrypting the encrypted SM4 symmetric key ciphertext using the national secret SM2 public key to obtain the SM4 symmetric key, and then using the SM4 symmetric key to decrypt the client system timestamp, unique request serial number, and device unique number to obtain the original data, verifying the original data, verifying the signature data, and responding the processing result to the client;

[0028] The data response module is used for the client to receive various types of exceptions in the server response, clear the client cache sm4 symmetric key, regenerate the sm4 key, and repeat step S1 until the server key transfer interface responds successfully; when the client receives the server response successfully, it means that the sm4 symmetric key is successfully transferred, and other subsequent interface transactions directly carry the unique device number and encrypt and decrypt data through the sm4 symmetric encryption key.

[0029] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for transmitting an Internet zone symmetric key when executing the program.

[0030] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method for transmitting an Internet zone symmetric key as described above is implemented.

[0031] Technical effects and advantages of the present invention:

[0032] The invention provides a method, system, device and storage medium for transmitting symmetric keys in an Internet area. The invention aims to solve the interface security call between the client APP and the server, while improving the call efficiency, reducing the time consumption and improving the user experience. By using the national secret asymmetric SM2 algorithm to transmit the symmetric encryption SM4 algorithm key, after the first successful transmission, the subsequent interface call uses the SM4 algorithm to encrypt and decrypt the data, ensuring the secure call of the interface while greatly improving the interface call efficiency.

[0033] Other features and advantages of the present invention will be described in the following description, and partly become obvious from the description, or be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 It is a flow chart of a method for transmitting a symmetric key in an Internet zone provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0035] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0036] It should be noted that the embodiment of the present invention uses the national secret sm2 algorithm to transfer the sm4 symmetric key between the client APP and the server, so that subsequent transactions use the national secret sm4 algorithm, which not only realizes the secure call of the interface, but also improves the efficiency of the interface call. Through the embodiment of the present invention, the national secret asymmetric sm2 algorithm is used to transfer the symmetric encryption sm4 algorithm key. After the first successful transfer, the subsequent interface call uses the sm4 algorithm to encrypt and decrypt the data, which ensures the secure call of the interface and greatly improves the efficiency of the interface call, meeting the requirements of the national secret transformation.

[0037] It is understandable that based on the defects in the background technology, the embodiment of the present invention proposes a method for transmitting a symmetric key in an Internet area, specifically as follows: Figure 1 As shown, the following steps are included:

[0038] S1. The client randomly generates a national secret sm4 symmetric key, uses the national secret sm2 private key to encrypt the generated national secret sm4 symmetric key, uses the national secret sm4 symmetric key to encrypt the client system timestamp, unique request serial number, and device unique number respectively, uses the sm2 private key to sign the encrypted national secret sm4 symmetric key, client system timestamp, unique request serial number, and device unique number in sequence and sends a request to the server;

[0039] In the above technical solution, step S1 specifically includes:

[0040] Open the banking system client APP (hereinafter referred to as APP). When the client APP is started for the first time, it randomly generates a national secret sm4 symmetric key sm4keyA and saves sm4keyA to the client cache; the client APP uses the national secret sm2 private key it holds to encrypt the national secret sm4 symmetric key sm4keyA to generate the encrypted sm4 symmetric key sm4keyAData;

[0041] Get the client system timestamp timestampA, generate a unique request serial number seqNoA, get the device unique number deviceIdA, use the national encryption sm4 symmetric key sm4keyA to encrypt the system timestamp timestampA, the unique request serial number seqNoA, and the device unique number deviceIdA using the national encryption sm4 algorithm to generate encrypted timestampAData, seqNoAData, and deviceIdAData;

[0042] Use the private key sm2 held by the APP to sign the encrypted sm4keyA, timestampA, seqNoA, and deviceIdA data in order as parameters to generate signature data sm2SignA;

[0043] Call the server's symmetric key transfer interface and send the encrypted national sm4 symmetric key sm4keyAData, client system timestamp timestampAData, unique request serial number seqNoAData, device unique number deviceIdAData, and signature data sm2SignA parameters to the server.

[0044] Step S2, the server receives the SM2 private key symmetric key transfer interface request, uses the national secret SM2 public key to decrypt the encrypted SM4 symmetric key ciphertext to obtain the SM4 symmetric key, and then uses the SM4 symmetric key to decrypt the client system timestamp, unique request serial number, and device unique number to obtain the original data for verification, verifies the signature data, and responds to the client with the processing result;

[0045] In the above technical solution, the server uses the national secret sm2 public key to decrypt the encrypted sm4 symmetric key sm4keyAData to obtain the national secret sm4 symmetric key sm4keyA, and then uses the sm4 symmetric key sm4keyA to decrypt timestampAData, seqNoAData, and deviceIdAData to obtain timestampA, seqNoA, and deviceIdA respectively; if the decryption is abnormal, it directly returns failure; if successful, it continues to use the national secret sm2 public key for signature verification, and transmits the ordered original data sm4keyA, timestampA, seqNoA, deviceIdA and sm2SignA. If the signature verification passes, the key transfer is successful, otherwise it returns failure; after the signature verification passes, the request flow table and APP key table are recorded, and the client key reception is successful.

[0046] The step S2 further comprises the following steps:

[0047] The server receives the interface request parameters sm4keyAData, timestampAData, seqNoAData, deviceIdAData, and sm2SignA;

[0048] Use the national secret sm2 public key held by the server to decrypt sm4keyAData. If the decryption fails, directly respond to the client APP request for sm2 key pair error. If the decryption is successful, the national secret sm4 symmetric key sm4keyA is obtained.

[0049] Use the national sm4 symmetric key sm4keyA to decrypt timestampAData to obtain timestamp timestampA, and obtain the current server timestamp timestampB. If the time error of timestampB minus timestampA is greater than 1min (the preset error value can be adjusted according to actual conditions), directly respond to the APP request data timeout, otherwise, continue the process judgment.

[0050] Use the national sm4 symmetric key sm4keyA to decrypt seqNoAData to obtain the unique request serial number seqNoA, query the server-side key transfer interface request serial number table, and determine whether seqNoA has been used. If it already exists, directly respond to the APP to repeat the transaction, otherwise, continue the process judgment.

[0051] Use the national symmetric key sm4keyA to decrypt deviceIdAData to obtain the device's unique number deviceIdA.

[0052] Use the national secret sm2 public key held by the server to verify the signature. The parameters passed include sm2SignA and the original ordered data sm4keyA, timestampA, seqNoA, deviceIdA. If the signature verification fails, directly respond to the APP request that the data has been tampered with. Otherwise, continue the process.

[0053] Record the server-side connection key transfer interface request flow table, save seqNoA, deviceIdA and request time information, and record the APP key table, save the corresponding relationship information between deviceIdA and sm4keyA.

[0054] In the above implementation process, if there are other exceptions in the whole process, all responses will be sent to the client APP as unknown errors and the key transfer will fail; if the relevant verification and data operations of the whole process are successful, the client APP will respond with the successful transfer of the national secret sm4keyA.

[0055] In step S3, the client receives various types of exceptions responded by the server, clears the client cached SM4 symmetric key, regenerates the SM4 key, and repeats step S1 until the server key transfer interface responds successfully; when the client receives a successful response from the server, it indicates that the SM4 symmetric key has been successfully transferred, and subsequent interface transactions directly carry the unique device number and encrypt and decrypt data using the SM4 symmetric encryption key.

[0056] In the above technical solution, when the client APP receives various types of exceptions in the server response, it clears the client cache sm4keyA, regenerates the sm4 key, and repeats the above S1 step until the server responds successfully; when the client APP receives the server response successfully, it means that the sm4keyA key is successfully transferred, and then other interface transactions directly use the sm4 symmetric encryption key sm4keyA to encrypt and decrypt data, each time carrying the unique device number, so that each independent client APP has a corresponding separate symmetric key sm4keyA with the server to encrypt and decrypt data, ensuring the security of interface calls.

[0057] The embodiment of the present invention adopts the above-mentioned technical solution, which can meet the requirements of national encryption transformation. Different client APPs use different national encryption sm4 symmetric keys to encrypt and decrypt interface data, realize the secure calling of the interface, and improve the interface response speed.

[0058] According to a second aspect of the present invention, there is provided a system for delivering an Internet zone symmetric key, comprising:

[0059] The original data encryption module is used to randomly generate a national secret SM4 symmetric key on the client, encrypt the generated national secret SM4 symmetric key with the national secret SM2 private key, and then use the national secret SM4 symmetric key to encrypt the client system timestamp, unique request serial number, and device unique number respectively, and use the SM2 private key to sign the encrypted national secret SM4 symmetric key, client system timestamp, unique request serial number, and device unique number in sequence and send a request to the server;

[0060] The data verification module is used for receiving the SM2 private key symmetric key transfer interface request at the server end, decrypting the encrypted SM4 symmetric key ciphertext using the national secret SM2 public key to obtain the SM4 symmetric key, and then using the SM4 symmetric key to decrypt the client system timestamp, unique request serial number, and device unique number to obtain the original data, verifying the original data, verifying the signature data, and responding the processing result to the client;

[0061] The data response module is used for the client to receive various types of exceptions in the server response, clear the client cache sm4 symmetric key, regenerate the sm4 key, and repeat step S1 until the server key transfer interface responds successfully; when the client receives the server response successfully, it means that the sm4 symmetric key is successfully transferred, and other subsequent interface transactions directly carry the unique device number and encrypt and decrypt data through the sm4 symmetric encryption key.

[0062] It can be understood that the Internet area symmetric key transmission system provided by the embodiment of the present invention corresponds to the Internet area symmetric key transmission method provided by the aforementioned embodiments. The relevant technical features of the Internet area symmetric key transmission system can refer to the relevant technical features of the Internet area symmetric key transmission method, which will not be repeated here.

[0063] The embodiment of the present invention also provides an electronic device, which includes: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus. The processor can call the logic instructions in the memory to execute the implementation steps of the method for transmitting a symmetric key in an Internet area.

[0064] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0065] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the implementation steps of the above-mentioned method for transmitting an Internet zone symmetric key.

[0066] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0067] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0068] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention 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. However, 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 invention.

Claims

1. A method for transmitting symmetric keys in an Internet area, applied to a banking system, characterized in that: The steps include: Step S1, the client randomly generates a national secret sm4 symmetric key, uses the national secret sm2 private key to encrypt the generated national secret sm4 symmetric key, uses the national secret sm4 symmetric key to encrypt the system timestamp, unique request serial number, and device unique number respectively, uses the sm2 private key to sign the encrypted national secret sm4 symmetric key, client system timestamp, unique request serial number, and device unique number in sequence and sends a request to the server; Step S2, the server receives the SM2 private key symmetric key transfer interface request, uses the national secret SM2 public key to decrypt the encrypted SM4 symmetric key ciphertext to obtain the SM4 symmetric key, and then uses the SM4 symmetric key to decrypt the client system timestamp, unique request serial number, and device unique number to obtain the original data, verifies the original data, verifies the signature data, and responds to the client with the processing result; Step S3, when the client receives various types of exceptions responded by the server, the client cache SM4 symmetric key is cleared, the SM4 key is regenerated, and step S1 is repeated until the server key transfer interface responds successfully; when the client receives a successful response from the server, it indicates that the SM4 symmetric key has been successfully transferred, and other interface transactions thereafter directly carry the unique device number and encrypt and decrypt data using the SM4 symmetric encryption key.

2. The method for transmitting an Internet zone symmetric key according to claim 1, characterized in that: The step S1 comprises the following steps: When the client APP is started for the first time, it randomly generates a national secret sm4 symmetric key and saves the sm4 symmetric key to the client cache. The client APP uses the national secret sm2 private key it holds to encrypt the sm4 symmetric key to generate the sm4 symmetric key ciphertext; Get the system timestamp, generate a unique request serial number, get the device unique number, use the sm4 symmetric key cached by the client APP to perform national secret sm4 algorithm encryption to generate the system timestamp, unique request serial number, and device unique number ciphertext respectively; Use the private key sm2 held by the client APP to sign the data, and generate a digital signature for the encrypted sm4 symmetric key, system timestamp, unique request serial number, and device unique number; Call the server-side symmetric key transfer interface, and the request carries parameters including sm4 symmetric key ciphertext, system timestamp ciphertext, unique request serial number ciphertext, device unique number ciphertext and digital signature.

3. The method for transmitting an Internet zone symmetric key according to claim 1, characterized in that: The method of using the national secret sm2 public key to decrypt the encrypted sm4 symmetric key ciphertext to obtain the sm4 symmetric key includes: The server receives the interface request parameter sm4 symmetric key ciphertext, client system timestamp ciphertext, unique request serial number ciphertext, device unique number ciphertext and digital signature; Use the national secret sm2 public key held by the server to decrypt the sm4 symmetric key ciphertext. If the decryption fails, directly respond to the APP request for sm2 key pair error. If the decryption is successful, the sm4 symmetric key is obtained.

4. The method for transmitting an Internet zone symmetric key according to claim 3, characterized in that: The original data obtained by using the sm4 symmetric key to decrypt the client system timestamp, the unique request serial number, and the device unique number include: Use the sm4 symmetric key to decrypt the client system timestamp ciphertext, obtain the client system timestamp plaintext, and obtain the current server timestamp. If the time error between the server timestamp and the system timestamp sent by the client is greater than the preset error value, directly respond to the client APP request data timeout, otherwise, continue the process judgment; Use the sm4 symmetric key to decrypt the unique request serial number ciphertext, obtain the unique request serial number original text, query the server-side connection key transfer interface request serial table, and determine whether the unique request serial number original text has been used. If it has, directly respond to the APP to repeat the transaction, otherwise, continue the process judgment; Use the sm4 symmetric key to decrypt the ciphertext of the device's unique number to obtain the original text of the device's unique number.

5. The method for transmitting an Internet zone symmetric key according to claim 1, characterized in that: The verifying the original data, verifying the signature data, and responding the processing result to the client includes: Use the national secret sm2 public key held by the server to verify the signature. If the signature verification fails, it directly responds that the APP request data has been tampered with. Otherwise, record the server key transfer interface request flow table, save the unique request serial number, device unique number and request time information, and then record an APP key table data, save the device unique number and the successfully transmitted sm4 symmetric key, and save the corresponding relationship.

6. The method for transmitting an Internet zone symmetric key according to claim 5, characterized in that: The original data includes the digital signature sent by the client and the decrypted ordered data, which includes the sm4 symmetric key, the system timestamp sent by the client, the unique request serial number, and the unique device number.

7. The method for transmitting an Internet zone symmetric key according to claim 1, characterized in that: In step S2, if there are other exceptions in the whole process, the client APP will be responded to as an unknown error and the key transfer will fail. If the relevant verification and data operations of the whole process are successful, the client APP will be responded to as the national secret sm4 symmetric key transfer is successful.

8. A system for delivering symmetric keys in an Internet area, characterized in that: include: The original data encryption module is used to randomly generate a national secret SM4 symmetric key on the client, encrypt the generated national secret SM4 symmetric key with the national secret SM2 private key, encrypt the client system timestamp, unique request serial number, and device unique number with the national secret SM4 symmetric key, and use the SM2 private key to sign the encrypted national secret SM4 symmetric key, client system timestamp, unique request serial number, and device unique number in sequence and send a request to the server; The data verification module is used for receiving the SM4 symmetric key transmission interface request at the server end, decrypting the encrypted SM4 symmetric key ciphertext using the national secret SM2 public key to obtain the SM4 symmetric key, and then using the SM4 symmetric key to decrypt the client system timestamp, unique request serial number, and device unique number to obtain the original data, verifying the original data, verifying the signature data, and responding the processing result to the client; The data response module is used for the client to receive various types of exceptions in the server response, clear the client cache sm4 symmetric key, regenerate the sm4 key, and repeat step S1 until the server key transfer interface responds successfully; when the client receives the server response successfully, it means that the sm4 symmetric key is successfully transferred, and other subsequent interface transactions directly carry the unique device number and encrypt and decrypt data through the sm4 symmetric encryption key.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for transmitting the Internet zone symmetric key as claimed in any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for transmitting an Internet zone symmetric key as claimed in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Data encryption method and device, data decryption method and device, electronic device and storage medium

    CN110213041A

  • Reliable data transmission and storage method and system based on national cryptographic algorithm

    CN115632880A