Method, apparatus and device for secure data transmission

By incrementally updating serial numbers and calculating distinct IVs for bidirectional IPSec communication, the method reduces resource consumption by allowing a single SA to secure both inbound and outbound communications.

JP7758397B2Active Publication Date: 2025-10-22CHINA IWNCOMM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2024540781
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2022-01-05
Filing Date
2022-12-20
Publication Date
2025-10-22
Estimated Expiration
2042-12-20

AI Technical Summary

Technical Problem

The use of unidirectional Security Associations (SAs) in IPSec communication consumes excessive system resources due to the need for separate keys for inbound and outbound communications.

Method used

A method where nodes incrementally update their serial numbers (SN) and perform mathematical transformations to calculate distinct initialization vectors (IVs) for both directions of communication, ensuring the same key can be used for both inbound and outbound communications by making the calculated IVs unequal.

Benefits of technology

This approach reduces the number of SAs required, conserving system resources and maintaining communication security by allowing a single SA to be established, thus optimizing resource usage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007758397000002
    Figure 0007758397000002
  • Figure 0007758397000003
    Figure 0007758397000003
  • Figure 0007758397000004
    Figure 0007758397000004
Patent Text Reader

Abstract

The present invention provides a method, apparatus and device for secure data transmission, which includes the steps of: node 1 incrementally updating its own initialized serial number SN1 value, performing a first mathematical transformation on the updated SN1 value, and calculating a first initialization vector IV1; node 1 encrypting a first data packet based on the calculated IV1 and a key, and then transmitting the first data packet to node 2; node 2 obtaining the SN1 value in the received first data packet, performing a first mathematical transformation on the obtained SN1 value, calculating the IV1, and decrypting the encrypted first data packet using the calculated IV1 and the key; and node 2 incrementally updating its own initialized serial number SN1 value, performing a first mathematical transformation on the updated SN1 value, and calculating a first initialization vector IV1. and the node 2 encrypts a second data packet based on the calculated IV2 and the key and sends the encrypted second data packet to the node 1. The node 1 obtains the SN2 value in the received second data packet, performs the second mathematical transformation on the obtained SN2 value, calculates the IV2, and decrypts the encrypted second data packet using the calculated IV2 and the key, where the first mathematical transformation and the second mathematical transformation make the calculated IV1 and IV2 not equal. The present invention realizes secure data transmission between two nodes through a bidirectional SA and reduces required resources.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS This application claims priority based on a Chinese patent application filed with the China Patent Office on January 5, 2022, bearing application number 202210005672.6 and entitled "Method, Apparatus and Device for Secure Data Transmission," the entire disclosure of which is incorporated herein by reference.

[0002] Technical Field The present invention relates to the field of communication technologies, and in particular to a method, an apparatus and a device for secure data transmission. [Background technology]

[0003] Internet Protocol Security (IPSec) provides secure communication between two nodes. A Security Association (SA) is the basis of IPSec and refers to a set of policies and keys used to protect communicated information. An Initialization Vector (IV), also known as a Starting Variable (SV), is a fixed-length input value that is typically random or pseudorandom.

[0004] In existing technology, when two IPSec nodes communicate bidirectionally, an IV is calculated using the serial number (SN) included in the data packet, and the packet is encrypted / decrypted jointly using the key and IV value in the SA. The SA is a unidirectional logical connection, and when the two nodes communicate bidirectionally, a pair of SAs, one for inbound communication and one for outbound communication, must be established. Therefore, the method using unidirectional SAs has the disadvantage of consuming system resources. Summary of the Invention [Problem to be solved by the invention]

[0005] The present invention provides a method, apparatus and device for secure data transmission that solves the problem of the prior art that the scheme using unidirectional SA consumes system resources. [Means for solving the problem]

[0006] In a first aspect, the present invention provides a method for secure data transmission, said method comprising: Node 1 incrementally updates its own initialized serial number SN1 value, performs a first mathematical transformation on the updated SN1 value, and calculates a first initialization vector IV1; The node 1 encrypts a first data packet based on the calculated IV1 and key, and then sends the first data packet to the node 2; the node 2 obtaining an SN1 value in a received first data packet, performing a first mathematical transformation on the obtained SN1 value to calculate the IV1, and decrypting the encrypted first data packet using the calculated IV1 and the key; the node 2 incrementally updating its own initialized serial number SN2 value and performing a second mathematical transformation on the updated SN2 value to calculate a second initialization vector IV2; the node 2 encrypts a second data packet based on the IV2 and the key, and then sends the second data packet to the node 1; the node 1 obtaining the SN2 value in the received second data packet, performing the second mathematical transformation on the obtained SN2 value, calculating the IV2, and decrypting the encrypted second data packet using the calculated IV2 and the key; Here, the first mathematical transformation and the second mathematical transformation cause the calculated IV1 and IV2 to be unequal.

[0007] Optionally, before calculating the first initialization vector IV1, the node 1 / the node 2: determining an overflow order of SN1 and IV1; If it is determined that SN1 will overflow first, performing a first mathematical transformation on the updated / obtained SN1 value and calculating said IV1 may include: a step of calculating IV1 by multiplying the SN1 value used to calculate IV1 as a first dynamic parameter by a coefficient P, and then summing the product of the first dynamic parameter and the coefficient P, a differential parameter C, and a first parameter Q1 to calculate IV1; If it is determined that IV1 will overflow first, performing a first mathematical transformation on the updated / obtained SN1 value to calculate said IV1 may include: Dividing SN1 by M to calculate IV1, obtaining the remainder to obtain a third dynamic parameter, multiplying the third dynamic parameter by the coefficient P, and then calculating IV1 by summing the product of the third dynamic parameter and the coefficient P, the differential parameter C, and the Q1; where P is not equal to 1 or 0, Q1 is 0 or is not an integer multiple of P, the length of C is equal to the length n of IV1, C includes k high-order bits and nk low-order bits, and the value of the low-order bits is zero, and M is the maximum value 2 of the low-order nk bits of IV1 when IV1 first overflows. n-k is.

[0008] Optionally, determining the overflow order of SN1 and IV1 comprises: calculating the difference between the length n of IV1 and the length k of the most significant bits; determining that SN1 overflowed first if the length m of SN1 is not greater than said difference; and determining that IV1 overflowed first if the length m of SN1 is greater than the difference.

[0009] Optionally, before the node 2 / the node 1 calculates a second initialization vector IV2, determining an overflow order of SN2 and IV2; If it is determined that the SN2 has overflowed first, performing a second mathematical transformation on the updated / obtained SN2 value to calculate the IV2 may include: a step of setting the SN2 value for calculating IV2 as a second dynamic parameter, multiplying the second dynamic parameter by the coefficient P, and then calculating IV2 by summing the product of the second dynamic parameter and the coefficient P, the differential parameter C, and a second parameter Q2; If it is determined that IV2 has overflowed first, performing a second mathematical transformation on the updated / obtained SN2 value to calculate said IV2 may include: the step of dividing SN2 by M to calculate IV2, obtaining the remainder to obtain a fourth dynamic parameter, multiplying the fourth dynamic parameter by the coefficient P, and then calculating IV2 by summing the product of the fourth dynamic parameter and the coefficient P, the differential parameter C, and Q2; Here, Q2 is 0 or is not an integer multiple of P, Q2 is different from Q1, the length of C is equal to the length n of IV2, and M is the maximum value 2 of the lower nk bits of IV2 when IV2 first overflows. n-k is.

[0010] Optionally, the step of determining an overflow order of SN2 and IV2 comprises: calculating the difference between the length n of IV2 and the length k of the most significant bits; determining that SN2 overflowed first if the length m of SN2 is not greater than said difference; If the length m of SN2 is greater than the difference, it is determined that IV2 overflowed first.

[0011] Optionally, before calculating the first initialization vector IV1, the node 1 / the node 2 further: When it is determined that SN1 has first overflowed and the first dynamic parameter has reached a first preset threshold, a key update operation is initiated, and when the first dynamic parameter has reached a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is less than the second preset threshold, and the second preset threshold is less than or equal to a maximum value of SN1; When IV1 first overflows and it is determined that the third dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the third dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, where the third preset threshold is smaller than the fourth preset threshold and the fourth preset threshold is not greater than the maximum value of the lower nk bits of IV1.

[0012] Optionally, before the node 2 / the node 1 calculates the second initialization vector IV2, further: When SN2 overflows first and it is determined that the second dynamic parameter has reached a first preset threshold, a key update operation is initiated, and when the second dynamic parameter reaches a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is smaller than the second preset threshold, and the second preset threshold is not larger than the maximum value of SN2; When IV2 overflows first and it is determined that the fourth dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the fourth dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, where the third preset threshold is smaller than the fourth preset threshold and the fourth preset threshold is not greater than the maximum value of the lower nk bits of IV2.

[0013] Optionally, when said key update operation is initiated, To generate a new differential parameter C, a calculation operation is initiated for a new value N of the k most significant bits, or to generate a new differential parameter C, a calculation operation is initiated for a new value N of the k most significant bits.

[0014] Optionally, if you want to use the updated new key as the key to use when sending data, The method further includes the step of calculating an initialization vector IV to be used when transmitting data using the new differential parameter C.

[0015] Optionally, said P value is 2, said Q1 value is 0, said Q2 value is −1, and said C value is a random number.

[0016] In a second aspect, the present invention provides an apparatus for secure data transmission, said apparatus comprising: a first calculation unit configured to incrementally update its own initialized serial number SN1 value, perform a first mathematical transformation on the updated SN1 value, and calculate a first initialization vector IV1; a first encryption unit configured to encrypt a first data packet based on the calculated IV1 and the key, and then send the first data packet to node 2; a first decryption unit configured to calculate an SN2 value in a received second data packet, perform a second mathematical transformation on the obtained SN2 value to calculate a second initialization vector IV2, and decrypt the encrypted second data packet using the calculated IV2 and the key; Here, the first mathematical transformation and the second mathematical transformation cause the calculated IV1 and IV2 to be unequal.

[0017] In a third aspect, the present invention provides an apparatus for secure data transmission, said apparatus comprising: a second decryption unit configured to obtain an SN1 value in the received first data packet, perform a first mathematical transformation on the obtained SN1 value, calculate a first initialization vector IV1, and decrypt the encrypted first data packet using the calculated IV1 and the key; a second calculation unit configured to incrementally update its initialized serial number SN2 value, perform a second mathematical transformation on the updated SN2 value, and calculate a second initialization vector IV2; a second encryption unit configured to encrypt a second data packet based on the calculated IV2 and the key and send the second data packet to node 1; Here, the first mathematical transformation and the second mathematical transformation cause the calculated IV1 and IV2 to be unequal.

[0018] In a fourth aspect, the present invention provides a device for secure data transmission, the device comprising a memory and a processor; the memory is configured to store a computer program; The processor is configured to read a program in the memory and perform the steps of the method for secure data transmission on a node 1 side or the steps of the method for secure data transmission on a node 2 side provided in the first aspect.

[0019] In a fifth aspect, the present invention provides a computer program medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method for secure data transmission on the node 1 side or the steps of the method for secure data transmission on the node 2 side provided in the first aspect. [Effects of the Invention]

[0020] The method, apparatus and device for secure data transmission provided by the present invention have the following beneficial effects:

[0021] According to an embodiment of the present invention, all data interactions between communication nodes can be performed secretly using the same key with a different initialization vector IV, ensuring communication security. Based on this, the same key can be used for inbound and outbound communications, i.e., only one SA needs to be established and maintained between communication nodes. In contrast, in the prior art, to ensure communication security, a pair of SAs, one for inbound and one for outbound communications, needs to be established and maintained between communication nodes, i.e., one key is used for inbound communications and another key is used for outbound communications. When one node communicates with multiple nodes, an embodiment of the present invention significantly reduces the number of SAs the node needs to establish and maintain, significantly reducing system resource consumption. [Brief explanation of the drawings]

