CN114978475A - Automobile instrument encryption and decryption processing method and system based on AES-128 algorithm - Google Patents
Automobile instrument encryption and decryption processing method and system based on AES-128 algorithm Download PDFInfo
- Publication number
- CN114978475A CN114978475A CN202210542159.0A CN202210542159A CN114978475A CN 114978475 A CN114978475 A CN 114978475A CN 202210542159 A CN202210542159 A CN 202210542159A CN 114978475 A CN114978475 A CN 114978475A
- Authority
- CN
- China
- Prior art keywords
- byte
- key
- row
- round
- encryption
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 9
- 238000000034 method Methods 0.000 claims abstract description 29
- 230000008569 process Effects 0.000 claims abstract description 23
- 239000011159 matrix material Substances 0.000 claims abstract description 20
- 238000013507 mapping Methods 0.000 claims abstract description 7
- 238000006467 substitution reaction Methods 0.000 claims abstract description 6
- 230000009466 transformation Effects 0.000 claims abstract description 6
- 238000012545 processing Methods 0.000 claims description 9
- 230000002441 reversible effect Effects 0.000 claims description 9
- 238000006073 displacement reaction Methods 0.000 claims description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000011084 recovery Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0618—Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
- H04L9/0631—Substitution permutation network [SPN], i.e. cipher composed of a number of stages or rounds each involving linear and nonlinear transformations, e.g. AES algorithms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0894—Escrow, recovery or storing of secret information, e.g. secret key escrow or cryptographic key storage
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L2209/00—Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
- H04L2209/84—Vehicles
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Storage Device Security (AREA)
Abstract
Description
技术领域technical field
本发明涉及仪表加解密技术领域,具体地,涉及一种基于AES-128算法的汽车仪表加解密处理方法和系统。The invention relates to the technical field of instrument encryption and decryption, in particular to an encryption and decryption processing method and system for automobile instruments based on the AES-128 algorithm.
背景技术Background technique
随着新能源汽车的崛起及“互联网+”概念的普及,现在的汽车已经不再局限于行驶功能,智能座舱提供给人们更丰富的功能同时,对汽车安全也提出了更高的需求。如OTA在线升级,以及本地存储数据安全性。With the rise of new energy vehicles and the popularization of the concept of "Internet +", today's cars are no longer limited to driving functions. Smart cockpits provide people with richer functions and higher requirements for car safety. Such as OTA online upgrade, and local storage data security.
所以越来越多的整车厂开始对数据进行加密处理,目前市面上比较成熟的是通用公司的PEPU加密,大众的FAZITID以及马自达的DaVinci,虽然各个厂家对于数据的处理方式不一样,但算法原理基本相同,本发明描述的是基于AES-128算法原理的汽车仪表加解密算法处理、目前已用在马自达多款电动车上,取得了不错的效果。Therefore, more and more OEMs begin to encrypt data. Currently, the more mature ones on the market are GM's PEPU encryption, Volkswagen's FAZITID and Mazda's DaVinci. Although each manufacturer handles data differently, the algorithm The principle is basically the same. The present invention describes the encryption and decryption algorithm processing of automobile instrumentation based on the principle of AES-128 algorithm, which has been used in many electric vehicles of Mazda and has achieved good results.
专利文献CN109104278A(申请号:CN201811071752.1)公开了一种加密解密方法,包括:(1)、选定待加密明文,经处理器读取明文数据;(2)、使用AES算法对步骤(1)得到的明文数据进行加密,得到加密明文与AES密码;(3)、使用RSA算法对经过步骤(2)得到的AES密码进行加密,同时使用SSL发送连接请求;(4)、经过认证后接受SSL连接请求,并通过SSL连接获取AES密码与RSA密钥;(5)、利用经过步骤(4)得到的AES密码与RSA密钥对加密明文解密。Patent document CN109104278A (application number: CN201811071752.1) discloses an encryption and decryption method, comprising: (1) selecting plaintext to be encrypted, and reading plaintext data through a processor; (2) using AES algorithm to perform step (1) (3), use RSA algorithm to encrypt the AES password obtained through step (2), use SSL to send connection request simultaneously; (4), accept after authentication The SSL connection request is made, and the AES password and the RSA key are obtained through the SSL connection; (5), the encrypted plaintext is decrypted using the AES password and the RSA key obtained through step (4).
AES是一个对称分组密码算法,根据使用的密码长度,AES最常见的有3种方案,用以适应不同的场景要求,分别是AES-128、AES-192和AES-256,本发明根据马自达客户需求,基于cybersecurity的长度选择AES-128满足设计需求,所产生的seed&key通过CAN写入到产品,从而实现芯片内部的数据保护。AES is a symmetric block cipher algorithm. According to the length of the cipher used, AES has three most common schemes to adapt to different scene requirements, namely AES-128, AES-192 and AES-256. The present invention is based on Mazda customers. AES-128 is selected based on the length of cybersecurity to meet the design requirements, and the generated seed&key is written to the product through CAN, thereby realizing data protection inside the chip.
发明内容SUMMARY OF THE INVENTION
针对现有技术中的缺陷,本发明的目的是提供一种基于AES-128算法的汽车仪表加解密处理方法和系统。In view of the defects in the prior art, the purpose of the present invention is to provide an encryption and decryption processing method and system for automobile meters based on the AES-128 algorithm.
根据本发明提供的基于AES-128算法的汽车仪表加解密处理方法,包括:According to the method for encrypting and decrypting automobile meters based on the AES-128 algorithm provided by the present invention, the method includes:
字节替代步骤:通过变换函数S-box进行字节映射,获取对应的开始字节;Byte substitution step: perform byte mapping through the transformation function S-box to obtain the corresponding start byte;
行移位步骤:对4x4矩阵的内部字节进行置换;Row shift step: permutation of the internal bytes of the 4x4 matrix;
列混淆步骤:每个字节对应的值只与该列的4个值有关系,将某个字节所对应的值乘以2,其结果是将该值的二进制位左移一位;Column obfuscation step: the value corresponding to each byte is only related to the 4 values of the column, multiply the value corresponding to a certain byte by 2, and the result is that the binary bit of the value is shifted one bit to the left;
轮秘钥加步骤:在加密过程中,将每轮的输入与轮秘钥异或一次;Round key addition step: in the encryption process, the input of each round is XORed with the round key once;
秘钥写入步骤:在完成上述步骤后得到一组秘钥,进行写入保存,格式为字符串。Secret key writing step: After completing the above steps, a set of secret keys are obtained, written and saved, and the format is a string.
优选的,所述行位移步骤包括:第一行保持不变,第二行循环左移1个字节,第三行循环左移2个字节,第四行循环左移3个字节,则矩阵S的表达式为:Preferably, the row shifting step includes: the first row remains unchanged, the second row is shifted to the left by 1 byte, the third row is shifted to the left by 2 bytes, the fourth row is shifted to the left by 3 bytes, Then the expression of matrix S is:
S’[i][j]=S[i][(j+i)%4],其中i、j属于[0,3]。S'[i][j]=S[i][(j+i)%4], where i, j belong to [0, 3].
优选的,所述列混淆包括正向混淆与逆向混淆,在列混淆的过程中,如果某个字节所对应的值的最高位为1,则还需将移位后的结果异或00011011,各个值在相加时使用模2加法。Preferably, the column obfuscation includes forward obfuscation and reverse obfuscation. In the process of column obfuscation, if the highest bit of the value corresponding to a certain byte is 1, the shifted result needs to be XORed by 00011011, The individual values are added using modulo-2 addition.
优选的,所述轮秘钥加步骤包括:任何数和自身的异或结果为0,解密时再异或上该轮的密码进行输入恢复。Preferably, the step of adding the round secret key includes: the XOR result of any number and itself is 0, and then XOR the password of the round for input recovery during decryption.
优选的,每轮的秘钥分别由初始秘钥扩展得到,最初行作为种子,剩余行从种子秘钥产生,变量Nk代表以32位字为单位的种子秘钥长度,秘钥扩展过程为:Preferably, the secret key of each round is obtained by expanding the initial secret key, the initial row is used as the seed, the remaining rows are generated from the seed secret key, the variable Nk represents the length of the seed secret key in 32-bit words, and the secret key expansion process is:
将初始秘钥以列为主,转化为4*32bits的字,分别记为w[0…(Nk-1)];Convert the initial key to a column-based word, and convert it into a word of 4*32bits, which is written as w[0...(Nk-1)];
依次求解w[j],其中j是整数并且属于[4,K];其中,K=Nb*(Nr+1),Nb=4,Nr为轮数,128位秘钥对应的Nr=10;Solve w[j] in turn, where j is an integer and belongs to [4, K]; where, K=Nb*(Nr+1), Nb=4, Nr is the number of rounds, and Nr=10 corresponding to the 128-bit key;
若j%4=0,则w[j]=w[j-4]⊕g(w[j-1]);否则w[j]=w[j-4]⊕w[j-1]。If j%4=0, then w[j]=w[j-4]⊕g(w[j-1]); otherwise, w[j]=w[j-4]⊕w[j-1].
根据本发明提供的基于AES-128算法的汽车仪表加解密处理系统,包括:The car instrument encryption and decryption processing system based on AES-128 algorithm provided according to the present invention includes:
字节替代模块:通过变换函数S-box进行字节映射,获取对应的开始字节;Byte replacement module: perform byte mapping through the transformation function S-box to obtain the corresponding start byte;
行移位模块:对4x4矩阵的内部字节进行置换;Row shift module: permutes the internal bytes of the 4x4 matrix;
列混淆模块:每个字节对应的值只与该列的4个值有关系,将某个字节所对应的值乘以2,其结果是将该值的二进制位左移一位;Column confusion module: the value corresponding to each byte is only related to the 4 values of the column, multiply the value corresponding to a byte by 2, and the result is to shift the binary bit of the value one bit to the left;
轮秘钥加模块:在加密过程中,将每轮的输入与轮秘钥异或一次;Round key addition module: In the encryption process, the input of each round is XORed with the round key once;
秘钥写入模块:在完成上述步骤后得到一组秘钥,进行写入保存,格式为字符串。Secret key writing module: After completing the above steps, a set of secret keys are obtained, written and saved, and the format is a string.
优选的,所述行位移模块包括:第一行保持不变,第二行循环左移1个字节,第三行循环左移2个字节,第四行循环左移3个字节,则矩阵S的表达式为:Preferably, the row shift module includes: the first row remains unchanged, the second row is shifted to the left by 1 byte, the third row is shifted to the left by 2 bytes, and the fourth row is shifted to the left by 3 bytes. Then the expression of matrix S is:
S’[i][j]=S[i][(j+i)%4],其中i、j属于[0,3]。S'[i][j]=S[i][(j+i)%4], where i, j belong to [0, 3].
优选的,所述列混淆包括正向混淆与逆向混淆,在列混淆的过程中,如果某个字节所对应的值的最高位为1,则还需将移位后的结果异或00011011,各个值在相加时使用模2加法。Preferably, the column obfuscation includes forward obfuscation and reverse obfuscation. In the process of column obfuscation, if the highest bit of the value corresponding to a certain byte is 1, the shifted result needs to be XORed by 00011011, The individual values are added using modulo-2 addition.
优选的,所述轮秘钥加模块包括:任何数和自身的异或结果为0,解密时再异或上该轮的密码进行输入恢复。Preferably, the round key adding module includes: the XOR result of any number and itself is 0, and then XOR the password of the round for input recovery during decryption.
优选的,每轮的秘钥分别由初始秘钥扩展得到,最初行作为种子,剩余行从种子秘钥产生,变量Nk代表以32位字为单位的种子秘钥长度,秘钥扩展过程为:Preferably, the secret key of each round is obtained by expanding the initial secret key, the initial row is used as the seed, the remaining rows are generated from the seed secret key, the variable Nk represents the length of the seed secret key in 32-bit words, and the secret key expansion process is:
将初始秘钥以列为主,转化为4*32bits的字,分别记为w[0…(Nk-1)];Convert the initial key to a column-based word, and convert it into a word of 4*32bits, which is written as w[0...(Nk-1)];
依次求解w[j],其中j是整数并且属于[4,K];其中,K=Nb*(Nr+1),Nb=4,Nr为轮数,128位秘钥对应的Nr=10;Solve w[j] in turn, where j is an integer and belongs to [4, K]; where, K=Nb*(Nr+1), Nb=4, Nr is the number of rounds, and Nr=10 corresponding to the 128-bit key;
若j%4=0,则w[j]=w[j-4]⊕g(w[j-1]);否则w[j]=w[j-4]⊕w[j-1]。If j%4=0, then w[j]=w[j-4]⊕g(w[j-1]); otherwise, w[j]=w[j-4]⊕w[j-1].
与现有技术相比,本发明具有如下的有益效果:Compared with the prior art, the present invention has the following beneficial effects:
本发明通过层层剖析加密的过程,如秘钥预扩展、字节替代、行移位、列混淆和轮秘钥加,最后生成最后的key,然后通过DID将生成的key写入到产品里实现最终的加密目标,本发明使用简单的矩阵运算加密数据,加密/解密率高。The invention analyzes the encryption process layer by layer, such as key pre-expansion, byte substitution, row shift, column confusion and round key addition, finally generates the final key, and then writes the generated key into the product through DID To achieve the final encryption target, the present invention uses simple matrix operation to encrypt data, and the encryption/decryption rate is high.
附图说明Description of drawings
通过阅读参照以下附图对非限制性实施例所作的详细描述,本发明的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present invention will become more apparent by reading the detailed description of non-limiting embodiments with reference to the following drawings:
图1为加密流程图;Fig. 1 is the encryption flow chart;
图2为密钥扩展流程图;Fig. 2 is the key expansion flow chart;
图3为S-box对应表;Figure 3 is the S-box correspondence table;
图4为行移位示意图;4 is a schematic diagram of row shift;
图5为实际移位示意图;Fig. 5 is a schematic diagram of actual displacement;
图6为列混淆示意图;Figure 6 is a schematic diagram of column confusion;
图7为列混淆示意图。Figure 7 is a schematic diagram of column confusion.
具体实施方式Detailed ways
下面结合具体实施例对本发明进行详细说明。以下实施例将有助于本领域的技术人员进一步理解本发明,但不以任何形式限制本发明。应当指出的是,对本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变化和改进。这些都属于本发明的保护范围。The present invention will be described in detail below with reference to specific embodiments. The following examples will help those skilled in the art to further understand the present invention, but do not limit the present invention in any form. It should be noted that, for those skilled in the art, several changes and improvements can be made without departing from the inventive concept. These all belong to the protection scope of the present invention.
实施例:Example:
如图1,加密过程主要涉及到4个block:字节替代、行移位、列混淆和轮秘钥加,与此同时解密过程分别为与之对应的逆操作。由于每一步操作都是可逆的,按照相反的顺序进行解密即可恢复明文。加解密中每轮的秘钥分别由初始秘钥扩展得到。算法中16字节的明文、密文和轮秘钥都以一个4x4的矩阵(4*4)表示。As shown in Figure 1, the encryption process mainly involves 4 blocks: byte substitution, row shift, column confusion and round key addition. At the same time, the decryption process is the corresponding inverse operation. Since each operation is reversible, decryption in reverse order can restore the plaintext. The key for each round of encryption and decryption is obtained by extending the initial key. The 16-byte plaintext, ciphertext and round key in the algorithm are all represented by a 4x4 matrix (4*4).
每轮的秘钥分别由初始秘钥扩展得到,如图2,其中w[i,j]最初的Nk行被作为种子seed,用原始秘钥值;剩余行从种子秘钥来产生。变量Nk代表以32位字为单位的种子秘钥长度。新的秘钥被称为轮秘钥(roundkeys)以将它们与原始种子秘钥区别开来,秘钥扩展过程如下:The key of each round is obtained by extending the initial key, as shown in Figure 2, where the initial Nk row of w[i, j] is used as the seed seed, using the original key value; the remaining rows are generated from the seed key. The variable Nk represents the length of the seed key in 32-bit words. The new keys are called roundkeys to distinguish them from the original seed keys, and the key expansion process is as follows:
1)将初始秘钥以列为主,转化为4*32bits的字,分别记为w[0…(Nk-1)];1) Convert the initial key to a column-based word, and convert it into a 4*32bits word, which is written as w[0...(Nk-1)];
2)按照如下方式,依次求解w[j],其中j是整数并且属于[4,K];(K=Nb*(Nr+1),Nb=4,Nr为轮数,128位秘钥对应的Nr=10);2) Solve w[j] in turn as follows, where j is an integer and belongs to [4, K]; (K=Nb*(Nr+1), Nb=4, Nr is the number of rounds, and the 128-bit key corresponds to of Nr=10);
3)若j%4=0,则w[j]=w[j-4]⊕g(w[j-1]);否则w[j]=w[j-4]⊕w[j-1]。3) If
AES加密例程开始是拷贝16字节的输入数组到一个名为态State的4×4字节矩阵中,AES加密算法取名为Cipher,它操作State[];The AES encryption routine starts by copying the 16-byte input array into a 4x4-byte matrix named State. The AES encryption algorithm is named Cipher, which operates on State[];
举例:Example:
Cipher Key=2b 7e 15 16 28 ae d2 a6 ab f7 15 88 09 cf 4f 3cCipher Key=
当Nk=4,w0=2b7e1516,w1=28aed2a6,w2=abf71588,w3=09cf4f3c。When Nk=4, w0=2b7e1516, w1=28aed2a6, w2=abf71588, w3=09cf4f3c.
字节替代:通过S-box完成一个字节到另外一个字节的映射,按照aij就能找到对应的开始字节,如图3为S-box对应表。Byte substitution: The mapping of one byte to another byte is completed through the S-box, and the corresponding start byte can be found according to aij, as shown in Figure 3 for the S-box correspondence table.
行移位:如图4,行移位的功能是实现一个4x4矩阵内部字节之间的置换。Row shift: As shown in Figure 4, the function of row shift is to realize the permutation between the internal bytes of a 4x4 matrix.
如图5,实际移位的操作即是:第一行保存不变,第二行循环左移1个字节,第三行循环左移2个字节,第四行循环左移3个字节。假设矩阵的名字为state,简称S,用公式表示如下:As shown in Figure 5, the actual shift operation is: the first row is kept unchanged, the second row is shifted to the left by 1 byte, the third row is shifted to the left by 2 bytes, and the fourth row is shifted to the left by 3 words. Festival. Suppose the name of the matrix is state, abbreviated as S, and the formula is expressed as follows:
state’[i][j]=state[i][(j+i)%4],其中i、j属于[0,3]。state'[i][j]=state[i][(j+i)%4], where i, j belong to [0, 3].
列混淆:分为正向混淆与逆向混淆,如图6和图7,根据矩阵的乘法可知,在列混淆的过程中,每个字节对应的值只与该列的4个值有关系,将某个字节所对应的值乘以2,其结果就是将该值的二进制位左移一位,如果该值的最高位为1(表示该数值不小于128),则还需要将移位后的结果异或00011011(0x1b),但是要注意上述矩阵乘法与一般意义上矩阵的乘法有所不同,各个值在相加时使用的是模2加法(相当于是异或运算)。Column confusion: It is divided into forward confusion and reverse confusion, as shown in Figure 6 and Figure 7. According to the multiplication of the matrix, in the process of column confusion, the value corresponding to each byte is only related to the 4 values of the column. Multiply the value corresponding to a byte by 2, and the result is to shift the binary bit of the value by one bit to the left. If the highest bit of the value is 1 (indicating that the value is not less than 128), you also need to shift The result after XOR is 00011011 (0x1b), but it should be noted that the above matrix multiplication is different from the matrix multiplication in the general sense. Each value is added using modulo 2 addition (equivalent to an XOR operation).
其中:in:
01·46=01000110B 01·46=01000110 B
01·A6=10100110B 01·A6=10100110 B
则:but:
轮密码加:任何数和自身的异或结果为0。加密过程中,每轮的输入与轮秘钥异或一次;因此,解密时再异或上该轮的密码即可恢复输入。Round cipher plus: the XOR of any number and itself is 0. During the encryption process, the input of each round is XORed with the round key once; therefore, the input can be recovered by XORing the password of the round during decryption.
秘钥写入:在以上四个过程都完成的基础上能得到一组秘钥,称之为DIAG,格式是字符串。例如下面就是产线随机生成的一组加密数据:Key writing: After the above four processes are completed, a set of keys can be obtained, which is called DIAG, and the format is a string. For example, the following is a set of encrypted data randomly generated by the production line:
DIAG=3031323334353637383900000010C9FA819F3ACB0062E7A6AA9241B0DC2DB412875A2D2FA100765927A6ED903AE6A41D7944DIAG=3031323334353637383900000010C9FA819F3ACB0062E7A6AA9241B0DC2DB412875A2D2FA100765927A6ED903AE6A41D7944
然后发then send
2EFEF3+DIAG(3031323334353637383900000010C9FA819F3ACB0062E7A6AA9241B0DC2DB412875A2D2FA100765927A6ED903AE6A41D7944),其中2E代表写入,FEF3称之为DID。2EFEF3+DIAG(3031323334353637383900000010C9FA819F3ACB0062E7A6AA9241B0DC2DB412875A2D2FA100765927A6ED903AE6A41D7944), where 2E stands for write, and FEF3 calls it DID.
如果收到6E FE F3+Positive Feedback,那就代表当前生成的key已经全部写进去了,如果实际的产品需要解密也是一样,只要将上述的seed&key进行逆向处理,如进行矩阵的逆运算,将得到新的一组key,将新的一组key通过第三步“秘钥写入”就可以解密,这样就能实现汽车仪表加解密处理。If 6E FE F3+Positive Feedback is received, it means that the currently generated keys have all been written in. If the actual product needs to be decrypted, the same is true. Just reverse the above seed&key, such as the inverse operation of the matrix, you will get A new set of keys can be decrypted through the third step of "secret key writing", so that the encryption and decryption processing of the car instrument can be realized.
根据本发明提供的基于AES-128算法的汽车仪表加解密处理系统,包括:字节替代模块:通过变换函数S-box进行字节映射,获取对应的开始字节;行移位模块:对4x4矩阵的内部字节进行置换;列混淆模块:每个字节对应的值只与该列的4个值有关系,将某个字节所对应的值乘以2,其结果是将该值的二进制位左移一位;轮秘钥加模块:在加密过程中,将每轮的输入与轮秘钥异或一次;秘钥写入模块:在完成上述步骤后得到一组秘钥,进行写入保存,格式为字符串。The car instrument encryption and decryption processing system based on the AES-128 algorithm provided according to the present invention includes: a byte replacement module: performing byte mapping through the transformation function S-box to obtain the corresponding start byte; a line shift module: for 4x4 The internal bytes of the matrix are replaced; column confusion module: the value corresponding to each byte is only related to the 4 values of the column, multiply the value corresponding to a byte by 2, and the result is the value of the value. The binary bit is shifted to the left by one; the round key addition module: in the encryption process, the input of each round is XORed with the round key once; the key writing module: after completing the above steps, a set of keys is obtained and written Save it in the format of a string.
所述行位移模块包括:第一行保持不变,第二行循环左移1个字节,第三行循环左移2个字节,第四行循环左移3个字节,则矩阵S的表达式为:S’[i][j]=S[i][(j+i)%4],其中i、j属于[0,3]。所述列混淆包括正向混淆与逆向混淆,在列混淆的过程中,如果某个字节所对应的值的最高位为1,则还需将移位后的结果异或00011011,各个值在相加时使用模2加法。所述轮秘钥加模块包括:任何数和自身的异或结果为0,解密时再异或上该轮的密码进行输入恢复。每轮的秘钥分别由初始秘钥扩展得到,最初行作为种子,剩余行从种子秘钥产生,变量Nk代表以32位字为单位的种子秘钥长度,秘钥扩展过程为:将初始秘钥以列为主,转化为4*32bits的字,分别记为w[0…(Nk-1)];依次求解w[j],其中j是整数并且属于[4,K];其中,K=Nb*(Nr+1),Nb=4,Nr为轮数,128位秘钥对应的Nr=10;若j%4=0,则w[j]=w[j-4]⊕g(w[j-1]);否则w[j]=w[j-4]⊕w[j-1]。The row displacement module includes: the first row remains unchanged, the second row is shifted to the left by 1 byte, the third row is shifted to the left by 2 bytes, and the fourth row is shifted to the left by 3 bytes. The expression of is: S'[i][j]=S[i][(j+i)%4], where i, j belong to [0, 3]. The column obfuscation includes forward obfuscation and reverse obfuscation. In the process of column obfuscation, if the highest bit of the value corresponding to a certain byte is 1, the shifted result needs to be XORed by 00011011, and each value is in Use modulo-2 addition when adding. The round secret key adding module includes: the XOR result of any number and itself is 0, and then XOR the password of the round for input recovery during decryption. The secret key of each round is obtained by expanding the initial secret key. The initial row is used as the seed, and the remaining rows are generated from the seed secret key. The variable Nk represents the length of the seed secret key in 32-bit words. The secret key expansion process is: The key is column-based, converted into a word of 4*32bits, and recorded as w[0...(Nk-1)]; solve w[j] in turn, where j is an integer and belongs to [4, K]; among them, K =Nb*(Nr+1), Nb=4, Nr is the number of rounds, and Nr=10 corresponding to the 128-bit key; if
本领域技术人员知道,除了以纯计算机可读程序代码方式实现本发明提供的系统、装置及其各个模块以外,完全可以通过将方法步骤进行逻辑编程来使得本发明提供的系统、装置及其各个模块以逻辑门、开关、专用集成电路、可编程逻辑控制器以及嵌入式微控制器等的形式来实现相同程序。所以,本发明提供的系统、装置及其各个模块可以被认为是一种硬件部件,而对其内包括的用于实现各种程序的模块也可以视为硬件部件内的结构;也可以将用于实现各种功能的模块视为既可以是实现方法的软件程序又可以是硬件部件内的结构。Those skilled in the art know that, in addition to implementing the system, device and each module provided by the present invention in the form of pure computer readable program code, the system, device and each module provided by the present invention can be completely implemented by logically programming the method steps. The same program is implemented in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, and embedded microcontrollers, among others. Therefore, the system, device and each module provided by the present invention can be regarded as a kind of hardware component, and the modules used for realizing various programs included in it can also be regarded as the structure in the hardware component; A module for realizing various functions can be regarded as either a software program for realizing a method or a structure within a hardware component.
以上对本发明的具体实施例进行了描述。需要理解的是,本发明并不局限于上述特定实施方式,本领域技术人员可以在权利要求的范围内做出各种变化或修改,这并不影响本发明的实质内容。在不冲突的情况下,本申请的实施例和实施例中的特征可以任意相互组合。Specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the above-mentioned specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essential content of the present invention. The embodiments of the present application and features in the embodiments may be combined with each other arbitrarily, provided that there is no conflict.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210542159.0A CN114978475A (en) | 2022-05-18 | 2022-05-18 | Automobile instrument encryption and decryption processing method and system based on AES-128 algorithm |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210542159.0A CN114978475A (en) | 2022-05-18 | 2022-05-18 | Automobile instrument encryption and decryption processing method and system based on AES-128 algorithm |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114978475A true CN114978475A (en) | 2022-08-30 |
Family
ID=82983752
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210542159.0A Pending CN114978475A (en) | 2022-05-18 | 2022-05-18 | Automobile instrument encryption and decryption processing method and system based on AES-128 algorithm |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114978475A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116311621A (en) * | 2023-03-23 | 2023-06-23 | 天津天优科技股份有限公司 | Digital password encryption and decryption method for intelligent door lock |
CN116865949A (en) * | 2023-08-01 | 2023-10-10 | 重庆明东新科技有限公司 | AES (advanced encryption Standard) key generation method, data encryption method for improving AES and automobile security system |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030223580A1 (en) * | 2002-05-23 | 2003-12-04 | Snell Dorian L. | Advanced encryption standard (AES) hardware cryptographic engine |
CN108183790A (en) * | 2018-02-13 | 2018-06-19 | 中山大学 | A kind of AES encryption device, chip and system |
CN111064562A (en) * | 2019-12-12 | 2020-04-24 | 北京计算机技术及应用研究所 | Implementation method of AES algorithm on FPGA |
CN111262684A (en) * | 2020-01-13 | 2020-06-09 | 燕山大学 | A power battery traceability management coding encryption method based on improved AES algorithm |
CN111314051A (en) * | 2018-12-11 | 2020-06-19 | 北京思源理想控股集团有限公司 | Encryption and decryption method and device |
CN113206736A (en) * | 2021-04-21 | 2021-08-03 | 国网黑龙江省电力有限公司齐齐哈尔供电公司 | Encryption method based on AES encryption algorithm |
-
2022
- 2022-05-18 CN CN202210542159.0A patent/CN114978475A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030223580A1 (en) * | 2002-05-23 | 2003-12-04 | Snell Dorian L. | Advanced encryption standard (AES) hardware cryptographic engine |
CN108183790A (en) * | 2018-02-13 | 2018-06-19 | 中山大学 | A kind of AES encryption device, chip and system |
CN111314051A (en) * | 2018-12-11 | 2020-06-19 | 北京思源理想控股集团有限公司 | Encryption and decryption method and device |
CN111064562A (en) * | 2019-12-12 | 2020-04-24 | 北京计算机技术及应用研究所 | Implementation method of AES algorithm on FPGA |
CN111262684A (en) * | 2020-01-13 | 2020-06-09 | 燕山大学 | A power battery traceability management coding encryption method based on improved AES algorithm |
CN113206736A (en) * | 2021-04-21 | 2021-08-03 | 国网黑龙江省电力有限公司齐齐哈尔供电公司 | Encryption method based on AES encryption algorithm |
Non-Patent Citations (3)
Title |
---|
张亚琳: "物联网中基于ZigBee协议的安全算法研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》, 15 January 2013 (2013-01-15), pages 21 - 29 * |
张鹏: "AES-128 在光模块中设计与实现", 信息通信, 15 June 2015 (2015-06-15) * |
程桂花;齐学梅;罗永龙;: "AES算法中的多项式模运算及其性能分析", 计算机技术与发展, no. 09, 10 September 2010 (2010-09-10), pages 115 - 118 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116311621A (en) * | 2023-03-23 | 2023-06-23 | 天津天优科技股份有限公司 | Digital password encryption and decryption method for intelligent door lock |
CN116865949A (en) * | 2023-08-01 | 2023-10-10 | 重庆明东新科技有限公司 | AES (advanced encryption Standard) key generation method, data encryption method for improving AES and automobile security system |
CN116865949B (en) * | 2023-08-01 | 2024-04-26 | 重庆明东新科技有限公司 | AES (advanced encryption Standard) key generation method, data encryption method for improving AES and automobile security system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102025484B (en) | Block cipher encryption and decryption method | |
EP0802653B1 (en) | Multi-cycle non-parallel data encryption engine | |
US8503670B2 (en) | Parallelizable integrity-aware encryption technique | |
US8705731B2 (en) | Selection of a lookup table with data masked with a combination of an additive and multiplicative mask | |
US8428251B2 (en) | System and method for stream/block cipher with internal random states | |
CN114444140A (en) | Non-duplicable function application in memory | |
CN114978475A (en) | Automobile instrument encryption and decryption processing method and system based on AES-128 algorithm | |
CN111245598A (en) | A Realization Method of Lightweight AEROGEL Block Cipher | |
Greene et al. | Aradi and llama: Low-latency cryptography for memory encryption | |
CN106982116B (en) | A Local File Encryption Method Based on AES Based on Reversible Logic Circuit | |
CN116405194A (en) | Data encryption transmission method based on Beidou short message | |
CN112134691A (en) | Method, device and medium for realizing NLCS block cipher with repeatable components | |
Singh et al. | Study & analysis of cryptography algorithms: RSA, AES, DES, T-DES, blowfish | |
CN101826959A (en) | Byte-oriented key stream generation method and encryption method | |
Gandh et al. | FPGA implementation of enhanced key expansion algorithm for Advanced Encryption Standard | |
CN113922948A (en) | National secret algorithm SM4 data encryption method and system based on compound domain round function | |
Zhang | Cryptanalyzing an image cryptosystem based on circular inter-intra pixels bit-level permutation | |
US20240097880A1 (en) | High-speed circuit combining aes and sm4 encryption and decryption | |
CN107493164B (en) | A DES encryption method and system based on chaotic system | |
CN111262685A (en) | Novel method and device for realizing Shield block cipher generated by secret key and readable storage medium | |
CN116318669A (en) | A Lightweight Encryption Method Based on NB-IoT | |
CN114826558A (en) | Mass data rapid encryption method and system | |
CN110417540B (en) | Information encryption method for resisting differential power analysis | |
Landge et al. | VHDL based Blowfish implementation for secured embedded system design | |
CN110247754B (en) | A method and device for realizing block cipher FBC |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |