A stream encryption machine suitable for CNC systems and its working method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-08
- Publication Date
- 2026-08-14
AI Technical Summary
[0002]为了保证生产加工的实时性,在数控系统中数控装备之间通常采用工控通信协议进行数据传输,随着信息技术的快速发展,数控装备开始接入工业互联网,从而带来安全隐患
[0035] This invention provides a stream encryption machine and its working method suitable for CNC systems. It adopts a lightweight stream encryption method for data transmission between CNC equipment. Each bit of transmitted data is encrypted using an XOR method, and an encryption method of approximately one-time pad is used, i.e., stream encryption. It can provide encryption protection for data transmitted between CNC equipment in CNC systems, so as to meet the real-time data transmission and encryption requirements of CNC systems for large amounts of passwords.
Smart Images

Figure CN116684076B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of information security and numerical control, specifically relating to a stream encryption machine and its working method suitable for numerical control systems. It mainly involves a technology for high-speed stream encryption of network transmission data of numerical control systems using lightweight stream cipher technology. Background Technology
[0002] To ensure real-time production and processing, CNC equipment in CNC systems typically uses industrial control communication protocols for data transmission. With the rapid development of information technology, CNC equipment is increasingly connecting to the Industrial Internet, bringing with it security risks. At the upper layer of the Industrial Internet, existing information security technologies are generally used for network security protection. However, at the manufacturing layer of the Industrial Internet, to ensure processing accuracy, data transmission typically reaches millisecond or even microsecond levels. Existing communication encryption methods require a large amount of computation, impacting the efficiency of data transmission in intelligent manufacturing. Stream encryption is a lightweight encryption method, but existing stream encryption methods generate insufficient key streams at once. In CNC machining, a single processing cycle can sometimes take a long time, even exceeding several days. Therefore, existing stream encryption algorithms suffer from key reuse issues when used in CNC applications, making them unsuitable for high-security scenarios. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a stream encryption machine and its working method suitable for CNC systems, and to construct a high-capacity, lightweight stream encryption machine to meet the real-time data transmission and encryption requirements of CNC systems.
[0004] To address the aforementioned technical problems, embodiments of the present invention provide a stream encryption machine suitable for CNC systems, with a key quantity of 2. 86 It provides encryption protection for data transmitted between CNC devices in a CNC system.
[0005] The aforementioned stream encryption machine for CNC systems employs a lightweight stream encryption method for data transmission between CNC equipment. Each bit of transmitted data is encrypted using an XOR method, employing an approximately one-time-pad encryption method, i.e., stream encryption.
[0006] The stream encryption machine for CNC systems includes a stream key generator.
[0007] The stream key generator consists of an 86-bit LFSR = (l t , ..., l t+85 ), 74-bit NFSR = (nt, ..., n t+73 ) and a 14-bit counter composition.
[0008] Furthermore, the operation method of the stream key generator includes the following steps:
[0009] 1) Round key function: Define parameters The values of the above parameters depend on the counter Cr, which continuously changes and combines the parameters to obtain the round key functions g, f, and h, as shown below:
[0010]
[0011]
[0012] 1.1) g function: The variable of the g function is k′ t And a 16-bit NFSR, the feedback function of the NFSR is as follows:
[0013]
[0014] 1.2) f function: The feedback function of LFSR is shown below:
[0015]
[0016] 1.3) h function: Generates a pre-output stream based on the states of LFSR and NFSR, as shown below:
[0017]
[0018] 2) Output: The output keystream is generated from 5 bits of the NFSR, 1 bit of the LFSR, and the output of the h function, as shown below:
[0019]
[0020] 3) Key initialization: R key The value is generated by appending the bit string 10000000000000000000 to the header, as shown below:
[0021] R′ key =r0r1...r 158 r 159 =10000000000000000000r0r1r2...r 137 r 138 r 139 ;
[0022] During initialization, the key is loaded into the NFSR and LFSR from least significant bit to most significant bit, i.e.: k0→n0, k1→n1, ..., k 36 →n 36 k 37 →l0,k 38→l1, ...,k 159 →l 85 ;in, The password is set to 0 in step one of the initialization; after 160 clock cycles, before each clock cycle, the previous output value and R′ are... key The XOR value is fed back into the NFSR and LFSR, i.e.
[0023] The present invention also provides a method for operating a stream encryption machine suitable for CNC systems, comprising the following steps:
[0024] 1.1 The stream key generator takes an externally input stream key random variable R as input. key Generate key stream k1k2…k n When the stream encryption machine receives the input data stream d1d2…d n At this time, the key stream and the data stream are XORed bitwise to generate the ciphertext data stream e1e. 2 ... e n ;
[0025] 1.2 During decryption, the stream encryption machine uses the same random key R. key Generate the same key stream k1k2…k as the encryption key stream n When the stream encryption machine receives the ciphertext data stream e1e2…e n At this time, the key stream and the ciphertext data stream are XORed bit by bit to generate the plaintext data stream d1d2…d n ,in,
[0026] The present invention also provides a data encryption transmission method for a CNC system employing the above-mentioned stream encryption machine, comprising the following steps:
[0027] 2.1 Set up the same stream encryption machine on both the data sender and the data receiver;
[0028] 2.2 The CNC system first randomly generates a random key R. key The public key of the CNC equipment is encrypted using the national cryptographic algorithm SM9 to obtain the ciphertext SM9 of the key. pk (R key The encrypted data is then transmitted to the CNC machine, which uses its private key sk to decrypt the ciphertext and obtain the random key R. key R key =SM9 sk (SM9 pk (R key ));
[0029] 2.3 The CNC system inputs the data to be transmitted bit by bit into the encryption machine on the CNC system side. The stream encryption machine then uses the random key R... keyGenerate a key stream, encrypt the data bit by bit, and generate a ciphertext data stream;
[0030] 2.4 The stream encryption machine on the CNC system side transmits the encrypted data stream to the stream encryption machine on the CNC equipment side;
[0031] 2.5 The stream encryption machine on the CNC equipment side uses the random key R key Generate the same key stream as the CNC system side;
[0032] 2.6 After the stream encryption machine on the CNC equipment side detects that the CNC system side has sent an encrypted data stream, it uses the key stream to perform stream encryption to obtain the plaintext data stream;
[0033] 2.7 The stream encryption machine on the CNC equipment side converts the plaintext data stream into data and transmits it to the CNC equipment. The CNC equipment can then perform production processing based on the data.
[0034] The beneficial effects of the above-described technical solution of the present invention are as follows:
[0035] This invention provides a stream encryption machine and its working method suitable for CNC systems. It adopts a lightweight stream encryption method for data transmission between CNC equipment. Each bit of transmitted data is encrypted using an XOR method, and an encryption method of approximately one-time pad is used, i.e., stream encryption. It can provide encryption protection for data transmitted between CNC equipment in CNC systems, so as to meet the real-time data transmission and encryption requirements of CNC systems for large amounts of passwords. Attached Figure Description
[0036] Figure 1 This is a schematic diagram illustrating the working principle of the stream key generator in this invention.
[0037] Figure 2 This is a flowchart of the data encryption transmission method of the CNC system in this invention. Detailed Implementation
[0038] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0039] This invention provides a stream encryption machine suitable for CNC systems, with a key quantity of 2. 86 It provides encryption protection for data transmitted between CNC devices in a CNC system.
[0040] The stream encryption machine uses a lightweight stream encryption method for data transmission between CNC equipment. Each bit of transmitted data is encrypted using an XOR method, which is an encryption method that approximates one-time pad encryption, i.e., stream encryption.
[0041] The stream encryption machine for CNC systems contains a stream key generator. The working principle of the stream key generator is as follows:
[0042] To ensure a key length approximately twice the security level, a 160-bit round key function was used; the linear feedback shift register (LFSR) was set to 86 bits, and the nonlinear feedback shift register (NFSR) was set to 74 bits. The designed stream cipher can reach 2... 86 Each key ensures that a different key can be used for each data transmission in a single multi-processing operation.
[0043] The internal structure of the stream key generator consists of an 86-bit LFSR = (l t , ..., l t+85 ), 74-bit NFSR = (n t , ..., n t+73 ) and a 14-bit counter Composition. The input to the password is a 160-bit key K = (k t , ..., k 159 ) and a 140-bit initial vector R key =(r t ,...,r 139 A key and R key The maximum number of bits in the keystream that can be generated is 2. 86 Bit. R key This is a random key vector negotiated between industrial control devices; different keys correspond to different R... key .
[0044] like Figure 1 As shown, the operation method of the stream key generator includes the following steps:
[0045] 1) Round key function: Define parameters The values of the above parameters depend on the counter Cr, which continuously changes and combines the parameters to obtain the round key functions g, f, and h, as shown below:
[0046]
[0047]
[0048] 1.1) g function: The variable of the g function is k′ t And a 16-bit NFSR, the feedback function of the NFSR is as follows:
[0049]
[0050] 1.2) f function: The feedback function of LFSR is shown below:
[0051]
[0052] 1.3) h function: Generates a pre-output stream based on the states of LFSR and NFSR, as shown below:
[0053]
[0054] 2) Output: The output keystream is generated from 5 bits of the NFSR, 1 bit of the LFSR, and the output of the h function, as shown below:
[0055]
[0056] 3) Key initialization: R key The value is generated by appending the bit string 10000000000000000000 to the header, as shown below:
[0057] R′ key =r0r1...r 158 r 159 =10000000000000000000r0r1r2r... 137 r 138 r 139 .
[0058] During initialization, the key is loaded into the NFSR and LFSR from least significant bit to most significant bit, i.e.: k0→n0, k1→n1, ..., k 36 →n 36 k 37 →l0,k 38 →l1, ...,k 159 →l 85 ;in, The password is set to 0 in step one of the initialization; after 160 clock cycles, before each clock cycle, the previous output value and R′ are... key The XOR value is fed back into the NFSR and LFSR, i.e. 0≤i≤159.
[0059] In the above steps, except for the last bit which is equal to the least significant bit of LFSR, all bits of Cr are set to the least significant bit of NFSR.
[0060] Right now
[0061] To prevent the LFSR from becoming all zeros after initialization, l 160 The value is set to 1. The key needs to be disconnected between the NFSR and LFSR after 80 clock cycles without feedback. Since no key stream is generated within the initial 160 clock cycles, sc0, ..., sc158 sc 159 It was discarded, so the first bit of the generated keystream is sc. 160 .
[0062] The present invention also provides a method for operating a stream encryption machine suitable for CNC systems, comprising the following steps:
[0063] 1.1 The stream key generator takes an externally input stream key random variable R as input. key Generate key stream k1k2…k n When the stream encryption machine receives the input data stream d1d2…d n At this time, the key stream and the data stream are XORed bitwise to generate the ciphertext data stream e1e2…e n ;
[0064] 1.2 During decryption, the stream encryption machine uses the same random key R. key Generate the same key stream k1k2…k as the encryption key stream n When the stream encryption machine receives the ciphertext data stream e1e2…e n At this time, the key stream and the ciphertext data stream are XORed bit by bit to generate the plaintext data stream d1d2…d n ,in
[0065] In high-security scenarios, when a CNC system needs to transmit data to CNC equipment (CNC machine tools / PLC / robots / production line equipment), the data transmission needs to be encrypted. The data encryption transmission method for a CNC system using the aforementioned stream encryption machine includes the following steps:
[0066] 2.1 Set up the same stream encryption machine on both the data sender and the data receiver;
[0067] 2.2 The CNC system first randomly generates a random key R. key The public key of the CNC equipment is encrypted using the national cryptographic algorithm SM9 to obtain the ciphertext SM9 of the key. pk (R key The encrypted data is then transmitted to the CNC machine, which uses its private key sk to decrypt the ciphertext and obtain the random key R. ke y, which is R key =SM9 sk (SM9 pk (R key ));
[0068] 2.3 The CNC system inputs the data to be transmitted bit by bit into the encryption machine on the CNC system side. The stream encryption machine then uses the random key R... key Generate a key stream, encrypt the data bit by bit, and generate a ciphertext data stream;
[0069] 2.4 The stream encryption machine on the CNC system side transmits the encrypted data stream to the stream encryption machine on the CNC equipment side;
[0070] 2.5 The stream encryption machine on the CNC equipment side uses the random key R key Generate the same key stream as the CNC system side;
[0071] 2.6 After the stream encryption machine on the CNC equipment side detects that the CNC system side has sent an encrypted data stream, it uses the key stream to perform stream encryption to obtain the plaintext data stream;
[0072] 2.7 The stream encryption machine on the CNC equipment side converts the plaintext data stream into data and transmits it to the CNC equipment. The CNC equipment can then perform production processing based on the data.
[0073] This invention employs a lightweight stream encryption method for data transmission between CNC equipment. Each bit of transmitted data is encrypted using an XOR method, employing an approximately one-time pad encryption method, i.e., stream encryption. This provides encryption protection for data transmitted between CNC devices in a CNC system, meeting the real-time requirements of CNC system data transmission and the need for large amounts of encryption.
[0074] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for operating a stream encryption machine suitable for CNC systems, characterized in that, The stream encryption machine has 2 keys. 86 It provides encryption protection for data transmitted between CNC devices in a CNC system; The stream encryption machine applicable to CNC systems uses a lightweight stream encryption method for data transmission between CNC equipment. Each bit of transmitted data is encrypted using an XOR method, and an encryption method of approximately one-time pad is used, i.e., stream encryption. The stream encryption machine suitable for CNC systems contains a stream key generator. The stream key generator consists of 86 bits. 74 bits and a 14-bit counter composition; The operation of the stream key generator includes the following steps: 1) Round key function: Define parameters , , The values of the above parameters depend on the counter Cr, which continuously changes and combines the parameters to obtain the round key functions g, f, and h, as shown below: ; ; 1) g function: The variables of the g function are And a 16-bit NFSR, the feedback function of the NFSR is as follows: ; 2) f function: The feedback function of LFSR is shown below: ; 3) h function: Generates a pre-output stream based on the states of LFSR and NFSR, as shown below: ; 2) Output: The output keystream is generated from 5 bits of the NFSR, 1 bit of the LFSR, and the output of the h function, as shown below: ; 3) Key initialization: The value is obtained by passing the bit string The connection to the header is generated as follows: ; During initialization, the key from least significant bit to most significant bit is loaded into the NFSR and LFSR; The working method of the stream encryption machine applicable to CNC systems includes the following steps: S1, The stream key generator takes an externally input stream key random variable. Generate key stream When the stream encryption machine inputs a data stream At this time, the key stream and the data stream are XORed bit by bit to generate the ciphertext data stream. ; S2. During decryption, the stream cipher uses the same random key. Generate the same key stream as encryption. When the encryption machine receives the ciphertext data stream At this time, the key stream and the ciphertext data stream are XORed bit by bit to generate the plaintext data stream. ,in, .
2. A data encryption transmission method for a CNC system employing the stream encryption machine as described in claim 1, characterized in that, Includes the following steps: Step 1: Set up the same stream encryption machine on both the data sender and the data receiver; Step 2: The CNC system first randomly generates a key. The ciphertext of the key is obtained by encrypting the public key pk of the CNC equipment using the national cryptographic algorithm SM9. Then it is transmitted to the CNC equipment, which uses its private key sk to decrypt the ciphertext and obtain a random key. ,Right now ; Step 3: The CNC system inputs the data to be transmitted bit by bit into the encryption machine on the CNC system side. The stream encryption machine then uses a random key... Generate a key stream, encrypt the data bit by bit, and generate a ciphertext data stream; Step 4: The stream encryption machine on the CNC system side transmits the encrypted data stream to the stream encryption machine on the CNC equipment side; Step 5: The stream encryption machine on the CNC equipment side uses the random key. Generate the same key stream as the CNC system side; Step 6: After the stream encryption machine on the CNC equipment side detects that the CNC system side has sent an encrypted data stream, it uses the key stream to perform stream encryption to obtain the plaintext data stream. Step 7: The stream encryption machine on the CNC equipment side converts the plaintext data stream into data and transmits it to the CNC equipment. The CNC equipment can then perform production processing based on the data.
Citation Information
Patent Citations
Stream cipher implementation method based on NFSR and clock-controlled double LFSR
CN115314206A