[0022] [Figure 1] 1 is a schematic diagram of an application scenario for secure data transmission provided by an embodiment of the present invention; [Figure 2] 2 is a flowchart of a method for secure data transmission provided by an embodiment of the present invention. [Figure 3] FIG. 2 is a schematic diagram of a differential parameter C provided by an embodiment of the present invention. [Figure 4] 10 is a flowchart for calculating a node 1 / node 2 first initialization vector IV1 provided by an embodiment of the present invention; [Figure 5] 10 is a flowchart for calculating a second initialization vector IV2 provided by an embodiment of the present invention; [Figure 6] 1 is a schematic diagram of a secure data transmission having an encapsulation format provided by an embodiment of the present invention; [Figure 7] 1 is a schematic diagram of secure data transmission without encapsulation formatting provided by an embodiment of the present invention; [Figure 8]1 is a flowchart for secure data transmission with an encapsulation format provided by an embodiment of the present invention. [Figure 9] 4 is another flowchart for secure data transmission with an encapsulation format provided by an embodiment of the present invention. [Figure 10] 1 is a schematic structural diagram of an apparatus for secure data transmission provided by an embodiment of the present invention; [Figure 11] FIG. 2 is another schematic structural diagram of an apparatus for secure data transmission provided by an embodiment of the present invention; [Figure 12] 1 is a schematic structural diagram of a device for secure data transmission provided by an embodiment of the present invention; DETAILED DESCRIPTION OF THE INVENTION

[0023] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be described in more detail below with reference to the accompanying drawings. The described embodiments are only a part of the embodiments of the present invention, but are not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts fall within the scope of protection of the present invention.

[0024] In the following, the terms "first" and "second" are used only for the purpose of distinguishing between descriptions and are not to be understood as implying or suggesting relative importance or as implicitly designating the number of technical features shown. Consequently, a feature defined as "first" or "second" may explicitly or implicitly include one or more such features, and in the description of embodiments of the present invention, "at least one" means one or more, unless otherwise specified.

[0025] The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present invention. Rather, they are merely examples of devices and methods consistent with the aspects of the present application as detailed in the appended claims. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts fall within the scope of protection of the present application.

[0026] Furthermore, in describing the embodiments of the present invention, unless otherwise specified, " / " means "or", for example, A / B may mean A or B. Furthermore, in describing the embodiments of the present invention, "plurality" means two or more than two, and other quantifiers should be used similarly. The preferred embodiments described herein are intended only to illustrate and explain the present invention, and are not intended to limit the present invention, and it should be understood that embodiments and features of embodiments can be combined with each other without contradiction.

[0027] Considering the problem in the prior art that the scheme using one-way SA consumes system resources, the present invention provides a method, an apparatus and a device for secure data transmission.

[0028] The method, apparatus and device for secure data transmission in embodiments of the present invention will now be described with reference to the accompanying drawings.

[0029] As shown in FIG. 1, an embodiment of the present invention provides a schematic diagram of an application scenario for secure data transmission.

[0030] Node 1 is configured to incrementally update its initialized serial number SN1 value, perform a first mathematical transformation on the updated SN1 value, calculate a first initialization vector IV1, encrypt a first data packet based on the calculated IV1 and a key, and then send it to node 2, calculate an SN2 value in a received second data packet, perform a second mathematical transformation on the obtained SN2 value to calculate a second initialization vector IV2, and decrypt the second data packet encrypted with the calculated IV2 and the key.

[0031] Node 2 is configured to obtain the SN1 value in the received first data packet, perform a first mathematical transformation on the obtained SN1 value to calculate IV1, decrypt the encrypted first data packet using the calculated IV1 and the key, incrementally update its own initialized serial number SN2 value, perform the second mathematical transformation on the updated SN2 value to calculate IV2, and encrypt and send a second data packet to node 1 based on the calculated IV2 and the key.

[0032] wherein the encrypted first data packet includes at least an SN1 value field and an encrypted data field, the encrypted second data packet includes at least an SN2 value field and an encrypted data field, and the first mathematical transformation and the second mathematical transformation cause the calculated IV1 to not be equal to the IV2.

[0033] Note that the two communication partners are represented by node 1 and node 2 as described above, and when providing secure communication between the two nodes, node 1 may be the local Requester, abbreviated as local REQ, or the opposite-end Responder, abbreviated as paired-end REP. If node 1 is the local REQ, node 2 is the paired-end REP. If node 1 is the paired-end REP, node 2 is the local REQ.

[0034] The above-mentioned nodes 1 and 2 may be any type of network device, such as a router, gateway, switch, bridge, wireless access point, base station, firewall, modem, hub, network interface controller (NIC), reverse proxy, server (e.g., proxy server), multiplexer, security device, intrusion detection device, load balancer, etc. Alternatively, the nodes 1 and 2 may be a cellular network, a local area network (LAN), a core network, an access network, a wide area network (WAN) such as the Internet, a cloud network, etc., and the embodiments of the present invention are not limited to these.

[0035] Furthermore, the communication between node 1 and node 2 described above may include secure data transmission with an encapsulated format or may include secure data transmission without an encapsulated format.

[0036] As shown in FIG. 2, an embodiment of the present invention provides a flowchart of a method for secure data transmission, which includes the following steps D:

[0037] In step S201, node 1 incrementally updates its own initialized serial number SN1 value, performs a first mathematical transformation on the updated SN1 value, and calculates a first initialization vector IV1.

[0038] The meaning of node 1 incrementally updating its own initialized serial number SN1 value is that after node 1 initializes the SN1 value, it incrementally updates the initialized SN1 value. The next time it calculates IV1, it incrementally updates the SN1 value used previously.

[0039] The present invention does not limit the SN1 value to a specific value, nor does it limit the specific format of the incrementally updated SN1 value. In an optional embodiment, the SN1 value starts from 1 and is incrementally updated by adding 1 each time.

[0040] The embodiment of the present invention does not limit the initial value of the SN1, and the initial value of the SN1 may be very large in an extreme case, in which case the initial value of the SN1 is the set key update threshold, and the extreme case is also within the protection scope of the embodiment of the present invention.

[0041] S202, node 1 encrypts the first data packet based on the calculated IV1 and key, and then sends it to node 2.

[0042] The calculated IV1 and the key are used as two input parameters of the adopted encryption algorithm, and the first data packet is encrypted using the adopted encryption algorithm and sent to node 2. Here, encrypting the first data packet means encrypting the valid payload in the first data packet. The encrypted first data packet includes at least an SN1 value field and an encrypted data field.

[0043] S203, node 2 obtains the SN1 value in the received first data packet, performs a first mathematical transformation on the obtained SN1 value to calculate the IV1, and decrypts the encrypted first data packet using the calculated IV1 and the key.

[0044] Node 2 receives the encrypted first data packet sent from node 1, obtains the SN1 value in the first data packet, and performs a first mathematical transformation on the obtained SN1 value to calculate IV1. Because a bidirectional SA is used for communication between node 1 and node 2 in the present invention, the two communication parties only need to establish one SA (which includes a key according to an embodiment of the present invention). Therefore, node 2 uses the calculated IV1 and the key as two input parameters of the adopted encryption algorithm to decrypt the encrypted first data packet using the adopted encryption algorithm.

[0045] S204, node 2 incrementally updates the initialized serial number SN2 value of node 2, performs a second mathematical transformation on the updated SN2 value, and calculates a second initialization vector IV2.

[0046] The meaning of node 2 incrementally updating the initialized serial number SN2 value of node 2 is that after node 2 initializes the SN2 value, it incrementally updates the initialized SN2 value. The next time IV2 is calculated, it incrementally updates the SN2 value used previously.

[0047] The embodiment of the present invention does not limit the SN2 value to a specific value to start from, nor does it limit the specific format of incrementally updating the SN2 value. As an optional embodiment, the SN2 value starts from 1 and is incrementally updated by adding 1 each time.

[0048] The embodiment of the present invention does not limit the initial value of the SN2, and the initial value of the SN2 may be very large, and in an extreme case, the initial value of the SN2 is the set key update threshold, and the extreme case is also within the protection scope of the embodiment of the present invention.

[0049] The initial value of SN2 and the initial value of SN1 may be the same or different, and the specific manner in which the SN2 value is incrementally updated is not limited, nor is the specific manner in which the SN1 value is incrementally updated limited.

[0050] Here, the first mathematical transformation and the second mathematical transformation cause the calculated IV1 and IV2 to be unequal.

[0051] S205: Node 2 encrypts a second data packet based on the calculated IV2 and the key and sends it to Node 1.

[0052] The calculated IV2 sum and the key are used as two input parameters of the adopted encryption algorithm, and a second data packet is encrypted using the adopted encryption algorithm and sent to the node 1. Here, encrypting the second data packet means encrypting a valid payload in the second data packet, and the encrypted second data packet includes at least an SN2 value field and an encrypted data field.

[0053] S206, node 1 obtains the SN2 value in the received second data packet, performs the second mathematical transformation on the obtained SN2 value, calculates the IV2, and decrypts the encrypted second data packet using the calculated IV2 and the key.

[0054] Node 1 receives the encrypted second data packet sent from node 2, obtains the SN2 value in the second data packet, performs the second mathematical transformation on the obtained SN2 value to calculate IV2, and uses the calculated IV2 plus the key as two input parameters of the adopted encryption algorithm to decrypt the encrypted second data packet using the adopted encryption algorithm.

[0055] It should be noted that in various embodiments of the present invention, the first mathematical transformation and the second mathematical transformation are pre-shared between node 1 and node 2. Furthermore, a security association SA is composed of a plurality of security association parameters SAP, including key parameters, which are negotiated by node 1 and node 2 when establishing the SA. That is, in various embodiments of the present invention, the key is pre-shared between node 1 and node 2.

[0056] In an embodiment of the present invention, the length of the initialized serial number SN1 of node 1 itself is equal to the length of the initialized serial number SN2 of node 2 itself. The length of the first initialization vector IV1 calculated by node 1 is equal to the length of the second initialization vector IV2 calculated by node 2.

[0057] As computers become more powerful, their computing power also increases rapidly. Therefore, 64-bit counters, such as those used in IPsec's Electronic Serial Number (ESN), quickly overflow on ultra-high-speed devices, causing the system to constantly cycle counters, impacting system performance. In some environments, such as the Internet of Things (IoT), counter requirements are not high and a 16-bit counter can meet the demand. However, IPsec requires at least a 32-bit SN to be transmitted with each transmitted message. This design wastes bandwidth in environments with very few packets being transmitted. Therefore, adjustable counters are needed to adapt to different application scenarios.

[0058] Therefore, an embodiment of the present invention provides a scheme for setting the lengths of SN1 and SN2 according to a specific implementation scenario, where the lengths of both SN1 and SN2 can be determined to be m bits between node 1 and node 2 according to an application scenario. When the demand for counters is high, the length of sequence numbers is set to be large to solve the problem of counters overflowing too quickly in a very high-speed environment. When the demand for counters is low, the length of sequence numbers is set to be small to reduce bandwidth traffic and improve bandwidth utilization, so as to be able to work in a low-traffic environment.

[0059] For example, in a low traffic environment, by setting the lengths of both the SN1 and SN2 to 8 bits, it is possible to reduce the bandwidth traffic by 24 bits compared to using SN1 and SN2 that are 32 bits long.

[0060] When communicating securely, two communication partners can obtain each other's SN values.

[0061] The lengths of both the IV1 and the IV2 are determined to be n bits between the node 1 and the node 2 based on the encryption algorithm adopted. The lengths of the IV1 and the IV2 are determined based on the encryption algorithm adopted when two communication partners securely communicate data. For example, if the encryption algorithm adopted by the node 1 and the node 2 is SM4-GCM-128, the length of the IV is 128 bits. If the encryption algorithm adopted by the node 1 and the node 2 is AES-GCM-256, the length of the IV is 256 bits, and if the encryption algorithm adopted by the node 1 and the node 2 is AES-CBC-128, the length of the IV is 128 bits.

[0062] The selection of the encryption algorithm can be performed according to a specific implementation scenario, and the embodiment of the present invention is not limited to this.

[0063] In an optional embodiment, the encryption algorithm is a symmetric encryption algorithm.

[0064] The length m of SN1 and SN2 and the length n of IV1 and IV2 may be determined by either node 1 or node 2, or may be determined jointly by node 1 and node 2.

[0065] As shown in Figure 3, an embodiment of the present invention provides a schematic diagram of the derivative parameter C. Optionally, the derivative parameter C may be used as a parameter for calculating the IV value.

[0066] Here, the length of C is equal to the length n of IV1, C includes k high-order bits and nk low-order bits, the low-order bits have a value of zero, and the high-order bits have a value of N, which is not zero, and k is a positive integer between 1 and n.

[0067] As an optional embodiment, the value N taken by the high order bits of C above is determined in the following way: determining a value N of the high-order bit of said C based on configuration information; or determining a value N of the high-order bit of said C based on configuration information; or determining a value N of the most significant bit of C based on a cryptographic key; or The value N of the high-order bit of C is determined by key negotiation.

