CN107070637A - A kind of data encryption/decryption method of overlapping packet - Google Patents
A kind of data encryption/decryption method of overlapping packet Download PDFInfo
- Publication number
- CN107070637A CN107070637A CN201710026432.3A CN201710026432A CN107070637A CN 107070637 A CN107070637 A CN 107070637A CN 201710026432 A CN201710026432 A CN 201710026432A CN 107070637 A CN107070637 A CN 107070637A
- Authority
- CN
- China
- Prior art keywords
- ciphertext
- layer
- encryption
- decryption
- length
- 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
- 238000000034 method Methods 0.000 title claims abstract description 67
- 239000000463 material Substances 0.000 claims abstract description 7
- 239000013598 vector Substances 0.000 claims description 26
- 241001441724 Tetraodontidae Species 0.000 claims description 2
- 238000005336 cracking Methods 0.000 abstract description 3
- 238000004891 communication Methods 0.000 description 7
- 230000005540 biological transmission Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 239000002131 composite material Substances 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
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
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明公开了一种交叠分组数据加解密方法,其特征是采用交叠的方法对明文中的各分组进行两层加密。其关键步骤为(1)数据的加解密双方事先共享两种已有的对称加密算法以及相关加解密素材;(2)将数据明文划分成若干个定长的分组;(3)加密方对两两明文分组实施联合加密,生成第1层密文分组;(4)加密方对两两第1层密文分组实施联合加密,生成第2层密文分组并作为最终的密文;(5)解密方对两两第2层密文分组实施联合解密,生成第1层密文分组;(6)解密方对两两第1层密文分组实施联合解密,将解密结果作为最终的明文。采用本方法的作用是即使得到本方法所需要的密钥,而不知晓本方法,也无法通过暴力破解方法获得明文。
The invention discloses a method for encrypting and decrypting overlapping packet data, which is characterized in that the overlapping method is used to perform two-layer encryption on each packet in plain text. The key steps are: (1) the data encryption and decryption parties share two existing symmetric encryption algorithms and related encryption and decryption materials in advance; (2) divide the data plaintext into several fixed-length groups; (3) the encryption party The two plaintext groups implement joint encryption to generate the first-layer ciphertext group; (4) the encryption party implements joint encryption on two first-layer ciphertext groups to generate the second-layer ciphertext group as the final ciphertext; (5) The decryption party implements joint decryption on pairs of second-layer ciphertext packets to generate first-layer ciphertext packets; (6) the decryption party performs joint decryption on pairwise first-layer ciphertext packets, and uses the decryption result as the final plaintext. The effect of adopting this method is that even if the key required by this method is obtained, without knowing this method, the plaintext cannot be obtained through brute force cracking.
Description
技术领域technical field
本发明属于信息安全领域,特别是涉及到对系统内或系统间的数据机密性的技术。The invention belongs to the field of information security, and in particular relates to the technology of data confidentiality within a system or between systems.
背景技术Background technique
分组密码具有加密速度快、安全性高、易于标准化等特点,特别是在网络日趋普及的当今,更是成为确保敏感数据机密性的一种主流加解密方法,因而广泛应用于数据的安全传输与保密存储等多个应用场合中。但是现有的分组密码仍有一个共同的缺陷,即,分析者可利用被加密分组只有有限的几个长度尺寸这一特点,将枚举分组长度尺寸与暴力破解相结合就有可能破解出明文。本发明提出了一种暴力方法不可能破解的分组密码。Block cipher has the characteristics of fast encryption speed, high security, and easy standardization. Especially in today's increasingly popular network, it has become a mainstream encryption and decryption method to ensure the confidentiality of sensitive data, so it is widely used in secure data transmission and In many applications such as confidential storage. However, the existing block ciphers still have a common defect, that is, the analyst can take advantage of the fact that the encrypted block has only a few lengths, and it is possible to crack the plaintext by combining the enumerated block length size with brute force cracking. . The present invention proposes a block cipher that is impossible to break by brute force methods.
发明内容Contents of the invention
本发明的目的是提供交叠分组的数据加解密方法,该交叠分组的数据加解密方法是为了解决现有分组密码输出的密文可能被暴力破解的问题。采用分组交叠的方式对各个明文分组进行两层加密,包括:(1)对两两明文分组加密形成第1层密文分组;(2)以压盖边界的方式对第1层密文分组进行加密形成第2层密文分组,并将第2层密文分组作为最终的数据密文。The purpose of the present invention is to provide a data encryption and decryption method of overlapping blocks, which is to solve the problem that the ciphertext output by the existing block cipher may be cracked by force. Two-layer encryption is performed on each plaintext group by overlapping groups, including: (1) encrypting two plaintext groups to form the first layer of ciphertext grouping; Encrypt to form a layer 2 ciphertext group, and use the layer 2 ciphertext group as the final data ciphertext.
本发明的技术解决方案是采用交叠的方法对数据明文中的各分组进行两层的加密,其步骤如下;The technical solution of the present invention is to adopt the overlapping method to carry out two-layer encryption to each packet in the data plaintext, and its steps are as follows;
(1)对两两明文分组加密形成第1层密文分组;(1) Encrypt two plaintext blocks to form the first layer of ciphertext blocks;
(2)以压盖边界的方式对第1层密文分组进行加密形成第2层密文分组,并将第2层密文分组作为最终的数据密文。(2) Encrypt the first-layer ciphertext group to form the second-layer ciphertext group in the way of capping the boundary, and use the second-layer ciphertext group as the final data ciphertext.
对以上交叠的方法对数据明文中的各分组进行两层的加密步骤如下:For the above overlapping method, the steps of performing two-layer encryption on each group in the data plaintext are as follows:
(1)数据的加解密双方事先共享两种已有的对称加密算法以及加解密相关素材;(1) The data encryption and decryption parties share two existing symmetric encryption algorithms and encryption and decryption related materials in advance;
(2)按单长分组长度将数据明文划分成若干个定长的分组;(2) Divide the data plaintext into several fixed-length packets according to the single-length packet length;
(3)加密方对两两明文分组实施联合加密,生成第1层密文分组;(3) The encryption party implements joint encryption on two plaintext groups to generate the first-layer ciphertext group;
(4)加密方以压盖分组边界的方式对两两第1层密文分组实施联合加密,生成第2层密文分组并作为最终的密文;(4) The encryption party implements joint encryption on the first-layer ciphertext group in pairs by covering the group boundary, and generates the second-layer ciphertext group as the final ciphertext;
(5)解密方对两两第2层密文分组实施联合解密,生成第1层密文分组;(5) The decryption party performs joint decryption on the second-layer ciphertext packets to generate the first-layer ciphertext packets;
(6)解密方对两两第1层密文分组实施联合解密,将解密结果作为最终的数据明文。(6) The decryption party implements joint decryption on pairs of first-layer ciphertext groups, and uses the decryption result as the final data plaintext.
对以上步骤(1)中,选择DES、3DES、IDEA、AES、RC5、Blowfish、或者Rijadeal。For the above step (1), select DES, 3DES, IDEA, AES, RC5, Blowfish, or Rijadeal.
对以上步骤(2)中,“压盖”是指对两个相邻明文分组实施如下操作:对前一个分组的后一半内容和后一个分组的前一半内容进行联合加密从而生成一个第1层密文分组,或者,对两个相邻的第1层密文分组实施如下操作:对前一个分组的后一半内容和后一个分组的前一半内容进行联合加密从而生成一个第2层密文分组。In the above step (2), "capping" refers to performing the following operations on two adjacent plaintext groups: jointly encrypt the second half of the previous group and the first half of the next group to generate a layer 1 Ciphertext grouping, or, perform the following operations on two adjacent layer 1 ciphertext groups: jointly encrypt the second half of the previous grouping and the first half of the next grouping to generate a layer 2 ciphertext grouping .
对以上步骤(1)中,所需的加解密素材类型有多个,包括链接操作模式、初始向量以及对称密钥,使用本方法前,加解密双方要选择一种已有方法来共享所需的加解密素材。For the above step (1), there are multiple types of encryption and decryption materials required, including link operation mode, initial vector, and symmetric key. Before using this method, both encryption and decryption parties should choose an existing method to share the required Encryption and decryption materials.
对以上步骤(2)中,可将单长分组的长度可以定义为32位、64位或128位,对应的倍长分组长度则为64位、128位或256位。For the above step (2), the length of the single-length packet can be defined as 32 bits, 64 bits or 128 bits, and the length of the corresponding double-length packet is 64 bits, 128 bits or 256 bits.
对以上步骤(3)中,加密方对两个相邻的明文分组实施联合加密,生成一个第1层密文分组,对后续明文分组也按此法操作直至所有明文被加密。In the above step (3), the encryption party implements joint encryption on two adjacent plaintext groups to generate a layer 1 ciphertext group, and operates in the same way for subsequent plaintext groups until all plaintexts are encrypted.
对以上步骤(4)中,加密方按照如下方式对两个相邻的第1层密文分组实施加密从而生成一个第2层的密文分组:使得该第2层密文分组压盖第1层两个密文分组之间的边界,其结果,第2层密文分组的中点对准第1层两个密文分组的边界。In the above step (4), the encryption party encrypts two adjacent first-level ciphertext groups in the following manner to generate a second-level ciphertext group: making the second-level ciphertext group overwrite the first-level ciphertext group As a result, the midpoint of the layer 2 ciphertext block is aligned with the boundary between the two layer 1 ciphertext blocks.
对以上步骤(5)中,解密方将两个相邻的第2层密文分组实施联合解密,生成一个第1层密文分组,对后续的第2层密文分组也按此法操作直至所有第2层密文分组被解密。In the above step (5), the decryption party performs joint decryption on two adjacent layer 2 ciphertext groups to generate a layer 1 ciphertext group, and operates in the same way for subsequent layer 2 ciphertext groups until All layer 2 ciphertext blocks are decrypted.
对以上步骤(6)中,解密方将两个相邻的第1层密文分组实施联合解密,生成一个明文分组,对后续的第1层密文分组也按此法操作直至所有第1层密文分组被解密。In the above step (6), the decryption party implements joint decryption on two adjacent first-level ciphertext groups to generate a plaintext group, and operates in the same way for subsequent first-level ciphertext groups until all first-level ciphertext groups The ciphertext block is decrypted.
下文从使用前提、概念符号、核心方法、方法总结四个方面说明本发明。The following describes the present invention from four aspects: premise, concept symbol, core method and method summary.
1、使用前提1. Prerequisites
(1)本发明是一个复合型的分组加密算法,使用两种现有的针对单长分组与倍长分组的密码算法(单长分组与倍长分组的含义见概念符号一节)。(1) The present invention is a composite block encryption algorithm, which uses two existing encryption algorithms for single-length block and double-length block (see the concept symbol section for the meaning of single-length block and double-length block).
(2)加密方与解密方事先通过安全的通道共享两个密钥Ks与Kd,其中Ks与Kd为单长分组与倍长分组的密钥。(2) The encrypting party and the decrypting party share two keys K s and K d through a secure channel in advance, where K s and K d are keys for single-length blocks and double-length blocks.
(3)加密方与解密方事先通过安全的通道共享两个初始向量IVs与IVd,其中IVs与IVd为单长分组与倍长分组的初始向量。(3) The encrypting party and the decrypting party share two initial vectors IV s and IV d through a secure channel in advance, where IV s and IV d are initial vectors for single-length packets and double-length packets.
(4)加密方与解密方事先约定一种密文分组之间的链接操作模式。(4) The encrypting party and the decrypting party agree in advance on a link operation mode between ciphertext packets.
(5)使用本发明时,数据明文的最小长度为64位。当数据明文长度为64位时,对应的单长分组与倍长分组的长度分别为32位与64位。(5) When using the present invention, the minimum length of data plaintext is 64 bits. When the data plaintext length is 64 bits, the lengths of the corresponding single-length packets and double-length packets are 32 bits and 64 bits respectively.
(6)当数据明文的长度不是单长分组长度的整数倍时,应当采用加解密双方约定好的填充方法对明文进行填充,使填充后的数据明文长度等于单长分组的倍数。(6) When the length of the data plaintext is not an integer multiple of the length of a single-length packet, the plaintext shall be filled with the filling method agreed upon by the encryption and decryption parties, so that the length of the filled data plaintext is equal to the multiple of the single-length packet.
2、概念符号2. Concept symbols
(1)概念(1) concept
分组尺寸:本发明采用两层加密的方法,其中第2层加密生成的每一个密文分组要压盖第1层两个相邻密文分组的边界,从而实现高强度的机密性。两层与交叠加密需要引入两种分组长度,即单长分组与倍长分组。如果单长分组为m比特,则倍长分组为2m比特。Group size: The present invention adopts a two-layer encryption method, wherein each ciphertext group generated by the second layer of encryption must cover the boundary of two adjacent ciphertext groups in the first layer, thereby achieving high-strength confidentiality. Two-layer and overlapping encryption need to introduce two packet lengths, namely, single-length packets and double-length packets. If the single-length packet is m bits, the double-length packet is 2m bits.
层:本发明需要进行两层加密,相应地将数据分组分为三个层,即第0层分组、第1层密文分组、第2组密文分组。对所有第0层明文分组加密后生成的分组称为第1层密文分组,对所有第1层密文分组加密后生成的密文分组称为第2层密文分组。Layers: The present invention requires two layers of encryption, and the data packets are divided into three layers accordingly, namely the 0th layer grouping, the first layer ciphertext grouping, and the second group ciphertext grouping. The group generated after encrypting all layer 0 plaintext groups is called layer 1 ciphertext group, and the ciphertext group generated after encrypting all layer 1 ciphertext groups is called layer 2 ciphertext group.
交叠:指的是第2层密文分组压盖第1层两个密文分组之间的边界,具体地,使得第2层密文分组的中点对准第1层两个密文分组的边界。Overlap: Refers to the layer 2 ciphertext block covering the boundary between the first layer two ciphertext blocks, specifically, making the midpoint of the second layer ciphertext block align with the first layer two ciphertext blocks borders.
(2)符号(2) Symbol
表1符号约定表Table 1 Symbol convention table
(3)核心方法(3) Core method
本发明包含确定分组尺寸长度与密码算法、确定密文分组链接操作模式、两层分组加密、两层分组解密四个核心内容。The present invention includes four core contents of determining the size and length of the group and the encryption algorithm, determining the operation mode of the ciphertext group link, two-layer group encryption and two-layer group decryption.
①确定单长分组与倍长分组的尺寸长度以及相应的密码算法。① Determine the size and length of single-length blocks and double-length blocks and the corresponding cryptographic algorithms.
单长分组可以选择32位、64位或128位。当单长分组尺寸确定后,则倍长分组的尺寸也就确定了,即倍长分组的尺寸是单长分组的两倍。对单长分组与倍长分组可以选择任意一种满足需求的密码算法,如表2所示。Single-length packets can choose 32-bit, 64-bit or 128-bit. When the size of the single-length packet is determined, the size of the double-length packet is also determined, that is, the size of the double-length packet is twice that of the single-length packet. For single-length blocks and double-length blocks, any cryptographic algorithm that meets the requirements can be selected, as shown in Table 2.
例如,当单长/倍长分组尺寸为64/128时,可选择DES/AES分别作为单长/倍长分组的密码算法。若单长/倍长分组尺寸为128/256,可选择AES/Rijadeal分别作为单长/倍长分组的密码算法。For example, when the single-length/double-length block size is 64/128, DES/AES can be selected as the encryption algorithm for the single-length/double-length block respectively. If the single-length/double-length block size is 128/256, AES/Rijadeal can be selected as the encryption algorithm for the single-length/double-length block respectively.
下文以单长分组为64位,而倍长分组是128位为例进行说明。In the following, a single-length packet is 64 bits, and a double-length packet is 128 bits as an example for illustration.
表2密码算法选择表Table 2 Encryption Algorithm Selection Table
②密文分组链接操作模式②Ciphertext group link operation mode
本发明可采用CBC、OFB、CFB、CTR中任意一种分组链接操作模式。由于存在两种不同长度的密文分组,故需要对相邻但长度不同的两个密文分组的链接向量进行匹配变换。下文以CBC操作模式为例,对两个密文分组的链接向量的匹配变换进行说明,具体分为两种情况:The present invention can adopt any one grouping link operation mode among CBC, OFB, CFB and CTR. Since there are two ciphertext blocks with different lengths, it is necessary to perform matching transformation on the link vectors of two adjacent ciphertext blocks with different lengths. The following takes the CBC operation mode as an example to illustrate the matching transformation of the link vectors of two ciphertext groups, which can be divided into two cases:
情况1:单长分组在先,倍长分组在后。Case 1: Single-length packets come first, followed by double-length packets.
此时采用“简单扩展”的方法将在先的单长密文分组扩展至倍长分组,并作为后面倍长分组加解密所需的链接向量具体操作为:将一个单长密文分组复制一份,然后再进行合并,即:At this time, the "simple extension" method is used to expand the previous single-length ciphertext block to a double-length block, and use it as the link vector required for encryption and decryption of the subsequent double-length block The specific operation is: copy a single-length ciphertext group, and then merge it, that is:
情况2:倍长分组在先,单长分组在后。Case 2: Double-length packets come first, followed by single-length packets.
此时采用“简单压缩”的方法将在先的倍长密文分组压缩至单长分组,并作为后面单长分组加解密所需的链接向量具体操作为:将一个倍长密文分组的前一半[0..63]与后一半[64..127]进行异或,即:At this time, the "simple compression" method is used to compress the previous double-length ciphertext block into a single-length block, and use it as the link vector required for encryption and decryption of the subsequent single-length block The specific operation is: XOR the first half [0..63] and the second half [64..127] of a double-length ciphertext group, namely:
③两层分组加密③Two layers of block encryption
将数据明文按单长分组长度划分后生成的明文分组序列记为p=<p0,p1,p2,…>,其中pi是明文序列中第i个单长明文分组。对p的加密过程分为两层。首先使用密钥K=(Ks,Kd)和初始向量IV=(IVs,IVd)的对第0层明文分组序列p进行第1层加密,生成第1层密文分组序列再对第1层密文分组序列c进行交叠加密,生成最终的第2层密文分组序列 The plaintext packet sequence generated by dividing the data plaintext according to the single-length packet length is denoted as p=<p 0 ,p 1 ,p 2 ,…>, where p i is the i-th single-length plaintext packet in the plaintext sequence. The encryption process of p is divided into two layers. Firstly, use the key K=(K s , K d ) and the initial vector IV=(IV s , IV d ) to perform layer 1 encryption on the layer 0 plaintext block sequence p to generate the layer 1 ciphertext block sequence Then perform overlapping encryption on the first-layer ciphertext block sequence c to generate the final second-layer ciphertext block sequence
在对明文进行分组之后,明文分组的个数分为偶数与奇数两种情况,下面对这两种情况分别进行说明。After the plaintext is grouped, the number of plaintext groups is divided into two cases of even number and odd number, and the two cases will be described respectively below.
情况1——明文分组的个数为偶数Case 1 - the number of plaintext packets is even
设明文分组序列为p=<p0,p1,p2,…,pn-1>,此时n为偶数。对该明文序列两两分组进行第一次加密后,生成了第1层密文分组序列再对第1层密文分组序列进行一次交叠加密后生成第2层密文分组序列 Assume that the plaintext packet sequence is p=<p 0 ,p 1 ,p 2 ,...,p n-1 >, and n is an even number at this time. After the first encryption of the plaintext sequence in pairs, a layer 1 ciphertext block sequence is generated Then perform overlapping encryption on the first-layer ciphertext block sequence to generate the second-layer ciphertext block sequence
第1层的加密是针对明文分组,具体地,将两个相邻的单长明文分组<pj,pj+1|j=0,2,4,…,n-2>作为倍长分组密码算法的输入,最终得到第1层密文分组序列其中按如下步骤计算:先将单长明文分组p0和p1并置,再与初始向量IVd异或,最后用倍长加密算法加密,即:The encryption of the first layer is for plaintext packets, specifically, two adjacent single-length plaintext packets <p j ,p j+1 |j=0,2,4,…,n-2> are used as double-length packets The input of the cryptographic algorithm, and finally get the first layer ciphertext block sequence in Calculate according to the following steps: first, juxtapose the single-length plaintext group p 0 and p 1 , then XOR with the initial vector IV d , and finally encrypt with the double-length encryption algorithm, namely:
对后续明文分组仿照此法操作,得到相应的第1层密文分组即:Follow this method for the subsequent plaintext grouping to obtain the corresponding layer 1 ciphertext grouping which is:
第2层加密采用交叠分组的方式,具体地,先将的前一半[0..63]与初始向量IVs进行异或,再使用单长的加密算法进行加密,即Layer 2 encryption uses overlapping grouping, specifically, first The first half of [0..63] is XORed with the initial vector IV s , and then encrypted with a single-length encryption algorithm, that is
对后续明文分组仿照此法操作,得到相应的第2层密文分组即:Follow this method for the subsequent plaintext grouping to obtain the corresponding layer 2 ciphertext grouping which is:
1≤i≤n/2-11≤i≤n/2-1
第2层的最后一个密分分组计算:The last secret block of layer 2 calculate:
如果将本发明的方法用于通信场合,可采用“随加随发”方式,具体地,只要生成第2层密文的条件成立,就立即生成该第2层密文分组,然后立即向解密方发送该密第2层密文。该方式能显著提高数据发送的效率。If the method of the present invention is used in communication occasions, the method of "adding and sending" can be adopted. Specifically, as long as the conditions for generating the second layer of ciphertext are established, the second layer of ciphertext grouping is immediately generated, and then immediately sent to the decryption The party sends the encrypted layer 2 ciphertext. This method can significantly improve the efficiency of data transmission.
情况2——明文分组的个数为奇数Case 2 - the number of plaintext packets is odd
设明文分组序列为p=<p0,p1,p2,…,pn-1,pn>,此时n为偶数。对该明文序列两两分组进行第一次加密后,生成了第1层密文分组序列再对第1层密文分组序列进行一次交叠加密后生成第2层密文分组序列 Assume that the plaintext packet sequence is p=<p 0 , p 1 , p 2 ,..., p n-1 , p n >, and n is an even number at this time. After the first encryption of the plaintext sequence in pairs, a layer 1 ciphertext block sequence is generated Then perform overlapping encryption on the first-layer ciphertext block sequence to generate the second-layer ciphertext block sequence
第1层的加密是针对明文分组,具体地,将两个相邻的单长明文分组<pj,pj+1|j=0,2,4,…,n-2>作为倍长分组密码算法的输入,最终得到第1层密文分组序列其中按如下步骤计算:先将单长明文分组p0和p1并置,再与初始向量IVd异或,最后用倍长加密算法加密,即:The encryption of the first layer is for plaintext packets, specifically, two adjacent single-length plaintext packets <p j ,p j+1 |j=0,2,4,…,n-2> are used as double-length packets The input of the cipher algorithm, and finally get the first layer ciphertext block sequence in Calculate according to the following steps: First, juxtapose the single-length plaintext group p 0 and p 1 , then XOR with the initial vector IV d , and finally encrypt with the double-length encryption algorithm, namely:
对后续明文分组仿照此法操作,得到相应的第1层密文分组即:Follow this method for the subsequent plaintext grouping to obtain the corresponding layer 1 ciphertext grouping which is:
第2层加密采用交叠分组的方式,具体地,先将的前一半[0..63]与初始向量IVs进行异或,再使用单长的加密算法进行加密,即Layer 2 encryption uses overlapping grouping, specifically, first The first half of [0..63] is XORed with the initial vector IV s , and then encrypted with a single-length encryption algorithm, that is
对后续明文分组仿照此法操作,得到相应的第2层密文分组即:Follow this method for the subsequent plaintext grouping to obtain the corresponding layer 2 ciphertext grouping which is:
其中, in,
④两层分组解密④ Two-layer packet decryption
采用本发明得到的最终密文分组(即第2层密文分组)序列记为与加密时分为两层相对应,对U的解密过程也分为两层,首先使用密钥K=(Ks,Kd)和初始向量IV=(IVs,IVd)对第2层密文分组序列U进行第1层解密,生成第1层密文分组序列再对第1层密文分组序列u进行第2层解密,生成最终的分组序列q=<q0,q1,q2,…>。再正常情况下,解密方解密后的分组序列q应该等于加密方加密之前的明文分组序列p。The sequence of the final ciphertext grouping (i.e. the second layer of ciphertext grouping) obtained by the present invention is denoted as Corresponding to the two-layer encryption process, the decryption process for U is also divided into two layers. First, use the key K=(K s ,K d ) and the initial vector IV=(IV s ,IV d ) to encrypt the second layer. The text packet sequence U is decrypted at the first layer to generate the first layer ciphertext block sequence Then perform second-layer decryption on the first-layer ciphertext block sequence u to generate the final block sequence q=<q 0 , q 1 , q 2 , . . . >. Under normal circumstances, the packet sequence q decrypted by the decryption party should be equal to the plaintext packet sequence p before encryption by the encryption party.
在解密之前,密文分组序列U的第一个分组是单长分组,其后是若干个倍长分组,最后一个分组有单长与倍长两种不同情况,下面对这两种情况分别进行说明。Before decryption, the first block of the ciphertext block sequence U is a single-length block, followed by several double-length blocks, and the last block has two different cases of single-length and double-length. The following two cases are respectively Be explained.
情况1——U的最后一个分组为单长分组Case 1 - the last packet of U is a single-length packet
记第1层解密操作后的所有密文分组序列为 其中的每个按如下方法计算:Note that all ciphertext block sequences after the first layer decryption operation are each of them Calculate as follows:
记第2层解密操作后的单长分组序列为q=<q0,q1,q2,…,qn-1>,其中的每个qi按如下方法计算:Note that the single-length packet sequence after layer 2 decryption operation is q=<q 0 ,q 1 ,q 2 ,…,q n-1 >, and each q i in it is calculated as follows:
由于以上两层解密都是针对倍长分组,因此,初始向量与各个链接向量的长度都等于倍长分组的长度,不存在链接向量长度的切换问题。Since the above two layers of decryption are all for double-length packets, the lengths of the initial vector and each link vector are equal to the length of the double-length packet, and there is no problem of switching the length of link vectors.
情况2——U的最后一个分组为倍长分组Case 2 - the last packet of U is a double-length packet
记第1层解密操作后的所有密文分组序列为 其中的每个按如下方法计算:Note that all ciphertext block sequences after the first layer decryption operation are each of them Calculate as follows:
由于以上解密都是针对倍长分组进行解密,因此,不存在链接向量长度的切换问题。Since the above decryption is all for double-length packets, there is no problem of switching the length of the link vector.
u中最后一个密文分组按如下方法计算:The last ciphertext block in u Calculate as follows:
由于是单长分组,因此,计算时所需的链接向量长度也是单长分组的长度,因此,需要进行链接向量长度切换。because is a single-length packet, therefore, the calculation The required length of the link vector is also the length of a single-length packet, so it is necessary to switch the length of the link vector.
记第2层解密操作后的单长分组序列为q=<q0,q1,q2,…qn>,其中的每个qi按如下方法计算:Note that the single-length packet sequence after the second-layer decryption operation is q=<q 0 , q 1 , q 2 ,...q n >, and each q i in it is calculated as follows:
由于qn是单长分组,因此,计算qn时所需的链接向量长度也是单长分组的长度,因此,需要进行链接向量长度切换。Since q n is a single-length packet, the length of the link vector required for calculating q n is also the length of the single-length packet, and therefore, the length of the link vector needs to be switched.
(4)方法总结(4) Method summary
①本发明特点。① Features of the present invention.
本发明具有以下三个特点。The present invention has the following three characteristics.
第一,对分组采用了两层交叠加密,其结果是,在不知晓本方法前提下,即使密码分析者获得了加解密所得到的密钥K=(Ks,Kd),也只能通过暴力方法得到第1层密文分组,不可能得到最终的数据明文。First, two layers of overlapping encryption are used for the packet. As a result, without knowing this method, even if the cryptanalyst obtains the key K=(K s , K d ) obtained by encryption and decryption, only It is impossible to obtain the final data plaintext if the first layer of ciphertext grouping can be obtained by brute force.
第二,采用了随加随发方式,其结果是,提高了通信的效率。Second, the method of adding and sending is adopted, as a result, the efficiency of communication is improved.
③适用场合③ Applicable occasions
本发明适用于对数据具有以下机密性要求的场合:The present invention is applicable to occasions that have the following confidentiality requirements for data:
第一,强安全性的保密通信。例如总部与分部之间的安全通信、总部与合作伙伴之间的安全通信,当然也包括个人与个人之间通过安全通道的通信。First, confidential communication with strong security. For example, secure communications between headquarters and divisions, secure communications between headquarters and partners, and of course communications between individuals through secure channels.
第二,强安全性的敏感数据存储。例如U盘加密、硬盘加密、云存储加密等数据存储设备安全。Second, sensitive data storage with strong security. For example, data storage devices such as U disk encryption, hard disk encryption, and cloud storage encryption are safe.
④实现提示④ Implementation Tips
当所选择的单长分组与倍长分组密码算法有多种长度的密钥时,应尽可能选择较长的密钥作为本发明的两个密钥Ks与Kd,以加强安全性。When the selected single-length block and double-length block cipher algorithms have keys of various lengths, longer keys should be selected as the two keys K s and K d of the present invention to enhance security.
其次,两个密钥Ks与Kd和两个初始向量IVs与IVd必须通过安全通道使双方共享。然而通过安全通道共享的方法不属于本发明的内容。Secondly, two keys K s and K d and two initial vectors IV s and IV d must be shared by both parties through a secure channel. However, the method of sharing through the secure channel does not belong to the content of the present invention.
发明特点Invention Features
第一,对分组采用了两层交叠加密,其结果是,在不知晓本方法前提下,即使密码分析者得到加解密的密钥,通过暴力破解也不可能得到最终的数据明文。First, two layers of overlapping encryption are used for the packet. As a result, without knowing this method, even if the cryptanalyst obtains the encryption and decryption keys, it is impossible to obtain the final data plaintext through brute force cracking.
第二,采用了随加随发方式,其结果是,提高了通信的效率。Second, the method of adding and sending is adopted, as a result, the efficiency of communication is improved.
附图说明Description of drawings
图1为本发明的安全模型;Fig. 1 is security model of the present invention;
图2为加密流程图;Fig. 2 is encryption flowchart;
图3为解密流程图。Figure 3 is a flow chart of decryption.
具体实施方式detailed description
1、加密流程与实现方法1. Encryption process and implementation method
具体的加密过程如图2所示,对于明文分组p,以单长分组的长度尺寸为单位计算其分组个数n,并初始化三个变量,i=0,c存放第1层的密文分组,C存放第2层的密文分组。其中变量i是用于密文分组的数组的下标变量,因为数组的第一个元素以及第一个分组的编号都是从0开始,所以给其初始值为0。数组p为存放明文分组的数组,数组里的每一元素都存放明文的一个单长的分组,而c则存放第1层的密文分组的数组,每一个元素存放第1层密文的一个密文分组,C则存放第2层的密文分组的数组,每一个元素存放第2层密文的一个密文分组。The specific encryption process is shown in Figure 2. For the plaintext packet p, the number of packets n is calculated in units of the length of the single-length packet, and three variables are initialized, i=0, and c stores the ciphertext packet of the first layer , C stores the ciphertext grouping of the second layer. The variable i is the subscript variable of the array used for ciphertext grouping, because the first element of the array and the number of the first grouping start from 0, so the initial value is 0. Array p is an array storing plaintext groups, each element in the array stores a single-length group of plaintext, and c stores an array of ciphertext groups of the first layer, and each element stores a ciphertext of the first layer The ciphertext group, C stores the array of the ciphertext group of the second layer, and each element stores a ciphertext group of the second layer ciphertext.
整个加密过程不管是单长分组的个数是奇数,还是偶数,前面部分的分组加密过程是一样的,只有最后一次加密有差异,因此,可以把整个的加密过程分成两个部分。通过i来进行区分,如果i<n/2,则进入的是前一部分分组的加密,否则就进入最后的明文分组加密。Regardless of whether the number of single-length blocks is odd or even, the entire encryption process is the same as the previous block encryption process, only the last encryption is different. Therefore, the entire encryption process can be divided into two parts. Distinguish by i, if i<n/2, then enter the encryption of the previous part of the packet, otherwise enter the final plaintext packet encryption.
先处理p0与p1两个明文分组的加密,首先需要判断i是否为0,判断的条件为真则需要加密p0与p1两个明文分组,具体的过程为,是由前面两个单长的明文分组p0与p1经过与倍长加密算法的初始向量IVd异或后通过倍长的加密算法得到的,即:First process the encryption of the two plaintext packets p 0 and p 1. First, you need to judge whether i is 0. If the judgment condition is true, you need to encrypt the two plaintext packets p 0 and p 1. The specific process is as follows: It is obtained from the previous two single-length plaintext packets p 0 and p 1 through the double-length encryption algorithm after XOR with the initial vector IV d of the double-length encryption algorithm, namely:
然后再进行第2层的密文加密,算出是由的前64位先与初始向量IVs进行异或后再使用单长的加密算法进行加密得到,即:Then carry out the ciphertext encryption of the second layer, and calculate By The first 64 bits of are first XORed with the initial vector IV s and then encrypted using a single-length encryption algorithm, namely:
当i<n/2的所有单长明文分组的加密都是一样的,其中第2i个与第2i+1个单长的明文分组加密具体操作为:首先进行第1层的密文加密,第1层后续的密文分组都是采用同样的方法进行加密,即:When the encryption of all single-length plaintext blocks of i<n/2 is the same, the specific operation of encrypting the 2i-th and 2i+1-th single-length plaintext blocks is as follows: first, encrypt the ciphertext of the first layer, and then Layer 1 subsequent ciphertext grouping They are all encrypted in the same way, namely:
第2层的加密密文则是使用第1层密文分组的的后64位与的前64位合并后先与异或后再通过倍长的加密算法加密得到,即:Layer 2 encrypted ciphertext are grouped using layer 1 ciphertext The last 64 bits with The first 64 bits are merged first with XOR and then encrypted by a double-length encryption algorithm, namely:
当变量i=n/2时,此时就进入了最后一个单长分组或最后一次的加密,其过程为先用分组的个数n是否能被2整除,如果能整除,说明现在加密的是偶数个单长明文分组,否则,说明是奇数个单长明文分组。如果为偶数个分组,则使用单长加密算法计算即:When the variable i=n/2, the last single-length packet or the last encryption is entered at this time. The process is whether the number n of packets can be divisible by 2. If it can be divisible, it means that the encryption is now An even number of single-length plaintext packets, otherwise, an odd number of single-length plaintext packets. If it is an even number of packets, use the single-length encryption algorithm to calculate which is:
如果是奇数单长分组,最后一个第1层密文分组则是由最后一个单长的明文分组pn经过单长分组加密算法加密得到的,即:If it is an odd single-length packet, the last layer 1 ciphertext packet It is obtained by encrypting the last single-length plaintext packet p n through a single-length block encryption algorithm, namely:
而第2层的最后为And the end of layer 2 is
从而完成所有的加密操作。Thus completing all encryption operations.
2、解密流程与实现方法2. Decryption process and implementation method
整个解密的流程如图3所示,首先初始化几个变量:i、Ui、ui、qi。变量i是分组的序号,变量Ui为接收到的对方的密文,ui存放第一次解密的密文,qi存放的是解密之后的明文。The entire decryption process is shown in Figure 3. First, several variables are initialized: i, U i , u i , q i . The variable i is the serial number of the packet, the variable U i is the received ciphertext of the other party, u i stores the ciphertext decrypted for the first time, and q i stores the decrypted plaintext.
首先判断i是否小于n/2,如果条件为真,则收到对方发过来的密文不是最后一次的密文分组,否则就是最后一次加密的密文分组。First judge whether i is less than n/2. If the condition is true, the ciphertext received from the other party is not the last ciphertext group, otherwise it is the last encrypted ciphertext group.
刚开始解密时,i是为0,所以首先要解密的是收到前两个密文分组,从收到的前面两个密文分组中解密出即:At the beginning of decryption, i is 0, so the first thing to decrypt is to receive the first two ciphertext packets, and decrypt the first two ciphertext packets from the received first two ciphertext packets. which is:
其中IVd为倍长解密算法的初始向量。后续的解密是一样的,直到i<n/2,即:Among them, IV d is the initial vector of the double-length decryption algorithm. Subsequent decryption is the same until i<n/2, ie:
变量i自增至n/2时,也就意味着最后解密操作,首先判断接收到的密文U的分组长度是否为128位,条件为真则说明是奇数个单长分组进行解密,否则为偶数个单长分组的解密。如果是奇数个单长分组的解密,则先解出密文分组即:When the variable i increases to n/2, it means the final decryption operation. First, judge whether the packet length of the received ciphertext U is 128 bits. If the condition is true, it means that an odd number of single-length packets is decrypted, otherwise Decryption of an even number of single-length packets. If it is the decryption of an odd number of single-length blocks, the ciphertext block is first solved which is:
再通过可以解密出qn,即:then pass q n can be decrypted, namely:
如果是偶数个单长分组的解密,则先进行第一次解密操作,即:If it is the decryption of an even number of single-length packets, the first decryption operation is performed first, that is:
再通过进行第二次的解密得到最后两个明文分组,即:then pass Perform the second decryption to get the last two plaintext packets, namely:
从而完成整个的解密操作。Thereby completing the entire decryption operation.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710026432.3A CN107070637A (en) | 2017-01-13 | 2017-01-13 | A kind of data encryption/decryption method of overlapping packet |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710026432.3A CN107070637A (en) | 2017-01-13 | 2017-01-13 | A kind of data encryption/decryption method of overlapping packet |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107070637A true CN107070637A (en) | 2017-08-18 |
Family
ID=59598512
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710026432.3A Pending CN107070637A (en) | 2017-01-13 | 2017-01-13 | A kind of data encryption/decryption method of overlapping packet |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107070637A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108989287A (en) * | 2018-06-13 | 2018-12-11 | 平安科技(深圳)有限公司 | encryption method, device, terminal device and storage medium |
CN111464564A (en) * | 2020-05-08 | 2020-07-28 | 郑州信大捷安信息技术股份有限公司 | Data high-speed encryption and decryption method and device based on symmetric cryptographic algorithm |
CN112769875A (en) * | 2021-04-08 | 2021-05-07 | 中国测绘科学研究院 | GNSS reference station data transmission and deformation monitoring and early warning method and system |
CN113794551A (en) * | 2021-09-13 | 2021-12-14 | 北京江南天安科技有限公司 | Equal-length block encryption method and ciphertext decryption method for long message data |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5511123A (en) * | 1994-08-04 | 1996-04-23 | Northern Telecom Limited | Symmetric cryptographic system for data encryption |
CN1366245A (en) * | 2001-01-18 | 2002-08-28 | 深圳市中兴集成电路设计有限责任公司 | Packet encryting chip and its high-speed data encryption-decryption method |
US20050008162A1 (en) * | 2003-06-19 | 2005-01-13 | International Business Machines Corporation | System and method for encrypting and verifying messages using three-phase encryption |
CN1677921A (en) * | 2004-03-31 | 2005-10-05 | 华为技术有限公司 | The Method of Realizing Data Encryption Through Programmable Device |
CN102148798A (en) * | 2010-02-04 | 2011-08-10 | 上海果壳电子有限公司 | Method for efficiently, parallelly and safely encrypting and decrypting high-capacity data packets |
CN102546151A (en) * | 2012-03-22 | 2012-07-04 | 山东泰信电子有限公司 | Data encryption and decryption method |
CN102624708A (en) * | 2012-02-23 | 2012-08-01 | 浙江工商大学 | An Efficient Data Encryption, Update and Access Control Method for Cloud Storage |
US20150010142A1 (en) * | 2013-07-04 | 2015-01-08 | National Cheng Kung University | Method for authenticated encryption and decryption |
CN106301762A (en) * | 2016-08-09 | 2017-01-04 | 杭州迪普科技有限公司 | The method and device of data deciphering |
-
2017
- 2017-01-13 CN CN201710026432.3A patent/CN107070637A/en active Pending
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5511123A (en) * | 1994-08-04 | 1996-04-23 | Northern Telecom Limited | Symmetric cryptographic system for data encryption |
CN1366245A (en) * | 2001-01-18 | 2002-08-28 | 深圳市中兴集成电路设计有限责任公司 | Packet encryting chip and its high-speed data encryption-decryption method |
US20050008162A1 (en) * | 2003-06-19 | 2005-01-13 | International Business Machines Corporation | System and method for encrypting and verifying messages using three-phase encryption |
CN1820448A (en) * | 2003-06-19 | 2006-08-16 | 国际商业机器公司 | System and method for encrypting and verifying messages using three-phase encryption |
CN1677921A (en) * | 2004-03-31 | 2005-10-05 | 华为技术有限公司 | The Method of Realizing Data Encryption Through Programmable Device |
CN102148798A (en) * | 2010-02-04 | 2011-08-10 | 上海果壳电子有限公司 | Method for efficiently, parallelly and safely encrypting and decrypting high-capacity data packets |
CN102624708A (en) * | 2012-02-23 | 2012-08-01 | 浙江工商大学 | An Efficient Data Encryption, Update and Access Control Method for Cloud Storage |
CN102546151A (en) * | 2012-03-22 | 2012-07-04 | 山东泰信电子有限公司 | Data encryption and decryption method |
US20150010142A1 (en) * | 2013-07-04 | 2015-01-08 | National Cheng Kung University | Method for authenticated encryption and decryption |
CN106301762A (en) * | 2016-08-09 | 2017-01-04 | 杭州迪普科技有限公司 | The method and device of data deciphering |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108989287A (en) * | 2018-06-13 | 2018-12-11 | 平安科技(深圳)有限公司 | encryption method, device, terminal device and storage medium |
CN108989287B (en) * | 2018-06-13 | 2020-11-27 | 平安科技(深圳)有限公司 | Encryption method, device, terminal equipment and storage medium |
CN111464564A (en) * | 2020-05-08 | 2020-07-28 | 郑州信大捷安信息技术股份有限公司 | Data high-speed encryption and decryption method and device based on symmetric cryptographic algorithm |
CN112769875A (en) * | 2021-04-08 | 2021-05-07 | 中国测绘科学研究院 | GNSS reference station data transmission and deformation monitoring and early warning method and system |
CN112769875B (en) * | 2021-04-08 | 2022-08-12 | 中国测绘科学研究院 | Method and system for transmission of GNSS reference station data and deformation monitoring and early warning |
CN113794551A (en) * | 2021-09-13 | 2021-12-14 | 北京江南天安科技有限公司 | Equal-length block encryption method and ciphertext decryption method for long message data |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Hong et al. | Related-key rectangle attacks on reduced versions of SHACAL-1 and AES-192 | |
CN104022872B (en) | Data encryption method | |
EP2197144A1 (en) | Methods and devices for a chained encryption mode | |
Agrawal et al. | A modified approach for symmetric key cryptography based on blowfish algorithm | |
CN102664740B (en) | Remote-authorization-based bidding document encryption and decryption method | |
TWI700915B (en) | A mixing double encryption and decryption system | |
CN106506518A (en) | The encryption/decryption module of big data safe transmission | |
CN1323507C (en) | The Processing Method of Short Packet in Block Encryption Algorithm | |
CN107070637A (en) | A kind of data encryption/decryption method of overlapping packet | |
Mewada et al. | Exploration of efficient symmetric AES algorithm | |
Prajwal et al. | User defined encryption procedure for IDEA algorithm | |
Mahalakshmi et al. | Image encryption method using differential expansion technique, AES and RSA algorithm | |
CN104579645B (en) | Key updating method based on AES encryption system | |
CN107147626B (en) | Encrypted file transmission method combining AES algorithm and ElGamal algorithm | |
CN106973061B (en) | An Outgoing File Encryption Method Based on AES Based on Reversible Logic Circuit | |
Ojha et al. | An Innovative Approach to Enhance the Security of Data Encryption Scheme | |
TWI705685B (en) | A double encryption and decryption system | |
CN114553397A (en) | Encryption optimization method and device for SM4 block cipher algorithm | |
Huang et al. | Real-time mode hopping of block cipher algorithms for mobile streaming | |
Dilna et al. | Area optimized and high throughput AES algorithm based on permutation data scramble approach | |
Innocent et al. | Secure two-party computation with AES-128: Generic approach and exploiting specific properties of functions approach | |
ايناس طارق et al. | Image encryption and decryption using CAST-128 with proposed adaptive key | |
CN110278206B (en) | A BWE Encryption Algorithm Based on Double Private Keys | |
Wee et al. | An FPGA network architecture for accelerating 3DES-CBC | |
Innocent et al. | Secure two-party computation: Generic approach and exploiting specific properties of functions approach |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170818 |
|
RJ01 | Rejection of invention patent application after publication |