Method and system for quickly constructing national secret encryption channel
By using the SM2 ellipse curve algorithm and the rapid key negotiation and encryption decryption process of the SM2 ellipse curve algorithm and the SM4 algorithm during the establishment of the encryption channel, the problem of the existing encrypted channel establishment of the existing encryption channel and the long time of computing resources and long time, and the fast and secure encryption encryption Channel is established.
Patent Information
- Application Number
- CN202411278910.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2025-01-28
AI Technical Summary
The existing encryption channel is used to consume a lot of computing resources during the establishment of the existing encryption channel, resulting in a longer tunnel establishment time.
Through the SM2 oval curve algorithm and the rapid key negotiation and encryption decryption process based on the SM2 oval curve algorithm and the SM4 algorithm, the rapid authentication and key negotiation between the client and the server, and then quickly establish an encrypted channel.
Under the premise of ensuring communication security, the time and bandwidth of the encrypted channels are significantly saved, and the goal of rapidly building the national encryption channel is achieved.
Smart Images

Figure CN119382897A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method and system for rapidly constructing a national secret encryption channel. Background Art
[0002] The national secret algorithm is a commercial encryption algorithm commonly used in my country. The national secret algorithm refers to a series of commercial encryption algorithms compiled and published by the State Cryptography Administration, including the asymmetric encryption algorithm SM2 based on elliptic curve ECC, the data summary algorithm SM3 and the group symmetric block encryption algorithm SM4. The disclosure of the national secret algorithm provides a standard for the safe application of China's commercial encryption algorithms. At the same time, the security of the algorithm is subject to global inspection by publishing the algorithm, so that related security products can be recognized by the international market.
[0003] An encrypted channel refers to an encrypted data transmission path established between two communicating parties. On this path, all transmitted data will be encrypted to prevent unauthorized access and modification. Due to the complex design of some encryption algorithms, more computing resources are consumed during the establishment of the encrypted channel, thereby prolonging the tunnel establishment time. For example, the national SSL protocol requires 13 data packet exchanges to complete the establishment of a secure channel. To address these issues, it is necessary to select efficient encryption algorithms and protocols to optimize the speed of establishing encrypted channels. Summary of the invention
[0004] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0005] In view of the above existing problems, the present invention is proposed.
[0006] Therefore, the present invention provides a method and system for quickly constructing a national secret encryption channel to solve the problem that the existing encryption channel establishment process consumes a lot of computing resources and takes a long time to establish the tunnel.
[0007] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0008] In a first aspect, the present invention provides a method for quickly constructing a national secret encryption channel, comprising:
[0009] Based on sensitive data transmission scenarios, the client and server generate their own client and server private keys and apply for SM2 algorithm certificates.
[0010] Based on the private key and digital certificate, the client and the server perform a handshake process, wherein the handshake process includes the client and the server performing identity authentication and negotiation by exchanging certificates, temporary public keys and signature information;
[0011] Based on the temporary public key information exchanged between the client and the server, key negotiation is performed through the SM2 elliptic curve algorithm to obtain negotiation data;
[0012] Based on the session key in the negotiated data, the communication data is encrypted and decrypted using the GCM mode of the SM4 algorithm.
[0013] As a preferred solution of the method for quickly constructing a national secret encryption channel described in the present invention, wherein:
[0014] The handshake process between the client and the server includes the following steps:
[0015] The client selects a random number as a temporary private key c and uses the SM2 elliptic curve algorithm to calculate the client's temporary public key C;
[0016] The client sends the key negotiation information including the SM2 algorithm certificate, temporary public key C and message signature to the server;
[0017] The server receives the negotiation information from the client and parses the key exchange information therein;
[0018] The server verifies the key exchange information parsed by the client;
[0019] The server selects a random number as a temporary private key s, and uses the SM2 elliptic curve algorithm to calculate the server's temporary public key S;
[0020] If the verification is correct, the server will send the key negotiation information including the server SM2 algorithm certificate, temporary public key S and message signature to the client;
[0021] The client receives the negotiation information from the server and parses the key exchange information therein.
[0022] The client verifies the key exchange information parsed by the server.
[0023] As a preferred solution of the method for quickly constructing a national secret encryption channel described in the present invention, wherein:
[0024] The temporary public key C of the client is expressed as:
[0025] C=c*G
[0026] Where G is the base point of the SM2 elliptic curve algorithm;
[0027] The temporary public key S of the server is expressed as:
[0028] S=s*G.
[0029] As a preferred solution of the method for quickly constructing a national secret encryption channel described in the present invention, wherein:
[0030] The server verifies the key exchange information parsed by the client, including the following steps:
[0031] The server uses the public key and certificate revocation list of the SM2 algorithm certificate to verify the client's SM2 algorithm certificate, including checking whether the certificate is issued by a trusted CA, whether the certificate chain is complete, whether the certificate is expired, and whether it has been revoked;
[0032] If the SM2 algorithm certificate is not issued by a trusted CA, the negotiation process ends;
[0033] If the SM2 algorithm certificate chain is incomplete, the negotiation process ends;
[0034] If the SM2 algorithm certificate has expired, the negotiation process ends;
[0035] If the SM2 algorithm certificate has been revoked, the negotiation process ends;
[0036] The server verifies the client's signature using the public key extracted from the client's SM2 algorithm certificate.
[0037] As a preferred solution of the method for quickly constructing a national secret encryption channel described in the present invention, wherein:
[0038] The method of performing key negotiation by using the SM2 elliptic curve algorithm to obtain negotiation data includes the following steps:
[0039] The client and the server perform SM2 elliptic curve point multiplication using their own temporary private keys and the other party's temporary public keys, calculate the client's shared key point X and the server's shared key point X respectively, and verify the shared key point X;
[0040] The client and server share the coordinates of the key point X [x X ,y x ] performs XOR operation to obtain the negotiated data M.
[0041] As a preferred solution of the method for quickly constructing a national secret encryption channel described in the present invention, wherein:
[0042] The shared key point X of the client is expressed as:
[0043] X=[c]S=[c][s]G=[x X ,y X]
[0044] The shared key point X of the server is expressed as:
[0045] X=[s]C=[s][c]G=[x X ,y X ]
[0046] The negotiation data M is expressed as:
[0047]
[0048] As a preferred solution of the method for quickly constructing a national secret encryption channel described in the present invention, wherein:
[0049] The method of encrypting and decrypting communication data based on the session key in the negotiation data using the GCM mode of the SM4 algorithm includes the following steps:
[0050] Extract the first 16 bytes from the negotiation data M as the session key K;
[0051] Extract the following 12 bytes from the negotiation data M as the initial vector IV;
[0052] Use the session key K to generate a key H for the GHASH function and set the counter to the initial value. Each time a block is encrypted, the counter CTR increases by 1.
[0053] Use the GHASH function and key H to hash AAD and the ciphertext block to generate the sender's authentication tag T;
[0054] For a plaintext block P i , use SM4 algorithm and session key K for encryption operation;
[0055] At the same time, the counter value is updated, and the key material required for encryption is generated based on the new counter value;
[0056] Send encrypted data block C i and the sender’s authentication tag T to the receiver;
[0057] Execute the GHASH function again, use the key H to hash AAD and the ciphertext block, and generate the authentication tag T′ of the receiving end;
[0058] Apply the SM4 algorithm and the session key K to the received ciphertext block C i Decryption is performed;
[0059] Compare the authentication tag T′ of the receiving end with the authentication tag T of the sending end;
[0060] If T′ is equal to T, the data has not been tampered with;
[0061] If T′ is not equal to T, the data has been tampered with during transmission.
[0062] In a second aspect, the present invention provides a system for quickly constructing a national secret encryption channel, comprising:
[0063] The private key generation module is used to generate the client private key and the server private key respectively based on the sensitive data transmission scenario, and apply for the SM2 algorithm certificate;
[0064] The authentication negotiation module is used to perform a handshake process between the client and the server based on the private key and the digital certificate. The handshake process includes the client and the server performing identity authentication and negotiation by exchanging certificates, temporary public keys and signature information;
[0065] The key negotiation module is used to perform key negotiation based on the temporary public key information exchanged between the client and the server through the SM2 elliptic curve algorithm to obtain negotiation data;
[0066] The encryption and decryption module is used to encrypt and decrypt communication data based on the session key in the negotiation data using the GCM mode of the SM4 algorithm.
[0067] In a third aspect, the present invention provides a computing device, comprising:
[0068] Memory, used to store programs;
[0069] A processor is used to execute the computer executable instructions, which, when executed by the processor, implement the steps of the method for quickly constructing a national secret encryption channel.
[0070] In a fourth aspect, the present invention provides a computer-readable storage medium, comprising: when the program is executed by a processor, the steps of implementing the method of quickly constructing a national secret encryption channel are implemented.
[0071] Beneficial effects of the present invention: The present invention optimizes and simplifies various negotiation parameters based on a domestic encryption algorithm to achieve rapid establishment of a secure channel. The entire process only requires a round-trip delay, saving time and bandwidth while ensuring communication security. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0073] Figure 1A basic flow chart of a method for quickly constructing a national secret encryption channel provided by an embodiment of the present invention;
[0074] Figure 2 A complete flowchart of a method for quickly building a national secret encryption channel provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0075] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0076] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0077] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0078] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.
[0079] At the same time, in the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0080] In the present invention, unless otherwise clearly specified and limited, the terms "install, connect, connect" should be understood in a broad sense, for example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0081] Example 1
[0082] Reference Figure 1-2 , is an embodiment of the present invention, which provides a method for quickly constructing a national secret encryption channel, such as Figure 1 As shown, the following steps are included:
[0083] S1: Based on the sensitive data transmission scenario, the client and server generate the client private key and server private key respectively, and apply for the SM2 algorithm certificate;
[0084] S2: Based on the private key and digital certificate, the client and the server perform a handshake process, wherein the handshake process includes the client and the server performing identity authentication and negotiation by exchanging certificates, temporary public keys and signature information;
[0085] In the embodiment of the present application, the client and the server perform a handshake process, including the following steps:
[0086] The client selects a random number as a temporary private key c and uses the SM2 elliptic curve algorithm to calculate the client's temporary public key C;
[0087] The client sends the key negotiation information including the SM2 algorithm certificate, temporary public key C and message signature to the server;
[0088] The client sends the key negotiation information including its certificate, temporary public key C and message signature to the server. The message format is as follows:
[0089] Client certificate | Client temporary public key (04 + coordinate X + coordinate Y) | Client signature
[0090] The client certificate and client signature data are in DER encoding format, and the client signature is an SM2 algorithm signature of the client certificate and the client temporary public key.
[0091] The server receives the negotiation information from the client and parses the key exchange information therein;
[0092] The server verifies the key exchange information parsed by the client;
[0093] The server selects a random number as a temporary private key s, and uses the SM2 elliptic curve algorithm to calculate the server's temporary public key S;
[0094] The server sends the key negotiation information including its certificate, temporary public key S and message signature to the client. The message format is as follows:
[0095] Server certificate | Server temporary public key (04 + coordinate X + coordinate Y) | Server signature
[0096] The server certificate and server signature data are in DER encoding format, and the server signature is an SM2 algorithm signature of the server certificate and the server temporary public key.
[0097] If the verification is correct, the server will send the key negotiation information including the server SM2 algorithm certificate, temporary public key S and message signature to the client;
[0098] The client receives the negotiation information from the server and parses the key exchange information therein.
[0099] The client verifies the key exchange information parsed by the server.
[0100] In the embodiment of the present application, the temporary public key C of the client is expressed as:
[0101] C=c*G
[0102] Where G is the base point of the SM2 elliptic curve algorithm;
[0103] In the embodiment of the present application, the temporary public key S of the server is expressed as:
[0104] S=s*G.
[0105] In an embodiment of the present application, the server verifies the key exchange information parsed by the client, including the following steps:
[0106] The server verifies the validity of the client certificate using the public key of the CA root certificate and the certificate revocation list, including checking whether the certificate is issued by a trusted CA, the integrity of the certificate chain, whether the certificate is expired, or whether it is revoked. If the check fails, the negotiation process ends.
[0107] The server uses the public key client_pub extracted from the client certificate to verify the validity of the client signature, ensure that the temporary public key C is sent by the client, and confirm that the negotiation information has not been tampered with;
[0108] The server uses the public key and certificate revocation list of the SM2 algorithm certificate to verify the client's SM2 algorithm certificate, including checking whether the certificate is issued by a trusted CA, whether the certificate chain is complete, whether the certificate is expired, and whether it has been revoked;
[0109] If the SM2 algorithm certificate is not issued by a trusted CA, the negotiation process ends;
[0110] If the SM2 algorithm certificate chain is incomplete, the negotiation process ends;
[0111] If the SM2 algorithm certificate has expired, the negotiation process ends;
[0112] If the SM2 algorithm certificate has been revoked, the negotiation process ends;
[0113] The server verifies the client's signature using the public key extracted from the client's SM2 algorithm certificate.
[0114] Verification is performed based on the parsed key exchange information. The client's operations are the same as those of the server, and will not be repeated here.
[0115] S3: Based on the temporary public key information exchanged between the client and the server, key negotiation is performed through the SM2 elliptic curve algorithm to obtain negotiation data;
[0116] In an embodiment of the present application, in the SM2 elliptic curve cryptography system, the core of the key agreement module is to securely generate a shared key based on elliptic curve point multiplication operations.
[0117] In an embodiment of the present application, key negotiation is performed through the SM2 elliptic curve algorithm to obtain negotiation data, including the following steps:
[0118] S3.1: Calculate the shared key point: The client and the server perform SM2 elliptic curve point multiplication using their own temporary private key and the other party's temporary public key, calculate the client's shared key point X and the server's shared key point X respectively, and verify the shared key point X;
[0119] S3.2: The client and server share the coordinates of the key point X [x X ,y X ] performs XOR operation to obtain the negotiated data M.
[0120] In the embodiment of the present application, the client calculates the shared key point X as:
[0121] X=[c]S=[c][s]G=[x X ,y X ]
[0122] In the embodiment of the present application, the server calculates the shared key point X as:
[0123] X=[s]C=[s][c]G=[x X ,y X ]
[0124] Since the elliptic curve point multiplication operation satisfies the commutative law, the calculation results on both sides are the same, that is, the shared key point X.
[0125] In the embodiment of the present application, both parties share the coordinates of the key point X [x X ,y X ] Perform XOR operation to obtain negotiation data M:
[0126]
[0127] In the embodiment of the present application, the client performs an XOR operation on the coordinates x and y of X (both with a length of 32 bytes) to obtain 32-byte negotiation data M.
[0128] In the embodiment of the present application, the server performs an XOR operation on the coordinates x and y of X (both with a length of 32 bytes) to obtain 32 bytes of negotiation data M.
[0129] In an embodiment of the present application, the client and the server negotiate the public data M through the above steps, where M is 32 bytes, which serves as a parameter for subsequent channel session encryption.
[0130] S4: Based on the session key in the negotiated data, the communication data is encrypted and decrypted using the GCM mode of the SM4 algorithm.
[0131] In the embodiment of the present application, on the encrypted channel, both parties use the session key and the GCM mode of the SM4 algorithm to encrypt and decrypt data, where the password is the first 16 bytes of M and the initial vector is the next 12 bytes. The following are the specific encryption and decryption steps:
[0132] S4.1: Key and parameter preparation
[0133] Let the session key be K, with a length of 128 bits (i.e. 16 bytes), which meets the requirements of SM4. Take the first 12 bytes from M as IV, recorded as IV. You can add some data (AAD) that does not need to be encrypted but needs to be authenticated.
[0134] S4.2: GCM mode initialization
[0135] Use the session key K to generate a key H for the GHASH function;
[0136] In GCM mode, the length of H is 128 bits. GCM mode uses a counter to generate encrypted blocks. The counter starts from an initial value and increments each time a block is encrypted.
[0137] Initialize counter: GCM mode uses a counter to generate the key stream required for encryption. The counter starts from an initial value, and the counter CTR increases by 1 each time a block is encrypted.
[0138] S4.3: Encryption process
[0139] Generate authentication tag: Use the GHASH function and key H to perform hash operation on AAD and ciphertext block to generate the authentication tag T of the sender. The mathematical expression is:
[0140] T=GHASH H (AAD|Ciphertext block)
[0141] Encrypted data: For each plaintext block P i , encrypted using the SM4 algorithm and key K. At the same time, the counter is incremented and used to generate the key for the encrypted block. The encrypted data block is C i , the mathematical expression is:
[0142] C i =SM4 K (Counter i |P i )
[0143] S4.4: Send ciphertext and authentication tag
[0144] The encrypted data block C i and the authentication tag T of the sender are sent to the receiver.
[0145] S4.5: Decryption and Verification Process
[0146] Execute the GHASH function again, use the key H to hash AAD and the ciphertext block, and generate the authentication tag T′ of the receiving end;
[0147] Apply the SM4 algorithm and the session key K to the received ciphertext block C i Decryption is performed;
[0148] Compare the authentication tag T′ of the receiving end with the authentication tag T of the sending end;
[0149] If T′ is equal to T, the data has not been tampered with;
[0150] If T′ is not equal to T, the data has been tampered with during transmission.
[0151] It should be noted that the client sends a negotiation message containing its certificate, temporary public key C and signature to the server. After receiving it, the server verifies the message and sends its certificate, temporary public key S and signature to the client. The whole process involves only one transmission from the client to the server and one reply from the server to the client, that is, one round trip delay.
[0152] It should be noted that the SM2 elliptic curve algorithm is used for key negotiation, which is usually faster and less computationally intensive than other key negotiation mechanisms. Both the client and the server perform point multiplication operations on their own temporary private keys and the other party's temporary public keys to calculate the shared key point X, and obtain the final negotiation data M through a simple XOR operation. This step has high computational efficiency.
[0153] It should be noted that high security is ensured by using the SM2 elliptic curve algorithm, exchanging certificates and verifying the validity of both parties' certificates, and using elliptic curve point multiplication and XOR operations to generate shared keys. Even if an attacker intercepts the negotiation information, the shared key cannot be directly calculated.
[0154] It should be noted that both the client and the server participate in the verification of each other's certificates and signatures. This two-way verification mechanism enhances the security of the protocol and makes it impossible for either party to impersonate the other.
[0155] It should be noted that by adding random numbers and temporary public keys to the negotiation information, a different key is generated for each negotiation, which effectively prevents attackers from stealing data by replaying old negotiation information.
[0156] It should be noted that the SM4 algorithm is used for data encryption and decryption. SM4 is a symmetric encryption algorithm of China's national standard, supports the GCM mode, and provides higher encryption efficiency and flexibility.
[0157] It should be noted that the negotiated shared key M is 32 bytes, which is long enough to ensure security and facilitate subsequent encryption and decryption operations.
[0158] It should be noted that by checking the certificate revocation list, communications using revoked certificates can be discovered and blocked in a timely manner, thereby enhancing the security of the protocol.
[0159] It should be noted that during the negotiation process, if verification fails in a certain step, the negotiation process will be terminated directly, which avoids continuing communication in an unsafe environment and ensures the security of the protocol.
[0160] This embodiment also provides a system for quickly building a national secret encryption channel, including:
[0161] The private key generation module is used to generate the client private key and the server private key respectively based on the sensitive data transmission scenario, and apply for the SM2 algorithm certificate;
[0162] The authentication negotiation module is used to perform a handshake process between the client and the server based on the private key and the digital certificate. The handshake process includes the client and the server performing identity authentication and negotiation by exchanging certificates, temporary public keys and signature information;
[0163] The key negotiation module is used to perform key negotiation based on the temporary public key information exchanged between the client and the server through the SM2 elliptic curve algorithm to obtain negotiation data;
[0164] The encryption and decryption module is used to encrypt and decrypt communication data based on the session key in the negotiation data using the GCM mode of the SM4 algorithm.
[0165] Furthermore, it also includes:
[0166] Memory, used to store programs;
[0167] A processor is used to load the program to execute the method of quickly constructing a national secret encryption channel.
[0168] This embodiment also provides a computer-readable storage medium storing a program, which, when executed by a processor, implements the method of quickly constructing a national secret encryption channel.
[0169] The storage medium proposed in this embodiment and the method for quickly constructing a national secret encryption channel proposed in the above embodiment belong to the same inventive concept. The technical details not described in detail in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0170] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ReadOnly, Memory, ROM), random access memory (RandomAccess Memory, RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform the methods of various embodiments of the present invention.
[0171] Example 2
[0172] Referring to Table 1, an embodiment of the present invention provides a method for quickly constructing a national secret encryption channel. In order to verify its beneficial effects, comparison results of two schemes are provided.
[0173] The specific embodiments are as follows:
[0174] Purpose
[0175] Verify the performance differences in handshake time, handshake data volume, etc. between the encryption channel establishment process based on the national secret algorithm and the traditional TLS / SSL protocol.
[0176] Experimental parameters
[0177] Handshake Steps: Records the number of steps required to complete a handshake.
[0178] Handshake time: The time from the start of a handshake to its completion.
[0179] Handshake data volume: The total amount of data transmitted to complete the handshake process.
[0180] Network latency: The one-way network latency between the client and the server.
[0181] Encryption algorithm: an algorithm used for key exchange, session key generation, and data encryption.
[0182] Experimental environment
[0183] operating system:
[0184] Client: Windows 10 / Ubuntu 20.04
[0185] Server: Ubuntu 20.04
[0186] Hardware configuration:
[0187] CPU: Intel Core i7 or equivalent Memory: 16GB RAM
[0188] Network environment:
[0189] LAN: 100Mbps
[0190] WAN: 10Mbps
[0191] Software Configuration:
[0192] Client: SSL / TLS client implementation based on national encryption algorithm
[0193] Server side: SSL / TLS server implementation based on national encryption algorithm
[0194] Test tools: Wireshark, iperf, etc.
[0195] Experimental procedures
[0196] Step 1: Preparation stage:
[0197] Install and configure the SSL / TLS implementation based on the national encryption algorithm on the client and server. Configure the client and server to support the traditional TLS / SSL protocol.
[0198] Use Wireshark to capture network traffic to analyze the packets during the handshake process.
[0199] Step 2: Testing phase:
[0200] Step 2.1: Use the national encryption algorithm to establish an encrypted channel.
[0201] Record the number of handshake steps.
[0202] Use iperf to measure the handshake time.
[0203] Use Wireshark to count the amount of data during the handshake process.
[0204] Step 2.2: Use the traditional TLS / SSL protocol to establish an encrypted channel.
[0205] Record the number of handshake steps.
[0206] Use iperf to measure the handshake time.
[0207] Use Wireshark to count the amount of data during the handshake process.
[0208] Data Collection:
[0209] Compare the number of handshake steps, handshake time, and handshake data volume of the two solutions.
[0210] Record the encryption algorithm used under each scheme.
[0211] Analysis phase:
[0212] Analyze the collected data and compare the differences between the national encryption algorithm scheme and the traditional TLS / SSL protocol in terms of handshake time and handshake data volume.
[0213] Considering the impact of network latency, compare the performance in different network environments (LAN, WAN).
[0214] in conclusion:
[0215] The experimental comparison results are shown in Table 1, which shows that the encryption channel based on the national secret algorithm has advantages in handshake time, handshake data volume, etc.
[0216] Explore the key factors that influence performance.
[0217] Table 1 Comparison table
[0218]
[0219] As can be seen from Table 1, our processing and division of the national secret algorithm is relatively detailed. By optimizing and simplifying various negotiation parameters, we are superior to the traditional national secret TLS / SSL protocol in terms of handshake time, handshake data volume, and number of handshake steps, improving the speed and efficiency of establishing encrypted channels, which is especially important in sensitive data transmission scenarios. This optimization is particularly critical when a secure connection needs to be established quickly.
[0220] 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 preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for quickly constructing a national secret encryption channel, characterized in that: include: Based on sensitive data transmission scenarios, the client and server generate their own client and server private keys and apply for SM2 algorithm certificates. Based on the private key and digital certificate, the client and the server perform a handshake process, wherein the handshake process includes the client and the server performing identity authentication and negotiation by exchanging certificates, temporary public keys and signature information; Based on the temporary public key information exchanged between the client and the server, key negotiation is performed through the SM2 elliptic curve algorithm to obtain negotiation data; Based on the session key in the negotiated data, the communication data is encrypted and decrypted using the GCM mode of the SM4 algorithm.
2. The method for rapidly constructing a national secret encryption channel as claimed in claim 1, characterized in that: The handshake process between the client and the server includes the following steps: The client selects a random number as a temporary private key c and uses the SM2 elliptic curve algorithm to calculate the client's temporary public key C; The client sends the key negotiation information including the SM2 algorithm certificate, temporary public key C and message signature to the server; The server receives the negotiation information from the client and parses the key exchange information therein; The server verifies the key exchange information parsed by the client; The server selects a random number as a temporary private key s, and uses the SM2 elliptic curve algorithm to calculate the server's temporary public key S; If the verification is correct, the server will send the key negotiation information including the server SM2 algorithm certificate, temporary public key S and message signature to the client; The client receives the negotiation information from the server and parses the key exchange information therein. The client verifies the key exchange information parsed by the server.
3. The method for quickly constructing a national secret encryption channel as described in claim 1 or 2, characterized in that: The temporary public key C of the client is expressed as: C=c*G Where G is the base point of the SM2 elliptic curve algorithm; The temporary public key S of the server is expressed as: S=s*G.
4. The method for rapidly constructing a national secret encryption channel as claimed in claim 3, characterized in that: The server verifies the key exchange information parsed by the client, including the following steps: The server uses the public key and certificate revocation list of the SM2 algorithm certificate to verify the client's SM2 algorithm certificate, including checking whether the certificate is issued by a trusted CA, whether the certificate chain is complete, whether the certificate is expired, and whether it has been revoked; If the SM2 algorithm certificate is not issued by a trusted CA, the negotiation process ends; If the SM2 algorithm certificate chain is incomplete, the negotiation process ends; If the SM2 algorithm certificate has expired, the negotiation process ends; If the SM2 algorithm certificate has been revoked, the negotiation process ends; The server verifies the client's signature using the public key extracted from the client's SM2 algorithm certificate.
5. The method for rapidly constructing a national secret encryption channel as claimed in claim 4, characterized in that: The method of performing key negotiation by using the SM2 elliptic curve algorithm to obtain negotiation data includes the following steps: The client and the server perform SM2 elliptic curve point multiplication using their own temporary private keys and the other party's temporary public keys, calculate the client's shared key point X and the server's shared key point X respectively, and verify the shared key point X; The client and server share the coordinates of the key point X [x X ,y X ] performs XOR operation to obtain the negotiated data M.
6. The method for rapidly constructing a national secret encryption channel as claimed in claim 5, characterized in that: The shared key point X of the client is expressed as: X=[c]S=[c][s]G=[x X ,y X ] The shared key point X of the server is expressed as: X=[s]C=[s][c]G=[x X ,y X ] The negotiation data M is expressed as:
7. The method for rapidly constructing a national secret encryption channel as claimed in claim 6, characterized in that: The method of encrypting and decrypting communication data based on the session key in the negotiation data using the GCM mode of the SM4 algorithm includes the following steps: Extract the first 16 bytes from the negotiation data M as the session key K; Extract the following 12 bytes from the negotiation data M as the initial vector IV; Use the session key K to generate a key H for the GHASH function and set the counter to the initial value. Each time a block is encrypted, the counter CTR increases by 1. Use the GHASH function and key H to hash AAD and the ciphertext block to generate the sender's authentication tag T; For a plaintext block P i , use SM4 algorithm and session key K for encryption operation; At the same time, the counter value is updated, and the key material required for encryption is generated based on the new counter value; Send encrypted data block C i and the sender’s authentication tag T to the receiver; Execute the GHASH function again, use the key H to hash AAD and the ciphertext block, and generate the authentication tag T′ of the receiving end; Apply the SM4 algorithm and the session key K to the received ciphertext block C i Decryption is performed; Compare the receiving end's authentication tag T' with the sending end's authentication tag T; If T′ is equal to T, the data has not been tampered with; If T′ is not equal to T, the data has been tampered with during transmission.
8. A system based on the method for quickly constructing a national secret encryption channel according to claim 1, characterized in that: The private key generation module is used to generate the client private key and the server private key respectively based on the sensitive data transmission scenario, and apply for the SM2 algorithm certificate; The authentication negotiation module is used to perform a handshake process between the client and the server based on the private key and the digital certificate. The handshake process includes the client and the server performing identity authentication and negotiation by exchanging certificates, temporary public keys and signature information; The key negotiation module is used to perform key negotiation based on the temporary public key information exchanged between the client and the server through the SM2 elliptic curve algorithm to obtain negotiation data; The encryption and decryption module is used to encrypt and decrypt communication data based on the session key in the negotiation data using the GCM mode of the SM4 algorithm.
9. An electronic device, characterized in that: include: Memory, used to store programs; A processor, used to load the program to execute the steps of the method for quickly constructing a national secret encryption channel as described in any one of claims 1-7.
10. A computer-readable storage medium storing a program, characterized in that: When the program is executed by the processor, the steps of the method for quickly constructing a national secret encryption channel as described in any one of claims 1-7 are implemented.
Citation Information
Cited By
LED (light-emitting diode) screen safe delivery system with password module
CN119893173A
Sensitive data import and export system and method based on substrate management controller
CN120408685A
Automobile sentry mode video security transmission system and method
CN120881313A
Data processing method and device, equipment and storage medium
CN121098498A
Certificateless post-quantum TLS handshake method based on KEM and IBE
CN121603205A