[0068] The value N may be (1) a fixed value determined according to configuration information, such as 0x5C365C36, which is a value that attempts to balance 0s and 1s on the bits and sufficiently disrupt the distribution of 0s and 1s; (2) a random number determined using a random method; (3) a value that is a part of an encryption key determined according to the encryption key; or (4) a value that is a part of an encryption key determined by key negotiation.

[0069] If the value N is (2), (3), or (4) above, the value N cannot be entirely 0xFFFFFFFF or close to 0xFFFFFFFF, i.e., the bit values ​​of the value N cannot be entirely 1 or close to entirely 1, otherwise the key update frequency will be too fast.

[0070] The length k of the value N is variable, but the length k of the value N is smaller than the length of C.

[0071] As shown in Figure 4, one embodiment of the present invention provides a flowchart for node 1 / node 2 to calculate a first initialization vector IV1, where the first mathematical transformation used in calculating IV1 includes a coefficient P, a first parameter Q1, and a derivative parameter C, and node 1 / node 2 calculating IV1 comprises the following steps: S401, between node 1 and node 2, determine that the length of both SN1 and SN2 is m, and based on the encryption algorithm adopted, determine that the length of both IV1 and IV2 is n.

[0072] The specific process for determining the length m and the length n has been described above, and will not be repeated here.

[0073] S402: Determine the overflow order of SN1 and IV1.

[0074] As an optional embodiment, determining the overflow order of SN1 and IV1 specifically includes: Calculate the difference between the length n of the IV1 and the length k of the most significant bits; If the SN1 length m is not greater than the difference, determining that the SN1 value overflowed first; If the length m of the SN1 is greater than the difference, it is determined that the IV1 value overflowed first.

[0075] The length of the SN1 is m bits, the length of the IV1 is n bits, the length of the N is k bits, and the m, n, and k are integer multiples of 8.

[0076] S403: if it is determined that SN1 will overflow first, the SN1 value for calculating IV1 is taken as the first dynamic parameter, and the first dynamic parameter is multiplied by the coefficient P, and then IV1 is calculated by summing the product of the first dynamic parameter and the coefficient P, the differential parameter C, and the Q1.

[0077] When m<=nk, for example, when m=32 bits, n=128 bits, and k=32 bits, the first initialization vector IV1 is calculated as follows: IV1=C+SN1×P+Q1 where P is not equal to 1 and is not equal to 0, and Q1 is either 0 or is not an integer multiple of P.

[0078] S404: If it is determined that IV1 will overflow first, SN1 for calculating IV1 is divided by M, and the remainder is obtained to obtain a third dynamic parameter, and the third dynamic parameter is multiplied by the coefficient P, and then IV1 is calculated by summing the product of the third dynamic parameter and the coefficient P, the differential parameter C, and the Q1.

[0079] When m>nk, for example, when m=128 bits, n=64 bits, and k=32 bits, the first initialization vector IV1 is calculated as follows: IV1=C+SN1%2 n-k ×P+Q1 where P is not equal to 1 and is not equal to 0, and Q1 is either 0 or is not an integer multiple of P.

[0080] The above M is the maximum value 2 that can be expressed by the low-order nk bits of IV1 when IV1 first overflows. n-k and the third dynamic parameter is SN1%2 n-k and the above SN1 value and 2 n-k Represents the remainder operation of .

[0081] Above SN1%2 n-k The third dynamic parameter above has a value between 0 and 2.n-k Indicates periodicity up to -1.

[0082] If the above IV1 value overflows first, then the above SN1=1 and SN1=2 n-k In either case, the third dynamic parameter value is 1, but SN1=2. n-k It should be noted that before +1, IV1 has already overflowed, so the key needs to be updated. When updating a different key, the value of C can also be updated to a different value to make the calculated IV1 value different, ensuring sufficient randomness and generating a different IV value in each round, resulting in a more secure design.

[0083] Also, the above SN1=1 and SN1=2 n-k In the +1 case, the calculated IV1 value is the same, but the key used is different.

[0084] As an optional embodiment, before the node 1 / node 2 calculates the first initialization vector IV1, the node 1 / node 2 further When the SN1 value first overflows and it is determined that the SN1 value for calculating the first dynamic parameter, i.e., IV1, has reached a first preset threshold, a key update operation is initiated. When the SN1 value first overflows and it is determined that the SN1 value for calculating the first dynamic parameter, i.e., IV1, has reached a second preset threshold, a new updated key is used as the key for data transmission, where the first preset threshold is smaller than the second preset threshold, and the second preset threshold is not larger than the maximum value of the SN1.

[0085] The IV1 value overflows first, and the third dynamic parameter, i.e., SN1%2 n-k When it determines that the IV1 value has reached a third preset threshold, it initiates a key update operation. n-kreaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, where the third preset threshold is smaller than the fourth preset threshold, and the fourth preset threshold is not larger than the maximum value of the lower nk bits of the IV1.

[0086] It should be noted that the first, second, third and fourth preset thresholds may be set to specific values ​​according to a specific implementation, provided that they satisfy the size range requirements. For example, the first preset threshold may be set to 2 m 90% of the second preset threshold. m Set the third preset threshold to -1. n-k 90% of the threshold, and the fourth preset threshold is set to 2 n-k Set to -1, where 2 m indicates the maximum value that can be expressed in SN1, and 2 n-k indicates the maximum value that can be represented by the low-order nk bits of IV1 when IV1 first overflows.

[0087] For security reasons, the C value may be replaced at the same time as the new key is replaced.

[0088] In an optional embodiment, initiating the key update operation comprises: The method further includes initiating a calculation operation of a new value N of the k most significant bits to generate a new differential parameter C, or initiating a calculation operation of a new value N of the k most significant bits to generate a new differential parameter C.

[0089] At the same time as starting the key update operation, a new differential parameter C is generated. A specific method for generating the new differential parameter C is to (1) calculate a new value k' of the number k of high-order bits and calculate a new value N of the k' high-order bits, or (2) keep the number k of high-order bits unchanged and calculate a new value N of the k high-order bits.

[0090] As an optional embodiment, when the updated new key is used as the key to be used when transmitting data, The new differential parameter C is used to calculate IV1 to be used when transmitting data.

[0091] (1) When it is determined that the SN1 value overflows for the first time and the SN1 value for calculating IV1 has reached a second preset threshold, a new key is used as the key for data transmission, and the new differential parameter C is used to calculate the initialization vector IV1 for data transmission.

[0092] (2) While using the new key as the key used when transmitting data, the IV1 value overflows first, and SN1%2 n-k If it is determined that the fourth preset threshold has been reached, the new differential parameter C is used to calculate an initialization vector IV1 to be used when transmitting data.

[0093] In the embodiment of FIG. 3 above, the high-order bit of the differential parameter C has a value of N that is not zero. As another optional embodiment, the value N of the high-order bit of the differential parameter C can be zero, in which case the value of C is zero. That is, in the embodiment of FIG. 4, the calculation for calculating the first initialization vector IV1 is as follows: when m<=nk, IV1=SN1×P+Q1 where P is not equal to 1 and is not equal to 0, and Q1 is either 0 or is not an integer multiple of P.

[0094] When m>nk, IV1=SN1%2 n-k ×P+Q1 Here, P is not equal to 1 or 0, and Q1 is 0 or is not an integer multiple of P. Compared with the case where the value N of the high-order bit of the differential parameter C is 0, when the value N of the high-order bit of the differential parameter C is other than 0, the calculated value of IV1 has a higher degree of randomness, which significantly improves the security of data encryption.

[0095] As shown in Figure 5, an embodiment of the present invention provides a flowchart for node 2 / node 1 to calculate a second initialization vector IV2. Here, a second mathematical transform used in calculating IV2 includes a coefficient P, a second parameter Q2, and a derivative parameter C. The second parameter Q2 in the second mathematical transform has a different value from the first parameter Q1 in the first mathematical transform. Node 2 / node 1 calculates IV2 through the following steps:

[0096] S501, between node 1 and node 2, determine that the length of both SN1 and SN2 is m, and based on the encryption algorithm adopted, determine that the length of both IV1 and IV2 is n.

[0097] The specific process for determining the length m and the length n is as described above, and will not be repeated here.

[0098] S502: Determine the overflow order of SN2 and IV2.

[0099] As an optional embodiment, determining the overflow order of SN2 and IV2 may include: Calculate the difference between the length n of the IV2 and the length k of the most significant bits; If the length m of the SN2 is not greater than the difference, it is determined that the SN2 value has overflowed first; If the length m of the SN2 is greater than the difference, it is determined that the IV2 value overflows first.

[0100] The SN2 has a length of m bits, the IV2 has a length of n bits, and the N has a length of k bits, where m, n, and k are integer multiples of 8.

[0101] S503: if it is determined that SN2 overflows first, the SN2 value for calculating IV2 is taken as the second dynamic parameter, and the second dynamic parameter is multiplied by the coefficient P, and then IV2 is calculated by summing the product of the second dynamic parameter and the coefficient P, the differential parameter C, and the Q2.

[0102] In the case where m<=nk, for example, when m=32 bits, n=128 bits, and k=32 bits, the second initialization vector IV2 is calculated as follows:

[0103] IV2=C+SN2×P+Q2, where P is not equal to 1 or 0, Q2 is 0 or is not an integer multiple of P, and Q1 and Q2 are different.

[0104] S504: If it is determined that IV2 has overflowed first, SN2 for calculating IV2 is divided by M, and the remainder is obtained to obtain a fourth dynamic parameter. The fourth dynamic parameter is multiplied by the coefficient P, and then the product of the fourth dynamic parameter and the coefficient P, the differential parameter C, and the Q2 are summed to calculate IV2.

[0105] When m>nk, for example, when m=128 bits, n=64 bits, and k=32 bits, the second initialization vector IV2 is calculated as follows:

[0106] IV2=C+SN2%2 n-k ×P+Q2 Here, P is not equal to 1, nor is it equal to 0, Q2 is 0 or is not an integer multiple of P, and Q1 and Q2 are different.

[0107] The above M is the maximum value 2 that can be expressed by the low-order nk bits of IV2 when IV2 first overflows. n-k The fourth dynamic parameter is SN2%2 n-k and the above SN2 value and 2 n-k This shows the remainder operation of .

[0108] Above SN2%2n-k The fourth dynamic parameter above has a value between 0 and 2. n-k Indicates periodicity up to -1.

[0109] Note that when the above IV2 value overflows first, the above SN2=1 and SN2=2 n-k In the two cases of +1, the value of the fourth dynamic parameter is 1, but SN2=2 n-k Before it reaches +1, IV2 overflows and the key must be updated. When updating a different key, a different C value is updated, resulting in a different calculated IV2 value. By ensuring sufficient randomness, a different IV value can be generated in each round, resulting in a more secure design.

[0110] Furthermore, the above SN2=1 and SN2=2 n-k Although the IV2 value calculated in the above two cases of +1 is the same, the encryption keys used are different.

[0111] As an optional embodiment, before the node 2 / node 1 calculates the second initialization vector IV2, the method further includes: When the SN2 value first overflows and it is determined that the SN2 value for calculating the second dynamic parameter, i.e., IV2, has reached a first preset threshold, a key update operation is initiated. When the SN2 value first overflows and it is determined that the SN2 value for calculating the second dynamic parameter, i.e., IV2, has reached a second preset threshold, the updated new key is used as the key to be used when transmitting data. Here, the first preset threshold is smaller than the second preset threshold, and the second preset threshold is not larger than the maximum value of the SN2.

[0112] The IV2 value overflows first, and the fourth dynamic parameter, i.e., SN2 n-k The key update operation is initiated when the IV2 value first overflows and the fourth dynamic parameter, i.e., SN2, reaches a third preset threshold. n-kreaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, where the third preset threshold is smaller than the fourth preset threshold, and the fourth preset threshold is not larger than the maximum value of the lower nk bits of the IV2.

[0113] It should be noted that the first, second, third, and fourth preset thresholds may be set to specific values ​​according to a specific implementation, provided that they satisfy the size range requirements. For example, the first preset threshold is generally set to 2 m 90% of the second preset threshold. m Set the third preset threshold to -1. n-k 90% of the threshold, and the fourth preset threshold is set to 2 n-k Set to -1, where 2 m indicates the maximum value that can be expressed in SN2, and 2 n-k indicates the maximum value that can be represented by the low-order nk bits of IV2 when IV2 first overflows.

[0114] For security reasons, the C value may be replaced at the same time as the new key is replaced. It is also possible to generate a new differential parameter C in the same way as provided in the embodiment of Figure 4, but this will not be repeated here.

[0115] As an optional embodiment, using the updated new key as the key to be used when transmitting data further includes: The new differential parameter C is used to calculate IV2 to be used when transmitting data.

[0116] (1) When the SN2 value overflows for the first time and it is determined that the SN2 value for calculating IV2 has reached a second preset threshold, a new key is used as the key for data transmission, and at the same time, the new differential parameter C is used to calculate the initialization vector IV2 to be used for data transmission.

[0117] (2) The above IV2 value overflows first, and SN2%2 n-k has reached a fourth preset threshold, the new key is set as the key to be used when transmitting data, and the new differential parameter C is used to calculate the initialization vector IV2 to be used when transmitting data.

[0118] Furthermore, as an optional embodiment, in the embodiment of FIG. 4 and the embodiment of FIG. 5 described above, node 1 and node 2 may prepare a new C value and a new key in advance, and when a key update or a C value update is required, node 1 and node 2 may both select one of the new keys prepared in advance as the key to be used when transmitting data, and select a new C value to be used for calculating an initialization vector IV to be used when transmitting data, from the new C values ​​prepared in advance.

[0119] It should be noted that the high-order bit of the differential parameter C provided by the above embodiment of FIG. 3 takes a value of N that is not zero, and as another optional embodiment, the value N of the high-order bit of the differential parameter C can be taken as zero, in which case the value of C is zero, that is, in the embodiment of FIG. 5, the calculation for calculating the second initialization vector IV2 is as follows: when m<=nk, IV2=SN2×P+Q2 where P is not equal to 1 and is not equal to 0, Q2 is 0 or is not an integer multiple of P, and Q2 is different from Q1.

[0120] When m>nk, IV2=SN2%2 n-k ×P+Q2 Here, P is not equal to 1 or 0, Q2 is 0 or is not an integer multiple of P, and Q2 is different from Q1. Compared with the case where the value N of the high-order bit of the differential parameter C is 0, when the value N of the high-order bit of the differential parameter C is other than 0, it is guaranteed that the calculated IV2 value has a higher degree of randomness, and the security of data encryption is significantly improved.

[0121] The nodes 1 and 2 may communicate with each other by secure data transmission having an encapsulation format, or may communicate with each other by secure data transmission without an encapsulation format.

[0122] As shown in Figure 6, an embodiment of the present invention provides a schematic diagram of secure data transmission with an encapsulation format, where the communication traffic from node 1 to node 2 is DATA 1to2 Assuming that the communication traffic from node 2 to node 1 is DATA 2to1 Assume that the key shared by node 1 and node 2 is Key.

[0123] The data traffic exchange between node 1 and node 2 is carried out in the following steps: In S1, the two communicating parties set the lengths of the sequence numbers SN1 and SN2 and initialize the SN1 and SN2 values.

[0124] S2, node 1 calculates the IV1 value based on the length and SN1 value of SN1, and node 2 calculates the IV2 value based on the length and SN2 value of SN2.

[0125] For example, the length of SN1 and SN2 is m bits, the length of IV1 and IV2 is n bits, and the length of the high-order bit of the differential parameter C is k bits, where m, n, and k are integer multiples of 8. If m = 32 bits, n = 128 bits, and k = 32 bits, then m <= nk, and the SN values ​​of node 1 and node 2 will overflow first. Node 1's IV1 = C + SN1 × P + Q1, where P is not equal to 1 or 0, and Q1 is 0 or is not an integer multiple of P. Node 2's IV2 = C + SN2 × P + Q2, where P is not equal to 1 or 0, and Q2 is 0 or is not an integer multiple of P, and Q2 is not equal to Q1.

[0126] Each time node 1 sends a data packet to node 2, it incrementally updates the SN1 value, e.g., by adding 1. When the SN1 value reaches a first preset threshold, it initiates a key update operation. When the SN1 value reaches a second preset threshold, it uses the updated new key as the key to be used when transmitting data.

[0127] Each time node 2 sends a data packet to node 1, it incrementally updates the SN2 value, e.g., by adding 1 to the SN2 value. When the SN2 value reaches a first preset threshold, it initiates a key update operation. When the SN2 value reaches a second preset threshold, it uses the updated new key as the key to be used when transmitting data.

[0128] As another example, if m=128 bits, n=64 bits, and k=32 bits, then m>nk, and the IV values ​​of node 1 and node 2 overflow first. Node 1's IV1=C+SN1%2 n-k ×P+Q1, where P is not equal to 1 and not equal to 0, and Q1 is either 0 or not an integer multiple of P. IV2 of node 2 = C+SN2%2 n-k ×P+Q2, where P is not equal to 1 and is not equal to 0, Q2 is 0 or is not an integer multiple of P, and Q2 is not equal to Q1.

[0129] Every time node 1 sends a data packet to node 2, it incrementally updates the SN1 value, and the IV1 value overflows before the SN1 value, so SN1%2 n-k When SN1 reaches a third preset threshold, it initiates a key update operation. n-k When the fourth preset threshold is reached, the updated new key is used as the key to be used when transmitting data.

[0130] Node 2 incrementally updates the SN2 value every time node 1 sends a data packet, and the IV2 value overflows before the SN2 value, so SN2%2 n-k When SN2 reaches a third preset threshold, it initiates a key update operation. n-kWhen the fourth preset threshold is reached, the updated new key is used as the key to be used when transmitting data.

[0131] It is preferable that P is 2, Q1 is 0, and Q2 is −1 as described above. The smaller the values ​​of IV1 and IV2, the less likely overflow will occur and the less frequently the key will be updated, resulting in improved performance.

[0132] Of course, the above P, Q1, and Q2 can be set according to the specific implementation, for example, P=3, Q1=2, and Q2=1.

[0133] S3, in combination with the encryption algorithm, encrypts and decrypts the two peer traffic based on the IV1 value / IV2 value calculated above.

[0134] Note that node 1 and node 2 communicate by secure data transmission with an encapsulation format, and node 1 sends DATA 1to2 Before sending the DATA, node 1 uses the Key and the calculated IV1 value in combination with the encryption algorithm. 1to2 , and encapsulates the encrypted traffic according to the encapsulation protocol, and sends it to node 2 after completion. After receiving the encrypted traffic sent from node 1, node 2 obtains the SN1 value in the encapsulation message, combines it with the encryption algorithm according to its own calculated IV1 value and the key, and decrypts the encrypted traffic to obtain DATA 1to2 Get.

[0135] Similarly, node 2 sends DATA 2to1 Before sending the DATA, node 2 uses the Key and the calculated IV2 value in combination with an encryption algorithm to 2to1, and encapsulates the encrypted traffic according to the encapsulation protocol, and sends it to node 1 after completion. After receiving the encrypted traffic sent from node 2, node 1 obtains the SN2 value in the encapsulation message, combines it with the encryption algorithm according to its own calculated IV2 value and the key, and decrypts the encrypted traffic to obtain DATA 2to1 Get.

[0136] As shown in Figure 7, an embodiment of the present invention provides a schematic diagram of secure data transmission without encapsulation format, where communication traffic from node 1 to node 2 is DATA 1to2 Assuming that the communication traffic from node 2 to node 1 is DATA 2to1 Assume that the key shared by node 1 and node 2 is Key.

[0137] The data traffic exchange between node 1 and node 2 involves the following steps: In S1, the two communicating parties set the lengths of the sequence numbers SN1 and SN2 and initialize the SN1 and SN2 values.

[0138] In S2, node 1 calculates the IV1 value based on the length and value of SN1, and node 2 calculates the IV2 value based on the length and value of SN2.

[0139] The calculation process here is the same as that in the embodiment of FIG. 6, so a repeated explanation will be omitted.

[0140] S3, in combination with the encryption algorithm, encrypts and decrypts the two peer traffic based on the IV1 value / IV2 value calculated above.

[0141] Note that node 1 and node 2 communicate by secure data transmission without encapsulation format, and node 1 sends DATA 1to2 Before sending DATA, node 1 uses the key and the calculated IV1 value in combination with the encryption algorithm to1to2 , and sends the encrypted traffic directly to node 2 without the need to encapsulate the encrypted traffic according to the encapsulation protocol. After receiving the encrypted traffic sent from node 1, node 2 obtains the SN1 value from the encrypted traffic, and decrypts the encrypted traffic in combination with the encryption algorithm according to its own calculated IV1 value and the key, and then sends the DATA 1to2 Get.

[0142] Similarly, node 2 sends DATA 2to1 Before sending the data, node 2 uses the key and the calculated IV2 value in combination with the encryption algorithm to 2to1 , and sends the encrypted traffic directly to node 1 without the need to encapsulate the encrypted traffic according to the encapsulation protocol. After receiving the encrypted traffic sent from node 2, node 1 obtains the SN2 value from the encrypted traffic, and decrypts the encrypted traffic in combination with the encryption algorithm according to its own calculated IV2 value and the key, and sends the DATA 2to1 Get.

[0143] Hereinafter, an embodiment of the present invention will be described using the example of secure data transmission having an encapsulation format, but secure data transmission without an encapsulation format is basically the same as secure data transmission with an encapsulation format, except that encapsulation is not required, and will not be repeated hereafter.

[0144] As shown in FIG. 8, an embodiment of the present invention provides a flowchart for secure data transmission with an encapsulation format. Here, an example will be described in which SN2 overflows before IV2 and SN2 overflows before IV2. Note that in this embodiment, before node 1 and node 2 perform secure data transmission, node 1 and node 2 initialize SN1 and SN2 values, both of which have lengths m between node 1 and node 2. According to the encryption algorithm adopted, it is determined that the length of both IV1 and IV2 is n. As an optional embodiment, the encryption algorithm adopted is a symmetric encryption algorithm.

[0145] The process for secure data transmission with the encapsulation format provided in the FIG. 8 embodiment includes the following steps: S801, node 1 incrementally updates its own serial number SN1 value, and sets the updated SN1 value as the first dynamic parameter.

[0146] In step S802, node 1 determines whether the first dynamic parameter reaches a first preset threshold, and if so, initiates a key update operation; if not, does not initiate a key update operation; and determines whether the first dynamic parameter reaches a second preset threshold, and if so, uses the updated new key as the key used in step S804; if not, continues to use the current key as the key used in step S804.

[0147] For example, the first preset threshold is 0.9 x 2 m and the SN1 value is 2 m If so, a key update operation is initiated. Optionally, when the key update operation is initiated, an update operation of the differential parameter C may also be initiated. For example, the second preset threshold is 2 m -1 and SN1 is 2 mDetermine whether or not SN1 reaches −1, where the first preset threshold is less than the second preset threshold, and the second preset threshold is less than or equal to the maximum value of SN1. Optionally, if the updated new key is used as the key used in S804, the new differential parameter C can also be used to calculate IV1 in S803.

[0148] S803, the node 1 multiplies the first dynamic parameter by a coefficient P, and calculates IV1 by summing the product of the first dynamic parameter and the coefficient P, the differential parameters C and Q1.

[0149] For example, if the increment value is 1, node 1 adds 1 to the current value of SN1, sets P=2 and Q1=0, and calculates IV1 by IV1=C+SN1×2.

[0150] S804: Node 1 encrypts the first data packet based on the calculated IV1 and key Key, encapsulates the encrypted first packet according to the encapsulation protocol, and then sends it to Node 2.

[0151] Node 1 takes IV1 and Key as two input parameters of the encryption algorithm and uses the above symmetric encryption algorithm to encrypt DATA 1to2 Encrypt the data, i.e., (DATA 1to2 ) ciphertext =FUN encrypt (IV1,Key,DATA 1to2 ) and according to the encapsulation protocol (DATA 1to2 ) ciphertext and sends it to node 2 after completion.

[0152] It should be noted that after node 1 sends the first encrypted data packet to node 2, it can perform the relevant steps starting from S801 again to calculate a new IV1 and use the calculated IV1 and key to encrypt subsequent data packets sent to node 2. If the SN1 value of node 1 overflows after node 1 sends multiple encrypted data packets to node 2, node 1 initializes the SN1 value and performs the relevant steps starting from S801 again.

[0153] S805: Node 2 obtains the SN1 value in the received encapsulated first data packet, sets the SN1 value as a first dynamic parameter, multiplies the first dynamic parameter by the coefficient P, and then calculates IV1 by summing the product of the first dynamic parameter and coefficient P, a differential parameter C, and the Q1, and decrypts the encrypted first data packet using the calculated IV1 and the key Key.

[0154] When node 2 receives communication traffic from node 1, it obtains the SN1 value in the encapsulated message and calculates IV1 by IV1=C+SN1×2. Using the IV1 and the Key as two input parameters of the encryption algorithm, it uses the above symmetric encryption algorithm to encrypt (DATA 1to2 ) ciphertext Decrypt (DATA 1to2 ) plaintext =FUN decipher (IV1,Key,(DATA 1to2 ) ciphertext ).

[0155] S806, node 2 incrementally updates its own serial number SN2 value, and sets the updated SN2 value as the second dynamic parameter.

[0156] In step S807, node 2 determines whether the second dynamic parameter has reached a first preset threshold, and if so, initiates a key update operation; if not, does not initiate a key update operation. Also, node 2 determines whether the second dynamic parameter has reached a second preset threshold, and if so, uses the updated new key as the key to be used in step S809; if not, uses the current key as the key to be used in step S809.

[0157] For example, the first preset threshold is 0.9 x 2 m and the SN2 value is 2 m If so, a key update operation is initiated. Optionally, when the key update operation is initiated, an update operation of the differential parameter C may also be initiated. For example, the second preset threshold is 2 m -1 and SN2 value is 2 m Determine whether or not the SN2 reaches −1, where the first preset threshold is less than the second preset threshold and the second preset threshold is not greater than the maximum value of SN2. Optionally, the updated new key can be used as the key to be used in S809, and the new differential parameter C can be used to calculate IV2 in S808.

[0158] S808, node 2 multiplies the second dynamic parameter by coefficient P, and calculates IV2 by summing the product of the second dynamic parameter and coefficient P, and derivative parameters C and Q2.

[0159] For example, if the increment value is 1, node 2 adds 1 to the value of SN2, sets P=2, Q2=-1, and calculates IV2 as IV2=C+SN2×2-1.

[0160] S809: Node 2 encrypts the second data packet based on the calculated IV2 and key Key, encapsulates the encrypted second data packet according to the encapsulation protocol, and then sends it to Node 1.

[0161] Node 2 uses IV2 and Key as two input parameters of the encryption algorithm and encrypts DATA using the above symmetric encryption algorithm.2to1 Encrypt the data, i.e., (DATA 2to1 ) ciphertext =FUN encrypt (IV2,Key,DATA 2to1 ) and according to the encapsulation protocol (DATA 2to1 ) ciphertext and sends it to node 1 after completion.

[0162] It should be noted that after node 2 sends the second encrypted data packet to node 1, it can perform the relevant steps again starting from S806 to calculate a new IV2 and use the calculated IV2 and key to encrypt subsequent data packets sent to node 1. If node 2's SN2 value overflows after node 2 sends multiple encrypted packets to node 1, node 2 will initialize its SN2 value and then perform the relevant steps again starting from S806.

[0163] S810: Node 1 obtains the SN2 value in the received encapsulated second data packet, sets the SN2 value as a second dynamic parameter, multiplies the second dynamic parameter by the coefficient P, and then calculates IV2 by summing the product of the second dynamic parameter and the coefficient P, the differential parameter C, and Q2. Node 1 also decrypts the IV2 and the Key-encrypted second data packet.

[0164] When node 1 receives communication traffic from node 2, it obtains the SN2 value in the encapsulated message and calculates the IV2 value as follows: IV2 = C + SN2 × 2 - 1. IV2 and Key are the two input parameters of the encryption algorithm, and the above symmetric encryption algorithm is used to encrypt (DATA 2to1 ) ciphertext Decrypt (DATA 2to1 ) plaintext =FUN decipher (IV2,Key,(DATA 2to1 ) ciphertext ).

[0165] [Table 1] Table 1 above shows a comparison of the SN value changes between the method of the present embodiment and the conventional method. The length of SN1 and SN2 shown in Table 1 is 4 bits, i.e., the maximum value of SN1 and SN2 is 16. Here, the initial values ​​of SN1 and SN2 in the method of the present embodiment start from 1. Assume P=2, Q1=0, and Q2=-1. Substituting the values ​​of P, Q1, and Q2 into the methods of node 1 and node 2, it can be seen that they are simply processed in each subsequent round. Furthermore, according to the IV calculation provided by the embodiment of the present invention, IV1 calculated by node 1 based on the value of SN1 is different from IV2 calculated by node 2 based on the value of SN2.

[0166] In existing technical solutions, to ensure that two nodes use different IV values, one of the SN1 and SN2 values ​​must be odd (e.g., the initial value of SN1 is 1) and the other must be even (e.g., the initial value of SN2 is 2), and 2 must be added to the SN1 and SN2 values ​​in each subsequent round of processing to ensure that the IV1 calculated by node 1 and the IV2 calculated by node 2 are different.

[0167] The present invention adopts a unique IV calculation method, which allows the SN values ​​of node 1 and node 2 to be the same, and the processing in each round only requires adding 1 to each SN value. Therefore, the space used for SN1 and SN2 in the present invention is twice that used for SN1 and SN2 in the prior art, which slows down overflow and reduces the corresponding key update frequency by one, effectively improving system performance.

[0168] As shown in Figure 9, an embodiment of the present invention provides another flowchart for secure data transmission with an encapsulation format. Here, it is exemplified that IV1 overflows before SN1 and IV2 overflows before SN2. In this embodiment, before node 1 and node 2 perform secure data transmission, the lengths of both SN1 and SN2 between node 1 and node 2 are determined to be m, the SN1 value and the SN2 value are initialized, and the length of both IV1 and IV2 is determined to be n according to the encryption algorithm adopted. As an optional embodiment, the encryption algorithm adopted is a symmetric encryption algorithm.

[0169] The flowchart for secure data transmission with the encapsulation format described in the embodiment of FIG. 9 includes the following steps:

[0170] S901, node 1 incrementally updates the value of its own serial number SN1, divides the updated SN1 by M, and obtains the remainder to obtain the third dynamic parameter.

[0171] In step S902, node 1 determines whether the third dynamic parameter reaches a third preset threshold, and if so, initiates a key update operation; if not, does not initiate a key update operation. Also, node 1 determines whether the third dynamic parameter reaches a fourth preset threshold, and if so, uses the updated new key as the key used in step S904; if not, continues to use the current key as the key used in step S904.

[0172] For example, the third preset threshold is 0.9 x 2 n-k and SN1%2 n-k 2 n-k If so, a key update operation is initiated. Optionally, when the key update operation is initiated, an update operation of the differential parameter C may also be initiated. For example, the fourth preset threshold is 2 n-k -1 and SN1%2 n-k 2 n-kDetermine whether the third preset threshold is less than the fourth preset threshold, and the fourth preset threshold is not greater than the maximum value of the lower nk bits of the IV1. Optionally, if an updated new key is used as the key used in S904, calculate IV1 in S903 using a new differential parameter C.

[0173] S903, the node 1 multiplies the third dynamic parameter by the coefficient P, and calculates IV1 by summing the product of the third dynamic parameter and the coefficient P, the differential parameters C and Q1.

[0174] The above M is the maximum value of the low-order nk bits of IV1 when IV1 first overflows, 2 n-k For example, if the increment value is 1, node 1 adds 1 to the current value of SN1, sets P=2, Q1=0, and IV1=C+SN1%2 n-k Calculate IV1 using ×2.

[0175] S904: Node 1 encrypts the first data packet based on the calculated IV1 and key Key, encapsulates the encrypted first packet according to the encapsulation protocol, and then sends it to Node 2.

[0176] Node 1 takes IV1 and Key as two input parameters of the encryption algorithm and uses the above symmetric encryption algorithm to encrypt DATA 1to2 Encrypt the data, i.e., (DATA 1to2 ) ciphertext =FUN encrypt (IV1,Key,DATA 1to2 ) and according to the encapsulation protocol (DATA 1to2 ) ciphertext and sends it to node 2 after completion.

[0177] It should be noted that after node 1 sends the first encrypted data packet to node 2, it can perform the related steps starting from S901 again to calculate a new IV1 and use the calculated IV1 and key to encrypt subsequent data packets sent to node 2. If the SN1 value of node 1 overflows after node 1 sends multiple encrypted packets to node 2, node 1 initializes the SN1 value and performs the related steps starting from S901 again.

[0178] S905: Node 2 obtains the SN1 value in the received encapsulated first data packet, divides SN1 by M, obtains the remainder to obtain a third dynamic parameter, multiplies the third dynamic parameter by the coefficient P, and then calculates IV1 by summing the product of the third dynamic parameter and coefficient P, differential parameter C, and Q1. Node 2 decrypts the encrypted first data packet using IV1 and the key Key.

[0179] When node 2 receives communication traffic from node 1, it obtains the SN1 value in the encapsulated message and calculates IV1=C+SN1%2. n-k IV1 is calculated using IV1 and Key x 2. The IV1 and Key are used as two input parameters of the encryption algorithm, and the above symmetric encryption algorithm is used to calculate (DATA 1to2 ) ciphertext Decrypt (DATA 1to2 ) plaintext =FUN decipher (IV1,Key,(DATA 1to2 ) ciphertext ).

[0180] S906, node 2 incrementally updates the value of its own serial number SN2, divides the updated SN2 by M, and obtains the remainder to obtain the fourth dynamic parameter.

[0181] In step S907, node 2 determines whether the fourth dynamic parameter reaches a third preset threshold, and if so, initiates a key update operation; if not, does not initiate a key update operation. Also, node 2 determines whether the fourth dynamic parameter reaches a fourth preset threshold, and if so, uses the updated new key as the key to be used in step S909; if not, uses the current key as the key to be used in step S909.

[0182] For example, the third preset threshold is 0.9 x 2 n-k and SN2%2 n-k 2 n-k If so, a key update operation is initiated. Optionally, when the key update operation is initiated, an update operation of the differential parameter C may also be initiated. For example, the fourth preset threshold is 2 n-k -1 and SN2%2 n-k is 2 n-k -1, where the third preset threshold is smaller than the fourth preset threshold, and the fourth preset threshold is not larger than the maximum value of the lower nk bits of the IV2. Optionally, when an updated new key is used as the key used in S909, a new differential parameter C may also be used to calculate IV2 in S908.

[0183] S908, node 2 multiplies the fourth dynamic parameter by coefficient P, and calculates IV2 by summing the product of the fourth dynamic parameter coefficient P, the derivative parameter C and Q2.

[0184] The above M is the maximum value of the low-order nk bits of IV2 when IV2 first overflows, 2 n-k For example, if the increment value is 1, node 2 adds 1 to the value of SN2, so P=2, Q2=-1, and IV2=C+SN2%2. n-k Calculate IV2 using x2-1.

[0185] S909: Node 2 encrypts the second data packet based on the calculated IV2 and key Key, encapsulates the encrypted second data packet according to the encapsulation protocol, and then sends it to Node 1.

[0186] Node 2 uses IV2 and Key as two input parameters of the encryption algorithm and encrypts DATA using the above symmetric encryption algorithm. 2to1 Encrypt the data, i.e., (DATA 2to1 ) ciphertext =FUN encrypt (IV2,Key,DATA 2to1 ) and according to the encapsulation protocol (DATA 2to1 ) ciphertext and sends it to node 1 after completion.

[0187] It should be noted that after node 2 sends the second encrypted data packet to node 1, it can again perform the associated steps starting from S906 to calculate a new IV2 and use the calculated IV2 and key to encrypt subsequent data packets sent to node 1. If node 2's SN2 value overflows after node 2 sends multiple encrypted packets to node 1, node 2 will again perform the associated steps starting from S906 after initializing the SN2 value.

[0188] S910: Node 1 obtains the SN2 value in the received encapsulated second data packet, divides SN2 by M, and obtains the remainder to obtain a fourth dynamic parameter, multiplies the fourth dynamic parameter by the coefficient P, and then calculates IV2 by summing the product of the fourth dynamic parameter and coefficient P, differential parameter C, and Q2, and uses the IV2 and the key Key to decrypt the encrypted second data packet.

[0189] When node 1 receives communication traffic from node 2, it obtains the SN2 value in the encapsulated message and calculates IV2=C+SN2%2. n-kCalculate the IV2 value using x2-1, and use IV2 and Key as the two input parameters of the encryption algorithm. 2to1 ) ciphertext Decrypt (DATA 2to1 ) plaintext =FUN decipher (IV2,Key,(DATA 2to1 ) ciphertext ).

[0190] As shown in FIG. 10, an embodiment of the present invention provides a schematic diagram of an apparatus for secure data transmission, the apparatus comprising: a first calculation unit 1001 configured to incrementally update its own initialized serial number SN1 value, perform a first mathematical transformation on the updated SN1 value, and calculate a first initialization vector IV1; a first encryption unit 1002 configured to encrypt a first data packet based on the calculated IV1 and the key, and then send the first data packet to node 2; and a first decryption unit 1003 configured to calculate an SN2 value in the received second data packet, perform a second mathematical transformation on the obtained SN2 value to calculate a second initialization vector IV2, and decrypt the encrypted second data packet using the calculated IV2 and the key.

[0191] Here, the first mathematical transformation and the second mathematical transformation cause the calculated IV1 and IV2 to be unequal.

[0192] Optionally, before calculating the first initialization vector IV1, the first calculation unit 1001 further calculates: Determine the overflow order of SN1 and IV1.

[0193] performing a first mathematical transformation on the updated SN1 value and calculating said IV1 when it is determined that SN1 will overflow first; The method includes using the SN1 value for calculating IV1 as a first dynamic parameter, multiplying the first dynamic parameter by a coefficient P, and then calculating IV1 by summing the product of the first dynamic parameter and the coefficient P, a differential parameter C, and a first parameter Q1.

[0194] performing a first mathematical transformation on the updated SN1 value to calculate said IV1 if it is determined that IV1 will overflow first; The method includes dividing SN1 by M to calculate IV1, obtaining the remainder to obtain a third dynamic parameter, multiplying the third dynamic parameter by the coefficient P, and then calculating IV1 by summing the product of the third dynamic parameter and the coefficient P, the differential parameter C, and Q1.

[0195] where P is not equal to 1 or 0, Q1 is 0 or is not an integer multiple of P, the length of C is equal to the length n of IV1, C includes k high-order bits and nk low-order bits, and the value of the low-order bits is zero, and M is the maximum value 2 of the low-order nk bits of IV1 when IV1 first overflows. n-k is.

[0196] Optionally, determining an overflow order of the first calculation unit 1001SN1 and IV1 comprises: Calculate the difference between the length n of IV1 and the length k of the most significant bits; If the length m of SN1 is not greater than the difference, it is determined that SN1 overflowed first; determining that IV1 overflowed first if the length m of SN1 is greater than the difference.

[0197] Optionally, before the first decoding unit 1003 calculates the second initialization vector IV2, further: Determine the overflow order of SN2 and IV2.

[0198] performing a second mathematical transformation on the obtained SN2 value to calculate said IV2 if it is determined that the SN2 has first overflowed; The method includes using the SN2 value for calculating IV2 as a second dynamic parameter, multiplying the second dynamic parameter by the coefficient P, and then calculating IV2 by summing the product of the second dynamic parameter and the coefficient P, the differential parameter C, and a second parameter Q2.

[0199] performing a second mathematical transformation on the obtained SN2 value to calculate said IV2 if it is determined that IV2 has first overflowed; The method includes dividing SN2 by M to calculate IV2, obtaining the remainder to obtain a fourth dynamic parameter, multiplying the fourth dynamic parameter by the coefficient P, and then calculating IV2 by summing the product of the fourth dynamic parameter and the coefficient P, the differential parameter C, and Q2.

[0200] Here, Q2 is 0 or is not an integer multiple of P, and Q1 is different from Q2. The length of C is equal to the length n of IV2, and M is the maximum value 2 of the lower nk bits of IV2 when IV2 first overflows. n-k is.

[0201] Optionally, the first decoding unit 1003 determining the overflow order of SN2 and IV2 includes: Calculate the difference between the length n of IV2 and the length k of the most significant bit; If the length m of SN2 is not greater than the difference, it is determined that SN2 overflowed first; determining that IV2 overflowed first if the length m of SN2 is greater than the difference.

[0202] Optionally, before the first calculation unit 1001 calculates the first initialization vector IV1, further: When it is determined that SN1 has first overflowed and the first dynamic parameter has reached a first preset threshold, a key update operation is initiated, and when the first dynamic parameter has reached a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is less than the second preset threshold, and the second preset threshold is less than or equal to a maximum value of SN1; When IV1 first overflows and it is determined that the third dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the third dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, where the third preset threshold is smaller than the fourth preset threshold and the fourth preset threshold is not greater than the maximum value of the lower nk bits of IV1.

[0203] Optionally, before the first decoding unit 1003 calculates the second initialization vector IV2, further: When SN2 overflows first and it is determined that the second dynamic parameter has reached a first preset threshold, a key update operation is initiated, and when the second dynamic parameter reaches a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is smaller than the second preset threshold, and the second preset threshold is not larger than the maximum value of SN2; When IV2 overflows first and it is determined that the fourth dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the fourth dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, where the third preset threshold is smaller than the fourth preset threshold and the fourth preset threshold is not greater than the maximum value of the lower nk bits of IV2.

[0204] Optionally, when the first calculation unit 1001 / first decryption unit 1003 starts the key update operation, it also starts a calculation operation of a new value N of the number k of high-order bits to generate a new differential parameter C, or starts a calculation operation of a new value N of the k high-order bits to generate a new differential parameter C.

[0205] Optionally, when the first calculation unit 1001 / first decryption unit 1003 uses the updated new key as the key to be used when transmitting data, it further uses the new differential parameter C to calculate the initialization vector IV to be used when transmitting data.

[0206] Optionally, said P value is 2, said Q1 value is 0, said Q2 value is −1, and said C value is a random number.

[0207] As shown in Figure 11, an embodiment of the present invention provides another schematic diagram of an apparatus for secure data transmission, the apparatus comprising: a second decryption unit 1101 configured to obtain an SN1 value in a received first data packet, perform a first mathematical transformation on the obtained SN1 value, calculate a first initialization vector IV1, and decrypt the encrypted first data packet using the calculated IV1 and the key; a second calculation unit 1102 configured to incrementally update its initialized serial number SN2 value, perform a second mathematical transformation on the updated SN2 value, and calculate a second initialization vector IV2; and a second encryption unit 1103 configured to encrypt a second data packet based on the calculated IV2 and the key and send it to node 1.

[0208] Here, the first mathematical transformation and the second mathematical transformation cause the calculated IV1 and IV2 to be unequal.

[0209] Optionally, before the second decoding unit 1101 calculates the first initialization vector IV1, further: Determine the overflow order of SN1 and IV1.

[0210] performing a first mathematical transformation on the obtained SN1 value to calculate the IV1 when it is determined that the SN1 will overflow first; The method includes using the SN1 value for calculating IV1 as a first dynamic parameter, multiplying the first dynamic parameter by a coefficient P, and then calculating IV1 by summing the product of the first dynamic parameter and the coefficient P, a differential parameter C, and a first parameter Q1.

[0211] performing a first mathematical transformation on the obtained SN1 value to calculate said IV1 when it is determined that IV1 will overflow first; The method includes dividing SN1 by M to calculate IV1, obtaining the remainder to obtain a third dynamic parameter, multiplying the third dynamic parameter by the coefficient P, and then calculating IV1 by summing the product of the third dynamic parameter and the coefficient P, the differential parameter C, and Q1.

[0212] where P is not equal to 1 or 0, Q1 is 0 or is not an integer multiple of P, the length of C is equal to the length n of IV1, C includes k high-order bits and nk low-order bits, and the value of the low-order bits is zero, and M is the maximum value 2 of the low-order nk bits of IV1 when IV1 first overflows. n-k is.

[0213] Optionally, the second decoding unit 1101 determining the overflow order of SN1 and IV1 includes: Calculate the difference between the length n of IV1 and the length k of the most significant bits; If the length m of SN1 is not greater than the difference, it is determined that SN1 overflowed first; determining that IV1 overflowed first if the length m of SN1 is greater than the difference.

[0214] Optionally, before the second calculation unit 1102 calculates the second initialization vector IV2, further: Determine the overflow order of SN2 and IV2.

[0215] performing a second mathematical transformation on the updated SN2 value and calculating said IV2 if it is determined that SN2 has overflowed first; The method includes using the SN2 value for calculating IV2 as a second dynamic parameter, multiplying the second dynamic parameter by the coefficient P, and then calculating IV2 by summing the product of the second dynamic parameter and the coefficient P, the differential parameter C, and a second parameter Q2.

[0216] performing a second mathematical transformation on the updated SN2 value to calculate said IV2 if it is determined that IV2 has overflowed first; The method includes dividing SN2 by M to calculate IV2, obtaining the remainder to obtain a fourth dynamic parameter, multiplying the fourth dynamic parameter by the coefficient P, and then calculating IV2 by summing the product of the fourth dynamic parameter and the coefficient P, the differential parameter C, and Q2.

[0217] Here, Q2 is 0 or is not an integer multiple of P, and Q1 is different from Q2. The length of C is equal to the length n of IV2, and M is the maximum value 2 of the lower nk bits of IV2 when IV2 first overflows. n-k is.

[0218] Optionally, the second calculation unit 1102 determining the overflow order of SN2 and IV2 includes: Calculate the difference between the length n of IV2 and the length k of the most significant bit; If the length m of SN2 is not greater than the difference, it is determined that SN2 overflowed first; determining that IV2 overflowed first if the length m of SN2 is greater than the difference.

[0219] Optionally, before the second decoding unit 1101 calculates the first initialization vector IV1, further: When it is determined that SN1 has first overflowed and the first dynamic parameter has reached a first preset threshold, a key update operation is initiated, and when the first dynamic parameter has reached a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is less than the second preset threshold, and the second preset threshold is less than or equal to a maximum value of SN1; When IV1 first overflows and it is determined that the third dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the third dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, where the third preset threshold is smaller than the fourth preset threshold and the fourth preset threshold is not greater than the maximum value of the lower nk bits of IV1.

[0220] Optionally, before the second calculation unit 1102 calculates the second initialization vector IV2, further: When SN2 overflows first and it is determined that the second dynamic parameter has reached a first preset threshold, a key update operation is initiated, and when the second dynamic parameter reaches a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is smaller than the second preset threshold, and the second preset threshold is not larger than the maximum value of SN2; When IV2 overflows first and it is determined that the fourth dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the fourth dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, where the third preset threshold is smaller than the fourth preset threshold and the fourth preset threshold is not greater than the maximum value of the lower nk bits of IV2.

[0221] Optionally, when the second decryption unit 1101 / second calculation unit 1102 starts the key update operation, it also starts the calculation operation of a new value N of the number k of high-order bits to generate a new differential parameter C, or starts the calculation operation of a new value N of the k high-order bits to generate a new differential parameter C.

[0222] Optionally, when the second decryption unit 1101 / second calculation unit 1102 uses the updated new key as the key to be used when transmitting data, it further uses the new differential parameter C to calculate the initialization vector IV to be used when transmitting data.

[0223] Optionally, said P value is 2, said Q1 value is 0, said Q2 value is −1, and said C value is a random number.

[0224] As shown in FIG. 12, an embodiment of the present invention provides a schematic diagram of a device 1200 for secure data transmission, including a memory 1201 and a processor 1202 .

[0225] The memory 1201 is configured to store a computer program, and the processor 1202 is configured to read the program in the memory 1201 and execute the steps of the method for secure data transmission on the node 1 side or the steps of the method for secure data transmission on the node 2 side of the above embodiment.

[0226] When the processor reads the program in the memory and performs the steps of the method for secure data transmission on node 1 side in the above embodiment, the processor specifically: incrementally updates its own initialized serial number SN1 value, performs a first mathematical transformation on the updated SN1 value, calculates a first initialization vector IV1, encrypts a first data packet based on the calculated IV1 and a key, and then sends it to node 2; calculates an SN2 value in the received second data packet, performs a second mathematical transformation on the obtained SN2 value to calculate a second initialization vector IV2, and decrypts the encrypted second data packet using the calculated IV2 and the key.

[0227] Here, the first mathematical transformation and the second mathematical transformation cause the calculated IV1 and IV2 to be unequal.

[0228] Optionally, before said processor calculates the first initialization vector IV1, further: Determine the overflow order of SN1 and IV1.

[0229] performing a first mathematical transformation on the updated SN1 value and calculating said IV1 when it is determined that SN1 will overflow first; The method includes using the SN1 value for calculating IV1 as a first dynamic parameter, multiplying the first dynamic parameter by a coefficient P, and then calculating IV1 by summing the product of the first dynamic parameter and the coefficient P, a differential parameter C, and a first parameter Q1.

[0230] performing a first mathematical transformation on the updated SN1 value to calculate said IV1 if it is determined that IV1 will overflow first; The method includes dividing SN1 by M to calculate IV1, obtaining the remainder to obtain a third dynamic parameter, multiplying the third dynamic parameter by the coefficient P, and then calculating IV1 by summing the product of the third dynamic parameter and the coefficient P, the differential parameter C, and Q1.

[0231] where P is not equal to 1 or 0, Q1 is 0 or is not an integer multiple of P, the length of C is equal to the length n of IV1, C includes k high-order bits and nk low-order bits, and the value of the low-order bits is zero, and M is the maximum value 2 of the low-order nk bits of IV1 when IV1 first overflows. n-k is.

[0232] Optionally, said processor determining an overflow order of SN1 and IV1 comprises: Calculate the difference between the length n of IV1 and the length k of the most significant bits; If the length m of SN1 is not greater than the difference, it is determined that SN1 overflowed first; determining that IV1 overflowed first if the length m of SN1 is greater than the difference.

[0233] Optionally, before said processor calculates the second initialization vector IV2, further: This includes determining the overflow order of SN2 and IV2.

[0234] performing a second mathematical transformation on the obtained SN2 value to calculate said IV2 if it is determined that the SN2 has first overflowed; The method includes using the SN2 value for calculating IV2 as a second dynamic parameter, multiplying the second dynamic parameter by the coefficient P, and then calculating IV2 by summing the product of the second dynamic parameter and the coefficient P, the differential parameter C, and a second parameter Q2.

[0235] performing a second mathematical transformation on the obtained SN2 value to calculate said IV2 if it is determined that IV2 has first overflowed; The method includes dividing SN2 by M to calculate IV2, obtaining the remainder to obtain a fourth dynamic parameter, multiplying the fourth dynamic parameter by the coefficient P, and then calculating IV2 by summing the product of the fourth dynamic parameter and the coefficient P, the differential parameter C, and Q2.

[0236] Here, Q2 is 0 or is not an integer multiple of P, Q2 is different from Q1, the length of C is equal to the length n of IV2, and M is the maximum value 2 of the lower nk bits of IV2 when IV2 first overflows. n-k is.

[0237] Optionally, said processor determining an overflow order of SN2 and IV2 comprises: Calculate the difference between the length n of IV2 and the length k of the most significant bit; If the length m of SN2 is not greater than the difference, it is determined that SN2 overflowed first; determining that IV2 overflowed first if the length m of SN2 is greater than the difference.

[0238] The processor, before calculating the first initialization vector IV1, further When it is determined that SN1 has first overflowed and the first dynamic parameter has reached a first preset threshold, a key update operation is initiated, and when the first dynamic parameter has reached a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is less than the second preset threshold, and the second preset threshold is less than or equal to a maximum value of SN1; When IV1 first overflows and it is determined that the third dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the third dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, where the third preset threshold is smaller than the fourth preset threshold and the fourth preset threshold is not greater than the maximum value of the lower nk bits of IV1.

[0239] Optionally, before said processor calculates the second initialization vector IV2, further: When SN2 overflows first and it is determined that the second dynamic parameter has reached a first preset threshold, a key update operation is initiated, and when the second dynamic parameter reaches a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is smaller than the second preset threshold, and the second preset threshold is not larger than the maximum value of SN2; When IV2 overflows first and it is determined that the fourth dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the fourth dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, where the third preset threshold is smaller than the fourth preset threshold and the fourth preset threshold is not greater than the maximum value of the lower nk bits of IV2.

[0240] Optionally, before initiating the key update operation, said processor further: To generate a new differential parameter C, a calculation operation is initiated for a new value N of the k most significant bits, or to generate a new differential parameter C, a calculation operation is initiated for a new value N of the k most significant bits.

[0241] Optionally, when the processor uses the updated new key as a key to be used when transmitting data, the processor further The new differential parameter C is used to calculate an initialization vector IV to be used when transmitting data.

[0242] Optionally, said P value is 2, said Q1 value is 0, said Q2 value is −1, and said C value is a random number.

[0243] When the processor reads the program in the memory and performs the steps of the method for secure data transmission on the node 2 side in the above embodiment, the processor specifically obtains the SN1 value in the received first data packet, performs a first mathematical transformation on the obtained SN1 value, calculates a first initialization vector IV1, decrypts the encrypted first data packet using the calculated IV1 and a key, incrementally updates its own initialized serial number SN2 value, performs a second mathematical transformation on the updated SN2 value, calculates a second initialization vector IV2, and encrypts and sends the second data packet to node 1 based on the calculated IV2 and the key.

[0244] Here, the first mathematical transformation and the second mathematical transformation cause the calculated IV1 and IV2 to be unequal.

[0245] Optionally, before calculating the first initialization vector IV1, the processor further: Determine the overflow order of SN1 and IV1.

[0246] performing a first mathematical transformation on the obtained SN1 value to calculate the IV1 when it is determined that the SN1 will overflow first; The method includes using the SN1 value for calculating IV1 as a first dynamic parameter, multiplying the first dynamic parameter by a coefficient P, and then calculating IV1 by summing the product of the first dynamic parameter and the coefficient P, a differential parameter C, and a first parameter Q1.

[0247] performing a first mathematical transformation on the obtained SN1 value to calculate said IV1 when it is determined that IV1 will overflow first; The method includes dividing SN1 by M to calculate IV1, obtaining the remainder to obtain a third dynamic parameter, multiplying the third dynamic parameter by the coefficient P, and then calculating IV1 by summing the product of the third dynamic parameter and the coefficient P, the differential parameter C, and Q1.

[0248] where P is not equal to 1 or 0, Q1 is 0 or is not an integer multiple of P, the length of C is equal to the length n of IV1, C includes k high-order bits and nk low-order bits, and the value of the low-order bits is zero, and M is the maximum value 2 of the low-order nk bits of IV1 when IV1 first overflows. n-k is.

[0249] Optionally, said processor determining an overflow order of SN1 and IV1 comprises: Calculate the difference between the length n of IV1 and the length k of the most significant bits; If the length m of SN1 is not greater than the difference, it is determined that SN1 overflowed first; determining that IV1 overflowed first if the length m of SN1 is greater than the difference.

[0250] Optionally, before said processor calculates the second initialization vector IV2, further: Determine the overflow order of SN2 and IV2.

[0251] performing a second mathematical transformation on the updated SN2 value and calculating said IV2 if it is determined that SN2 has overflowed first; The method includes using the SN2 value for calculating IV2 as a second dynamic parameter, multiplying the second dynamic parameter by the coefficient P, and then calculating IV2 by summing the product of the second dynamic parameter and the coefficient P, the differential parameter C, and a second parameter Q2.

[0252] performing a second mathematical transformation on the updated SN2 value to calculate said IV2 if it is determined that IV2 has overflowed first; The method includes dividing SN2 by M to calculate IV2, obtaining the remainder to obtain a fourth dynamic parameter, multiplying the fourth dynamic parameter by the coefficient P, and then calculating IV2 by summing the product of the fourth dynamic parameter and the coefficient P, the differential parameter C, and Q2.

[0253] Here, Q2 is 0 or is not an integer multiple of P, Q2 is different from Q1, the length of C is equal to the length n of IV2, and M is the maximum value 2 of the lower nk bits of IV2 when IV2 first overflows. n-k is.

[0254] Optionally, said processor determining an overflow order of SN2 and IV2 comprises: Calculate the difference between the length n of IV2 and the length k of the most significant bit; If the length m of SN2 is not greater than the difference, it is determined that SN2 overflowed first; determining that IV2 overflowed first if the length m of SN2 is greater than the difference.

[0255] Optionally, before said processor calculates the first initialization vector IV1, further: When it is determined that SN1 has first overflowed and the first dynamic parameter has reached a first preset threshold, a key update operation is initiated, and when the first dynamic parameter has reached a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is less than the second preset threshold, and the second preset threshold is less than or equal to a maximum value of SN1; When IV1 first overflows and it is determined that the third dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the third dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, where the third preset threshold is smaller than the fourth preset threshold and the fourth preset threshold is not greater than the maximum value of the lower nk bits of IV1.

[0256] Optionally, before said processor calculates the second initialization vector IV2, further: When SN2 overflows first and it is determined that the second dynamic parameter has reached a first preset threshold, a key update operation is initiated, and when the second dynamic parameter reaches a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is smaller than the second preset threshold, and the second preset threshold is not larger than the maximum value of SN2; When IV2 overflows first and it is determined that the fourth dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the fourth dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, where the third preset threshold is smaller than the fourth preset threshold and the fourth preset threshold is not greater than the maximum value of the lower nk bits of IV2.

[0257] Optionally, when said processor initiates a key update operation: To generate a new differential parameter C, a calculation operation is initiated for a new value N of the k most significant bits, or to generate a new differential parameter C, a calculation operation is initiated for a new value N of the k most significant bits.

[0258] Optionally, before the processor uses the updated new key as a key to be used when transmitting data, further The new differential parameter C is used to calculate an initialization vector IV to be used when transmitting data.

[0259] Optionally, said P value is 2, said Q1 value is 0, said Q2 value is −1, and said C value is a random number.

[0260] The present invention further provides a computer program medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for secure data transmission on the node 1 side or the steps of the method for secure data transmission on the node 2 side in the above embodiments.

[0261] It should be understood that the disclosed systems, devices, and methods in some embodiments provided in the present application can be implemented in other ways. For example, the above-described device embodiments are merely examples, and the division of the units is merely a logical division of functions. In actual implementation, other division methods are possible. For example, the division of these units is merely a logical division of functions. In actual implementation, multiple modules or components may be combined or integrated into another system, or some functions may be ignored or not performed. In other respects, the illustrated or described couplings or direct couplings or communication connections between each other may be indirect couplings or communication connections via some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.

[0262] Modules described as separate components may or may not be physically separated, and components shown as modules may or may not be physical modules, i.e., they may be located in one location or distributed across multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the objectives of the solution of this example.

[0263] Furthermore, each functional module in each embodiment of the present invention can be integrated into one processing module, each module can exist physically alone, or two or more modules can be integrated into one module. The above-mentioned integrated module can be implemented in the form of a hardware or software functional module. When the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.

[0264] The above embodiments may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented using software, they may be implemented in whole or in part in the form of a computer program product.

[0265] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored on a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optics, digital subscriber line (DSL)), or wireless (e.g., infrared, radio, microwave) means. The computer-readable storage medium may be any available medium on which a computer can store data, or a data storage device such as a server or data center integrated with one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0266] The present invention has been described above with reference to flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flow diagrams and / or block diagrams, and the combination of flows and / or blocks in the flow diagrams and / or block diagrams, can be implemented by computer program instructions. A processor can provide these computer program instructions to a processor in a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device, and the processor in the computer or other programmable data processing device executes these computer program instructions to implement the functions specified in one or more flows in the flow diagrams and / or one or more blocks in the block diagrams. These computer program instructions can also be stored in a computer-readable storage device that causes a computer or other programmable data processing apparatus to operate in a specific fashion, such that the apparatus containing the instructions can execute the instructions in the computer-readable storage device to implement the function(s) specified in one or more of the flow diagrams and / or one or more blocks in the block diagrams.

[0267] These computer program instructions may also be implemented in a computer or other programmable data processing device, such that the computer or other programmable device on which the computer program instructions are implemented performs a series of operational steps to implement the relevant process, and the instructions executed on the computer or other programmable device implement the functions specified in one or more of the flows in the flow diagrams and / or one or more blocks in the block diagrams. The technical solutions provided by the present invention have been introduced in detail above. In the present invention, specific examples are used to explain the principles and implementation methods of the present application. The above description of the embodiments is only used to understand the method and its core concept. At the same time, those skilled in the art will encounter changes in the specific implementation and application scope based on the concept of the present application, which will be understood as limitations of the present invention.

Claims

1. 1. A method for secure data transmission, comprising: Node 1 initializes its own serial number SN 1 Incrementally update the value and update the SN 1 performing a first mathematical transformation on the value to generate a first initialization vector IV 1 and calculating The node 1 calculates the IV 1 and encrypting the first data packet based on the key and then sending it to node 2; The node 2 receives the SN in the first data packet. 1 Obtain the value and obtain the SN 1 performing a first mathematical transformation on the value of said IV 1 Calculate the calculated IV 1 and decrypting the encrypted first data packet using said key; The node 2 receives the initialized serial number SN of the node 2 itself. 2 Incrementally update the value and update the SN 2 Perform a second mathematical transformation on the value to generate a second initialization vector IV 2 and calculating The node 2 calculates the IV 2 and encrypting a second data packet based on the key and sending the data packet to the node 1; The node 1 receives the SN in the second data packet. 2 Obtain the value and obtain the SN 2 performing the second mathematical transformation on the IV value; 2 Calculate the calculated IV 2 and decrypting the encrypted second data packet using the key; The IV calculated by the first mathematical transformation and the second mathematical transformation 1 and IV 2 are no longer equal, Before calculating the first initialization vector IV 1 , the node 1 / the node 2 performs the following: determining an overflow order of SN 1 and IV 1 ; If it is determined that SN 1 will overflow first, the step of performing a first mathematical transformation on the updated / obtained SN 1 value to calculate said IV 1 comprises: the step of multiplying the SN 1 value for calculating IV 1 as a first dynamic parameter by a coefficient P, and then calculating IV 1 by summing the product of the first dynamic parameter and the coefficient P, a differential parameter C, and a first parameter Q 1 ; If it is determined that IV 1 will overflow first, the step of performing a first mathematical transformation on the updated / obtained SN 1 value to calculate said IV 1 comprises: the step of dividing SN1 by M to calculate IV1, obtaining the remainder to obtain a third dynamic parameter, multiplying the third dynamic parameter by the coefficient P, and then calculating IV1 by summing the product of the third dynamic parameter and the coefficient P, the differential parameter C, and the Q1; A method for secure data transmission, characterized in that P is not equal to 1 or 0, Q 1 is 0 or is not an integer multiple of P, the length of C is equal to the length n of IV 1, C includes k high-order bits and n-k low-order bits, the value of the low-order bits is zero, and M is the maximum value 2 n-k of the low-order n-k bits of IV 1 when IV 1 first overflows.

2. The node 2 / the node 1 is a second initialization vector IV 2 Before calculating SN 2 and IV 2 determining an overflow order of SN 2 If it is determined that SN 2 performing a second mathematical transformation on the value of said IV 2 The step of calculating IV 2 SN for calculating 2 The value is a second dynamic parameter, and the second dynamic parameter is multiplied by the coefficient P, and then the product of the second dynamic parameter and the coefficient P, the differential parameter C, and the second parameter Q 2 Adding up the IV 2 Calculating IV 2 If it is determined that SN 2 performing a second mathematical transformation on the value of said IV 2 The step of calculating IV 2 SN for calculating 2 by M, and obtain the remainder to obtain a fourth dynamic parameter. The fourth dynamic parameter is multiplied by the coefficient P, and then the product of the fourth dynamic parameter and the coefficient P, the differential parameters C and Q are obtained. 2 Adding up the IV 2 Calculating Q 2 is 0 or is not an integer multiple of P, and 2 is the above Q 1 Unlike, the length of C is IV 2 The length n of the 2 IV when first overflows 2 The maximum value of the lowest nk bits of n-k 2. The method for secure data transmission according to claim 1, characterized in that:

3. The node 1 / the node 2 receives the first initialization vector IV 1 Before calculating SN 1 determines that the first dynamic parameter has overflowed first and that the first dynamic parameter has reached a first preset threshold, initiates a key update operation, and when the first dynamic parameter has reached a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is smaller than the second preset threshold, and the second preset threshold is smaller than SN 1 is less than or equal to the maximum value of IV 1 first overflows and determines that the third dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the third dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, and the third preset threshold is smaller than the fourth preset threshold, and the fourth preset threshold is equal to or greater than IV. 1 is not greater than the maximum value of the lowest n−k bits of The node 2 / the node 1 uses the second initialization vector IV 2 Before calculating SN 2 first overflows and determines that the second dynamic parameter has reached a first preset threshold, a key update operation is initiated, and when the second dynamic parameter reaches a second preset threshold, the updated new key is used as the key to be used when transmitting data, and the first preset threshold is smaller than the second preset threshold, and the second preset threshold is equal to or greater than SN 2 is not greater than the maximum value of IV 2 first overflows and determines that the fourth dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the fourth dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, and the third preset threshold is smaller than the fourth preset threshold, and the fourth preset threshold is equal to or greater than IV. 2 3. The method for secure data transmission according to claim 2, wherein the maximum value of the least significant nk bits of the .times. ...

4. When the key update operation is initiated, 4. A method for secure data transmission according to claim 3, characterized in that a calculation operation is initiated of a new value N of the number k of most significant bits to generate a new differential parameter C, or a calculation operation is initiated of a new value N of the most significant bits of the k bits to generate a new differential parameter C.

5. If you want to use the updated new key as the key to use when sending data, 5. A method for secure data transmission according to claim 4, characterized in that the new differential parameter C is used to calculate an initialization vector IV to be used when transmitting data.

6. The P value is 2, and the Q 1 The value is 0, 2 3. The method for secure data transmission according to claim 2, characterized in that the value C is −1, said C value being a random number.

7. 1. An apparatus for secure data transmission, comprising: Its own initialized serial number SN 1 Incrementally update the value and update the SN 1 performing a first mathematical transformation on the value to generate a first initialization vector IV 1 a first calculation unit configured to calculate Calculated IV 1 a first encryption unit configured to encrypt a first data packet based on the key and then send it to node 2; SN in the received second data packet 2 Calculate the value and obtain the SN 2 A second mathematical transformation is performed on the value to generate a second initialization vector IV 2 Calculate the calculated IV 2 and a first decryption unit configured to decrypt a second data packet encrypted using the key; The IV calculated by the first mathematical transformation and the second mathematical transformation 1 and IV 2 are no longer equal, Before the first calculation unit calculates a first initialization vector IV 1 , Determine the overflow order of SN 1 and IV 1 ; If it is determined that SN 1 will overflow first, performing a first mathematical transformation on the updated SN 1 value to calculate said IV 1 may include: the SN 1 value for calculating IV 1 is a first dynamic parameter, the first dynamic parameter is multiplied by a coefficient P, and then IV 1 is calculated by summing the product of the first dynamic parameter and the coefficient P, a differential parameter C, and a first parameter Q 1 ; If it is determined that IV 1 will overflow first, performing a first mathematical transformation on the updated SN 1 value to calculate said IV 1 may include: dividing SN1 by M to calculate IV1, obtaining a remainder to obtain a third dynamic parameter, multiplying the third dynamic parameter by the coefficient P, and then calculating IV1 by summing the product of the third dynamic parameter and the coefficient P, the differential parameter C, and the Q1; An apparatus for secure data transmission, characterized in that P is not equal to 1 or 0, Q 1 is 0 or is not an integer multiple of P, the length of C is equal to the length n of IV 1, C includes k high-order bits and n-k low-order bits, the value of the low-order bits is zero, and M is the maximum value 2 n-k of the low-order n-k bits of IV 1 when IV 1 first overflows.

8. The first decoding unit receives a second initialization vector IV. 2 Before calculating SN 2 and IV 2 Determine the overflow order of SN 2 If it is determined that the first overflow has occurred, the obtained SN 2 performing a second mathematical transformation on the value of said IV 2 To calculate IV 2 SN for calculating 2 The value is a second dynamic parameter, and the second dynamic parameter is multiplied by the coefficient P, and then the product of the second dynamic parameter and the coefficient P, the differential parameter C, and the second parameter Q 2 Adding up the IV 2 Calculating IV 2 If it is determined that the first overflow has occurred, the obtained SN 2 performing a second mathematical transformation on the value of said IV 2 To calculate IV 2 SN for calculating 2 by M, and obtain the remainder to obtain a fourth dynamic parameter. The fourth dynamic parameter is multiplied by the coefficient P, and then the product of the fourth dynamic parameter and the coefficient P, the differential parameters C and Q are obtained. 2 Adding up the IV 2 Calculating Q 2 is 0 or is not an integer multiple of P, and 2 is the above Q 1 Unlike, the length of C is IV 2 The length n of the 2 IV when first overflows 2 The maximum value of the lowest n−k bits of n-k 8. A device for secure data transmission according to claim 7, characterized in that:

9. The first calculation unit calculates a first initialization vector IV. 1 Before calculating SN 1 determines that the first dynamic parameter has overflowed first and that the first dynamic parameter has reached a first preset threshold, initiates a key update operation, and when the first dynamic parameter has reached a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is smaller than the second preset threshold, and the second preset threshold is smaller than SN 1 is less than or equal to the maximum value of IV 1 first overflows and determines that the third dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the third dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the third preset threshold is smaller than the fourth preset threshold, and the fourth preset threshold is equal to or smaller than IV. 1 8. The device for secure data transmission according to claim 7, wherein the maximum value of the least significant nk bits of the .times. ...

10. The first decoding unit receives a second initialization vector IV. 2 Before calculating SN 2 first overflows and determines that the second dynamic parameter has reached a first preset threshold, a key update operation is initiated, and when the second dynamic parameter reaches a second preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the first preset threshold is smaller than the second preset threshold, and the second preset threshold is equal to or smaller than SN 2 is not greater than the maximum value of IV 2 first overflows and determines that the fourth dynamic parameter has reached a third preset threshold, a key update operation is initiated, and when the fourth dynamic parameter reaches a fourth preset threshold, the updated new key is used as the key to be used when transmitting data, wherein the third preset threshold is smaller than the fourth preset threshold, and the fourth preset threshold is equal to or smaller than IV. 2 9. The device for secure data transmission according to claim 8, wherein the maximum value of the least significant nk bits of the .times. ...

11. When the first calculation unit / first decryption unit starts a key update operation, 9. The device for secure data transmission according to claim 8, characterized in that it starts a calculation operation of a new value N of the number k of most significant bits to generate a new differential parameter C, or starts a calculation operation of a new value N of the most significant bits of the k bits to generate a new differential parameter C.

12. When the first calculation unit / first decryption unit uses the updated new key as the key to be used when transmitting data, 12. The device for secure data transmission according to claim 11, wherein the new differential parameter C is used to calculate an initialization vector IV to be used when transmitting data.

13. The P value is 2, and the Q 1 The value is 0, 2 9. The device for secure data transmission according to claim 8, wherein the value is −1, and the C value is a random number.

14. 1. An apparatus for secure data transmission, comprising: SN in the first data packet received 1 Obtain the value and obtain the SN 1 performing a first mathematical transformation on the value to generate a first initialization vector IV 1 Calculate the calculated IV 1 a second decryption unit configured to decrypt the encrypted first data packet using the key; Its own initialized serial number SN 2 Incrementally update the value and update the SN 2 Perform a second mathematical transformation on the value to generate a second initialization vector IV 2 a second computing unit configured to compute Calculated IV 2 and a second encryption unit configured to encrypt a second data packet based on the key and send it to node 1; The IV calculated by the first mathematical transformation and the second mathematical transformation 1 and IV 2 are no longer equal, Before the second decoding unit calculates a first initialization vector IV 1 , Determine the overflow order of SN 1 and IV 1 ; When it is determined that SN 1 will overflow first, performing a first mathematical transformation on the obtained SN 1 value to calculate said IV 1 includes: the SN 1 value for calculating IV 1 is a first dynamic parameter, the first dynamic parameter is multiplied by a coefficient P, and then IV 1 is calculated by summing the product of the first dynamic parameter and the coefficient P, a differential parameter C, and a first parameter Q 1 ; If it is determined that IV 1 will overflow first, performing a first mathematical transformation on the obtained SN 1 value to calculate said IV 1 includes: dividing SN1 by M to calculate IV1, obtaining a remainder to obtain a third dynamic parameter, multiplying the third dynamic parameter by the coefficient P, and then calculating IV1 by summing the product of the third dynamic parameter and the coefficient P, the differential parameter C, and the Q1; An apparatus for secure data transmission, characterized in that P is not equal to 1 or 0, Q 1 is 0 or is not an integer multiple of P, the length of C is equal to the length n of IV 1, C includes k high-order bits and n-k low-order bits, the value of the low-order bits is zero, and M is the maximum value 2 n-k of the low-order n-k bits of IV 1 when IV 1 first overflows.

Citation Information

Patent Citations

  • Data transmission method between network nodes

    JP2012502572A

  • Extending cryptographic-key lifespan in network encryption protocols

    US10708246B1