WO2012071717A1 - 一种数据加解密方法及装置 - Google Patents

一种数据加解密方法及装置 Download PDF

Info

Publication number
WO2012071717A1
WO2012071717A1 PCT/CN2010/079319 CN2010079319W WO2012071717A1 WO 2012071717 A1 WO2012071717 A1 WO 2012071717A1 CN 2010079319 W CN2010079319 W CN 2010079319W WO 2012071717 A1 WO2012071717 A1 WO 2012071717A1
Authority
WO
WIPO (PCT)
Prior art keywords
encryption
data
function
encryption key
plaintext
Prior art date
Application number
PCT/CN2010/079319
Other languages
English (en)
French (fr)
Inventor
刘慧�
Original Assignee
北京卓微天成科技咨询有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 北京卓微天成科技咨询有限公司 filed Critical 北京卓微天成科技咨询有限公司
Publication of WO2012071717A1 publication Critical patent/WO2012071717A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic 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/0618Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic 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/065Encryption by serially and continuously modifying data stream elements, e.g. stream cipher systems, RC4, SEAL or A5/3
    • H04L9/0656Pseudorandom key sequence combined element-for-element with data sequence, e.g. one-time-pad [OTP] or Vernam's cipher
    • H04L9/0662Pseudorandom key sequence combined element-for-element with data sequence, e.g. one-time-pad [OTP] or Vernam's cipher with particular pseudorandom sequence generator

Definitions

  • the invention belongs to the technical field of data encryption and decryption, and in particular relates to a data encryption and decryption method and device. Background technique
  • OTP One-time-pad
  • the implementation of the perfect encryption system mainly lies in the key part, that is, how to encrypt each bit of the plaintext by an infinite number of true random keys to achieve the design purpose of the perfect encryption system.
  • the encryption algorithms used are mostly single-OR operations, or the security of the entire system is completely dependent on the secure storage and transmission of keys. Once the key is compromised, the security of the entire system becomes very fragile. Summary of the invention
  • the object of the present invention is to provide a data encryption and decryption method and apparatus, which aims to solve the problem that the security of the existing perfect encryption technology completely depends on the secure preservation and transmission of the key, and the key ciphertext may be cracked once the key is leaked.
  • the present invention provides a data encryption method, the method comprising:
  • the encrypted data is arranged according to the corresponding plaintext position to form a ciphertext.
  • the present invention provides a data encryption device, the device comprising:
  • a grouping module configured to group the encrypted plaintext
  • An encryption function and an encryption key random allocation module configured to randomly allocate an encryption function and an encryption key for each group of plaintext data grouped by the grouping module
  • An encryption processing module configured to encrypt data in the plaintext by using an encryption function and an encryption key allocated by the encryption function and the encryption key random allocation module, and press the encrypted data according to the corresponding plaintext
  • the positions are arranged to form a ciphertext.
  • the present invention provides a data decryption method, the method comprising:
  • the data of each bit in the plaintext is arranged according to the ciphertext position corresponding thereto to form a plaintext.
  • the present invention also provides a data decryption apparatus, the apparatus comprising:
  • An obtaining module configured to obtain decryption information
  • a random seed storage module configured to store a random seed generated when encrypting
  • An encryption function and an encryption key index random string generation module configured to be acquired according to the acquisition module Decrypting information, collecting data from the random seed saved by the random seed storage module to generate an encryption function and an encryption key index random string;
  • a synchronization traversing module configured to determine, according to the decryption information acquired by the acquiring module, a traversal start position of the encryption function and the encryption key index random string, and synchronously traverse the encryption function and the encryption key index random string and to be decrypted Cipher text
  • An encryption function and an encryption key determining module configured to determine an encryption function and an encryption key corresponding to each bit bit data in the ciphertext according to the decryption information acquired by the acquiring module;
  • a decryption function and a decryption key acquisition module configured to determine an encryption function and an encryption key determined by the module according to the encryption function and the encryption key, and determine a decryption function and a decryption key corresponding to each bit data in the ciphertext;
  • a plaintext restoring module configured to restore data of each bit in the ciphertext to data of each bit in the plaintext by using the decryption function and the decryption key, and press the data of each bit in the plaintext according to the
  • the corresponding ciphertext positions are arranged to form a plain text.
  • the invention randomly allocates the stored encryption function and the encryption key for the plaintext to be encrypted when encrypting, encrypts the plaintext with the assigned encryption function and the encryption key, and then generates and according to the encryption function and the encryption key.
  • the index random string obtains the decryption function of the ciphertext to be decrypted and the decryption key to decrypt, which greatly improves the security of the data and achieves perfect encryption of the data.
  • FIG. 1 is a flowchart of a data encryption method according to an embodiment of the present invention.
  • FIG. 2 is a flow chart showing the steps before the encryption function and the encryption key are randomly assigned to the plaintext to be encrypted according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a method for performing repetitive verification on an encryption function and an encryption key index random string according to an embodiment of the present invention
  • FIG. 4 is a schematic structural diagram of a data encryption apparatus according to an embodiment of the present invention.
  • FIG. 5 is a flowchart of a method for establishing a minimum encryption function and an encryption key set according to an embodiment of the present invention
  • FIG. 6 is a flowchart of a data decryption method according to an embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of a data decryption apparatus according to an embodiment of the present invention.
  • FIG. 8 is a schematic diagram showing the principle of generating an encryption function and an encryption key index random string according to an embodiment of the present invention.
  • FIG. 9 is a schematic diagram of a data encryption process according to an embodiment of the present invention.
  • FIG. 10 is a schematic diagram of a data decryption process according to an embodiment of the present invention. detailed description
  • the encrypted function and the encryption key are randomly allocated for the plaintext to be encrypted during encryption, and the plaintext is encrypted by using the assigned encryption function and the encryption key; when decrypted, the encryption function is generated and encrypted according to the encryption function.
  • the key index is a random string, and the decryption function and the decryption key of the ciphertext to be decrypted are obtained for decryption.
  • an embodiment of the present invention provides a data encryption method, including the following steps: Step S101: grouping encrypted plaintext;
  • Step S102 randomly assign an encryption function and an encryption key to each group of plaintext data
  • a set of encryption functions and an encryption key are pre-selected, and the stored encryption function and the encryption key may cover all conversion paths from any predetermined bit 0, 1 in the plaintext to the corresponding position 0 or 1 in the ciphertext;
  • the encryption is sequentially assigned to the plaintext to encrypt the plaintext;
  • the encryption function uniquely corresponds to an encryption algorithm and corresponds to a plurality of candidate encryption keys;
  • each bit of data to be encrypted is used as a packet, that is, each of the data in the plaintext is randomly assigned an encryption function and an encryption key; in practical applications, each of the plaintext to be encrypted may also be Bit, every 3 bits, every 4 bits of data as a group; Step S103: encrypt each bit of data in the plaintext with the allocated encryption function and the encryption key;
  • Step S104 Arranging each encrypted data according to its corresponding plaintext position to form a ciphertext.
  • the embodiment of the present invention further includes the following steps between step S102 and step S102: Step S201: generating a true random number of a predetermined length and a random seed of a predetermined length composed of a true random number;
  • the method of generating true random numbers is very mature.
  • the specific implementation can use the method of generating true random numbers given in the Journal of Applied Cryptography published by the Machinery Industry Press on March 1, 2003, such as using random noise. , using a computer clock, CPU load or network packet arrival times and other methods to generate the required true random number, as a random seed, while storing the generated random seed;
  • Step S202 Establish an encryption function and an encryption key set, and assign an index to each encryption function and the encryption key in the set;
  • Each encryption function in the collection has an index corresponding to the encryption key and stores these different indexes
  • Step S203 Perform data collection on the random seed, and generate an encryption function and an encryption key index random string;
  • Step S204 Synchronizing the traversal encryption function with the encryption key index random string and the plaintext to be encrypted.
  • the method further includes the steps of performing repetitive verification on the encryption function and the encryption key index random string, and the specific implementation manner is shown in FIG. 3 . As shown, the following steps are included:
  • Step S301 Generate an information summary value of the encryption function and the encryption key index random string by the information digest operation
  • Step S302 The information digest value of the comparison encryption function and the encryption key index random string is consistent with the previously stored information digest value. If they are consistent, the data is collected again for the random seed to generate an encryption function and an encryption key index random string. Step S301 is performed. If not, step S303 is performed. Step S303: Save the currently generated encryption function and the encryption key index random string to be used.
  • the present invention When there is a newly generated encryption function and an encryption key index random string, the present invention generates a message digest value of the encryption function and the encryption key index random string by using information digest operations such as MD5, SHA1, etc., and the information digest value is The previously stored encryption function is compared with the information digest value of the encryption key index random string to determine whether the newly generated encryption function and the encryption key index random string have been used, and if so, the encryption function and the encryption key are regenerated.
  • the key index is a random string, otherwise the generated encryption function and the encryption key index random string are reserved for use. After saving the encryption function to be used and the encryption key index random string, the information digest value of all the encryption function and the encryption key index random string is saved.
  • the plaintext grouping information, the encryption function and the encryption key set used in the data encryption process and the generated encryption function and the encryption key index, and the random seed used in the data collection are generated and stored. And regenerating the encrypted plaintext corresponding encryption function and the encryption key index random string information and traversing the encryption function index random string starting cursor position information to form decryption information.
  • an embodiment of the present invention provides a data encryption apparatus.
  • the apparatus includes:
  • the module 41 randomly allocates an encryption function and an encryption key for encryption for each bit of data to be encrypted, and the encryption processing module 42 encrypts the plaintext with the encryption function and the encryption key assigned by the encryption key random allocation module 41.
  • the bit data is encrypted, and each encrypted data is arranged according to the position of its corresponding plaintext to form a ciphertext output.
  • the data encryption device further includes:
  • the true random number generating module 44 is configured to generate a true random number of a predetermined length and a random seed of a predetermined length composed of a true random number, and the encryption function and the encryption key index random string generating module 45 perform data collection on the random seed to generate an encryption function.
  • An establishing module 43 is configured to establish and store an encryption function and an encryption key set; an allocation module 46, configured to encrypt and encrypt each encryption function and encryption key set established by the encryption function and the encryption key establishing module 43
  • the key distribution index; the synchronization traversal module 47 synchronizes the traversal encryption function with the encryption function generated by the encryption key index random string generation module 45 and the encryption key index random string and the plaintext to be encrypted.
  • the encryption function and the encryption key index random string generation module 45 includes:
  • a data collection unit configured to collect data from the random seed generated by the true random number generation module 44, and send the data collection result
  • the index random string generating unit is configured to generate and save the encryption function and the encryption key index random string according to the data collection result sent by the received data collection unit.
  • the encryption function and the encryption key index random string generation module 45 further includes:
  • a message digest value generating module configured to generate, by using an information digest operation, an information encryption digest value generated by the index random string generating unit and an information digest value of the encryption key index random string;
  • a storage module configured to store an encryption function generated by the information digest value generating module and an information digest value of the encryption key index random string;
  • the comparison module is configured to compare the information digest value of the information digest value generating module with the information digest value previously stored by the storage module, and send the comparison result to the encryption function and the encryption key index random string generation module 45.
  • the encryption function and the encryption key index random string generation module 45 regenerate the encryption function and the encryption key index random string according to the same comparison result of the information digest value sent by the comparison module, and repeatedly perform the information digest value through the comparison module. Alignment, until a random string of non-repeating encryption functions and encryption keys is generated.
  • the present invention adopts the following method to select a minimum encryption function and an encryption key set, and the actual steps are as follows:
  • Step S501 Select an encryption function and an encryption key that can cover a maximum possible plaintext to a ciphertext conversion path, and record a possible conversion path of the encryption function and the encryption key overlay;
  • Step S502 determining whether the possible conversion path is completely covered, if yes, executing step S505, otherwise, performing step S503;
  • Step S503 determining a possible conversion path that is not covered, selecting another encryption function and an encryption key that can cover the most uncovered possible conversion path, and recording a path covered by the current encryption function and the encryption key, and reselecting another capability.
  • the encryption function and the encryption key covering the most uncovered possible conversion paths are performed, step S504 is performed;
  • Step S504 determining whether the possible transition paths that are not covered are overwritten, if yes, executing step S505, otherwise, performing step S503;
  • Step S505 Combine all the selected encryption functions and encryption keys into a minimum encryption function and a set of encryption keys.
  • Method A By selecting the following encryption function and encryption key,
  • Encryption function 1 XOR (XOR).
  • the corresponding operation rules are:
  • this implementation is a typical OTP (using an exclusive OR operation as an encryption function), but in the present invention, the above only constitutes the smallest encryption function and encryption key set, and the user can add more encryption functions and encryption as needed.
  • the key which enhances the security of the entire system.
  • Method B By selecting the following encryption function and encryption key,
  • Encryption function 1 XOR operation (XOR).
  • the corresponding operation rules are:
  • Encryption function 2 OR operation (OR), is input and output.
  • the corresponding operation rules are:
  • the user can add other encryption functions and encryption keys as needed to make the system more secure.
  • the final selected encryption function and encryption key set will be The encryption method call provided by the invention.
  • an embodiment of the present invention further provides a data decryption method.
  • the method includes the following steps:
  • Step S601 Acquire decryption information, and collect data from the saved random seed according to the decryption information, and generate an encryption function and an encryption key index random string;
  • the obtained decryption information is formed in the encryption process of the data, including plaintext data packet information, a random seed stored when the data is encrypted, and the information of the encryption function corresponding to the encrypted plaintext and the random string of the encryption key index and the traversal are generated again.
  • the cryptographic function indexes the cursor position information starting from the random string;
  • Step S602 Determine, according to the decryption information, a traversal start position of the encryption function and the encryption key index random string, and synchronize the traversal encryption function with the encryption key index random string and the ciphertext to be decrypted, and determine, according to the decryption information, the ciphertext corresponding data.
  • Encryption function and encryption key
  • Step S603 Determine, according to the encryption function and the encryption key, a decryption function and a decryption key corresponding to each bit of the ciphertext data;
  • Step S604 The ciphertext data is restored to the plaintext data by using the decryption function and the decryption key.
  • Step S605 Each plaintext data is arranged according to the ciphertext location corresponding thereto to form a plaintext.
  • each decryption function uniquely corresponds to an encryption function
  • the decryption key required for decryption also uniquely corresponds to the encryption key used by the encryption function.
  • the device includes:
  • the obtaining module 71 is configured to obtain decryption information.
  • a random seed storage module 76 configured to store a random seed generated when encrypting
  • the encryption function and encryption key index random string generation module 72 is configured to generate an encryption function and an encryption key index random string from the random seed stored in the random seed storage module 76 according to the decryption information acquired by the obtaining module 71.
  • the synchronization traversing module 77 is configured to determine, according to the decryption information acquired by the obtaining module 71, a traversal starting position of the encryption function and the encryption key index random string, and a synchronous traversal encryption function and an encryption key index index random string and the ciphertext to be decrypted;
  • the encryption function and encryption key determining module 73 is configured to determine, according to the decryption information acquired by the obtaining module 71, an encryption function and an encryption key corresponding to each bit bit data in the ciphertext;
  • the decryption function and decryption key acquisition module 74 is configured to determine a decryption function and a decryption key corresponding to each bit position data in the ciphertext according to the encryption function and the encryption key determined by the encryption function and the encryption key determination module 73;
  • the plaintext restoring module 75 is configured to restore the data of each bit in the ciphertext to the data of each bit in the plaintext by using the decryption function and the decryption key, and press the data of each bit in the plaintext according to the ciphertext position corresponding thereto. Arrange, form a clear text.
  • Random data acquisition of the random seed for a predetermined number of times u (u is a natural number), the starting cursor position of each data acquisition and the length of the collected data (may be greater than or equal to 0) are random, if the data is collected to a random seed At the end, return to the head to continue data collection;
  • the traversal data is synchronized from the generated encryption function and the encryption key index random string and the header of the plaintext to be stored, and each time the traversal first takes log 2 « (if log 2 «is an integer) or [1 (3 ⁇ 4 2 «] +1 (If [log 2 «]+l) is not an integer), where [log 2 «] is a rounding operation on log 2 «, it will traverse the log 2 « or [log 2 «] + l bits each time it is traversed
  • the binary number is converted into a decimal number, and then the converted value is subjected to a modulo operation on n, and the modulo value is used as an index of the encryption function corresponding to the plaintext data of the bit;
  • mod is a modulo operation.
  • the encryption function and the encryption key index random string generation method are as shown in FIG. 8.
  • Cur e When Cur e is equal to Cur s , the number of bits of data acquisition is 0. Then the data collected by the ith is scheduled. The data between Cur s and Cur e in the random seed of the length. Further, the p-bit encryption function corresponding to the k-th plaintext and the encryption key index random string re k can be expressed as:
  • Re k [(Cur s , Cur e )i , (Cur s , Cur e ) 2 , .... (Cur s , Cur e )i , .... (Cur s , Cur e ) u ] k;
  • the true randomness of the encryption function and the encryption key assigned to each plaintext in the method 1 is embodied in two places: one is a random seed composed of true random numbers, and the other is randomly collected data in a random seed (data acquisition) The starting position and the acquisition length are both derived from the true random number), and a p-bit encryption function and an encryption key index random string are generated.
  • a random string of p bits (in the present method, the head of the random string) is traversed from a fixed position, and an encryption function and an encryption key index corresponding to each plaintext portion are generated (subject to modulo operation).
  • the probability that the method 1 generates the same encryption function and the encryption key allocation index for the same number of plain texts depends on the probability of the p-bit encryption function and the encryption key index random string reproduction, and only considers the same random seed based on the same random seed p.
  • the probability of a random string reproduction is a probability that the method 1 generates the same encryption function and the encryption key allocation index for the same number of plain texts.
  • the p-bit encryption function and the encryption key index random string reproduction probability is l/w u .
  • the method 2 is similar to the method 1. The difference is: in the method, the index value of the encryption algorithm is traversed from the random position in the random string generated by the p-bit algorithm index, and the security of the whole method is enhanced by traversing the uncertainty of the starting position. Sex.
  • the details are as follows (variable setting is the same as method 1): First, a truly random 0, 1 string of predetermined length w bits is generated as a random seed, where w is a natural number and J_w > m.
  • Random data acquisition of the random seed for a predetermined number of times u (u is a natural number), the starting position of each data acquisition and the length of the collected data (which may be greater than or equal to 0) are random, if the data collection has been randomized At the end of the seed, return to its head to continue data collection.
  • p is a natural number, p>mx [log 2 w + log 2 + 2] , where [108 2 " + 1. 8 2 111 & ( 1 ⁇ ) + 2] is a rounding operation on log 2 « + log 2 max(gi)+2.
  • a random starting position is reserved in the p-bit random string, and the data is traversed synchronously from the p-position of the random string and the plaintext header, and each time the traversal takes the log 2 « (if log 2 «is an integer) or [log 2 «] +l (if log 2 «non-integer) bits, where [log 2 «] is a rounding operation on log 2 «, which will be converted each time by the log 2 « or [log 2 «] + l-bit binary number It is a decimal number, and then the converted value is subjected to a modulo operation on n, and the value of the modulo is used as an index of the encryption function corresponding to the plaintext data of the bit.
  • log 2 max(gi) if log 2 max(gi) is an integer or [log 2 max(gi)]+l (if log 2 max(gi) is not an integer) bit
  • the plaintext data In the case of the allocated j-th encryption function/algorithm, the log 2 max(gi) or [log 2 max(gi)]+l bit data of the traversal is converted into a decimal number, and the gi is subjected to a modulo operation. The value of the modulo is used as the encryption used by the jth encryption function corresponding to the plaintext data. Key index.
  • mod is a modulo operation.
  • the cryptographic algorithm index corresponding to each plaintext portion is generated by traversing the data from a random position, because the traversal There are p possibilities at the starting position, so the probability of recurring the index corresponding to the plaintext partial encryption algorithm is: l/(p*w u ).
  • the traditional perfect encryption system has the following advantages:
  • the encryption function and the encryption key are reasonably selected, and the encryption function and the encryption key are randomly rotated to encrypt each data bit of the plaintext, so that the posterior probability of the ciphertext intercepted and the priori of the ciphertext crack are solved.
  • the probability is equal, and the implementation has the same encryption strength as the traditional OTP method.
  • the security relies only on a large number of random keys to protect one part, and the data leakage risk is effectively dispersed, which can effectively reduce the accidental leakage of the password book. The risk of data leakage.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)

Description

一种数据加解密方法及装置
技术领域
本发明属于数据加密解密技术领域,尤其涉及一种数据加解密方法及装置。 背景技术
完美加密 (Perfect Secrecy ) 系统保护的数据, 无论密码分析者截获多少 密文,在无限的计算能力和时间条件下,都无法破解。具体内容见文献 Shannon, Claude (1949). Communication Theory of Secrecy Systems , Bell System Technical Journal 28 (4): 656— 715。
一次一密乱码本(One-time-pad, 下称之为 OTP )就是其中的一个典型实现, 有关内容可参见下述文献, U.S patent 1,310,719. SECRET SIGNALING SYSTEM, S N Molotkov, "Quantum cryptography and V A Kotel'nikov's one-time key and sampling theorems", PHYS-USP, 2006, 49 (7), 750-761以及机才戒工业出 版社 2003年 3月 1 日出版的 《应用密码学 》第 6、 12页。
目前对完美加密系统的实现主要在于密钥部分, 即如何通过无限多真随机 密钥对明文每一位进行加密以达到完美加密系统的设计目的。 而所用加密算法 大多是较单一的异或运算, 或者说, 整个系统的安全性完全依赖于密钥的安全 保存和传输。 一旦密钥泄露, 则整个系统的安全性则变得非常脆弱。 发明内容
本发明的目的在于提供一种数据加解密方法及装置, 旨在解决现有完美加 密技术的安全性完全依赖于密钥的安全保存和传输, 一旦密钥泄露密文有可能 被破解的问题。
本发明提供了一种数据加密方法, 所述方法包括:
对待加密明文进行分组; 为每组明文数据随机分配加密函数与加密密钥;
用加密函数与加密密钥分别对所述每组明文数据进行加密;
将所述加密的数据按其对应的所述明文位置排列形成密文。
本发明提供了一种数据加密装置, 所述装置包括:
分组模块, 用于对待加密明文进行分组;
加密函数与加密密钥随机分配模块, 用于为所述分组模块分组后的每组明 文数据随机分配加密函数与加密密钥;
加密处理模块, 用于用所述加密函数与加密密钥随机分配模块分配的加密 函数与加密密钥对所述明文中的数据进行加密, 并将所述加密的数据按其对应 的所述明文位置排列形成密文。
本发明提供了一种数据解密方法, 所述方法包括:
获取解密信息, 并根据所述解密信息从保存的随机种子中采集数据生成加 密函数与加密密钥索引随机串;
根据所述解密信息, 确定所述加密函数与加密密钥索引随机串的遍历起始 位置, 同步遍历所述加密函数与加密密钥索引随机串及待解密密文;
根据所述解密信息确定所述密文中各个比特位数据对应的加密函数与加密 密钥;
根据所述加密函数与加密密钥, 确定所述密文中各个比特位数据对应的解 密函数与解密密钥;
用所述解密函数与解密密钥将所述密文中各个比特位的数据还原成明文中 的各个比特位的数据;
将所述明文中各个比特位的数据按其所对应的密文位置排列, 形成明文。 本发明还提供了一种数据解密装置, 所述装置包括:
获取模块, 用于获取解密信息;
随机种子存储模块, 用于存储加密时产生的随机种子;
加密函数与加密密钥索引随机串生成模块, 用于根据所述获取模块获取的 解密信息 , 从所述随机种子存储模块保存的随机种子中采集数据生成加密函数 与加密密钥索引随机串;
同步遍历模块, 用于根据所述获取模块获取的解密信息, 确定所述加密函 数与加密密钥索引随机串的遍历起始位置, 同步遍历所述加密函数与加密密钥 索引随机串及待解密密文;
加密函数与加密密钥确定模块, 用于根据所述获取模块获取的解密信息, 确定所述密文中各个比特位数据对应的加密函数与加密密钥;
解密函数与解密密钥获取模块, 用于根据所述加密函数与加密密钥确定模 块确定的加密函数与加密密钥, 确定所述密文中各个比特位数据对应的解密函 数与解密密钥;
明文还原模块, 用于用所述解密函数与解密密钥将所述密文中各个比特位 的数据还原成明文中的各个比特位的数据, 并将所述明文中各个比特位的数据 按其所对应的密文位置排列, 形成明文。
本发明通过在加密时为待加密的明文随机分配存储的加密函数与加密密 钥, 用所分配的加密函数与加密密钥对明文进行加密, 解密时再通过生成并根 据加密函数与加密密钥索引随机串, 获得待解密密文的解密函数与解密密钥进 行解密, 极大地提高了数据的安全性, 实现了对数据的完美加密。 附图说明
图 1是本发明实施例提供的数据加密方法的流程图;
图 2是本发明实施例提供的为待加密明文随机分配加密函数与加密密钥之 前的步骤流程图;
图 3是本发明实施例提供的对加密函数与加密密钥索引随机串进行重复性 校验的方法流程图;
图 4是本发明实施例提供的数据加密装置的结构示意图;
图 5是本发明实施例提供的建立最小加密函数与加密密钥集合的方法流程 图;
图 6是本发明实施例提供的数据解密方法的流程图;
图 7是本发明实施例提供的数据解密装置的结构示意图;
图 8本发明实施例提供的加密函数与加密密钥索引随机串生成的原理示意 图;
图 9是本发明实施例提供的数据加密过程的示意图;
图 10是本发明实施例提供的数据解密过程的示意图。 具体实施方式
为了使本发明的目的、 技术方案及优点更加清楚明白, 以下结合附图及实 施例, 对本发明进行进一步详细说明。 应当理解, 此处所描述的具体实施例仅 仅用以解释本发明, 并不用于限定本发明。
本发明实施例在加密时通过为待加密的明文随机分配存储的加密函数与加 密密钥, 用所分配的加密函数与加密密钥对明文进行加密; 解密时通过生成并 根据加密函数与加密密钥索引随机串, 获得待解密密文的解密函数和解密密钥 进行解密。
参见图 1和图 9, 本发明实施例提供了一种数据加密方法, 包括以下步骤: 步骤 S101 : 对待加密明文进行分组;
步骤 S102: 为每组明文数据随机分配加密函数与加密密钥;
本实施例预先选定一组加密函数与加密密钥存储, 该存储的加密函数与加 密密钥可以覆盖从明文中任意预定位 0、 1到密文中对应位置 0或 1的所有转换 路径; 选定完成后, 在进行加密时, 被先后分配给明文对明文进行加密; 加密 函数唯一对应一种加密算法, 并对应多个待选加密密钥;
本实施例中, 将待加密明文的每位数据作为一个分组, 即分别对明文中的 每位数据随机分配加密函数与加密密钥; 在实际应用中, 还可以将待加密明文 中的每 2位、 每 3位、 每 4位数据作为一个分组; 步骤 S103: 用所分配的加密函数与加密密钥对明文中的每位数据进行加 密;
步骤 S104: 将加密的每位数据按其对应的明文位置排列, 形成密文。
参见图 2, 本发明实施例在步骤 S102和步骤 S102之间还包括以下步骤: 步骤 S201 : 生成预定长度的真随机数和由真随机数组成的预定长度的随机 种子;
生成真随机数的方法已经很成熟, 具体实现中可以采用机械工业出版社 2003年 3月 1 日出版的《应用密码学》第 301页中给出的产生真随机数的方法, 如使用随机噪声, 使用计算机时钟, CPU负载或网络数据包到达次数等方法来 产生需要的真随机数, 作为随机种子, 同时存储产生的随机种子;
步骤 S202: 建立加密函数与加密密钥集合, 并对集合中的每个加密函数与 加密密钥分配索引;
集合中的每个加密函数与加密密钥都有一个与之相对应的索引, 并且存储 这些不同的索引;
步骤 S203: 对随机种子进行数据采集, 生成加密函数与加密密钥索引随机 串;
步骤 S204: 同步遍历加密函数与加密密钥索引随机串和待加密明文。
本发明实施例在对随机种子进行数据采集, 生成加密函数与加密密钥索引 随机串后还包括对加密函数与加密密钥索引随机串进行重复性校验的步骤, 其 具体实现方式如图 3所示, 包括以下步骤:
步骤 S301: 通过信息摘要运算生成加密函数与加密密钥索引随机串的信息 摘要值;
步骤 S302: 比对加密函数与加密密钥索引随机串的信息摘要值与先前存储 的信息摘要值是否一致, 如果一致, 则对随机种子再次进行数据采集, 生成加 密函数与加密密钥索引随机串,执行步骤 S301 ,如果不一致,则执行步骤 S303; 步骤 S303: 保存当前生成的加密函数与加密密钥索引随机串待用。 当有新生成的加密函数与加密密钥索引随机串时, 本发明通过运用信息摘 要运算如 MD5 , SHA1等,生成加密函数与加密密钥索引随机串的信息摘要值, 将该信息摘要值与先前存储的加密函数与加密密钥索引随机串的信息摘要值进 行比对, 从而判断新生成的加密函数与加密密钥索引随机串是否已使用过, 如 果是, 则重新生成加密函数与加密密钥索引随机串, 否则保存所生成的加密函 数与加密密钥索引随机串待用。 在保存待用的加密函数与加密密钥索引随机串 后, 保存所有加密函数与加密密钥索引随机串的信息摘要值。
本发明中, 生成并存储数据加密过程中所使用和产生的如明文分组信息、 加密函数与加密密钥集合及被分配的每个加密函数与加密密钥索引、 数据采集 时所使用的随机种子、 再次生成所加密的明文对应的加密函数与加密密钥索引 随机串的信息以及遍历加密函数索引随机串起始的游标位置信息, 形成解密信 息。
参见图 4, 本发明实施例提供了一种数据加密装置, 为了便于说明, 仅示 出了与本发明有关部分, 该装置包括:
分组模块 40、 加密函数与加密密钥随机分配模块 41和加密处理模块 42; 在进行数据加密时,分组模块 40将待加密明文中的每位数据分成一组,加 密函数与加密密钥随机分配模块 41 为待加密明文的每位数据随机分配加密函 数与加密密钥用于加密,加密处理模块 42用加密函数与加密密钥随机分配模块 41分配的加密函数与加密密钥对待加密明文的每位数据进行加密, 并将加密的 每位数据按其对应的明文的位置排列, 形成密文输出。
进一步地, 该数据加密装置还包括:
加密函数与加密密钥建立模块 43、真随机数生成模块 44、加密函数与加密 密钥索引随机串生成模块 45、 分配模块 46和同步遍历模块 47;
真随机数生成模块 44 用于生成预定长度的真随机数和由真随机数组成的 预定长度的随机种子,加密函数与加密密钥索引随机串生成模块 45对该随机种 子进行数据采集, 生成加密函数与加密密钥索引随机串; 加密函数与加密密钥 建立模块 43 , 用于建立并存储加密函数与加密密钥集合; 分配模块 46, 用于对 加密函数与加密密钥建立模块 43 建立的加密函数与加密密钥集合中的每个加 密函数与加密密钥分配索引;同步遍历模块 47同步遍历加密函数与加密密钥索 引随机串生成模块 45生成的加密函数与加密密钥索引随机串和待加密明文。
其中, 加密函数与加密密钥索引随机串生成模块 45包括:
数据采集单元, 用于对真随机数生成模块 44 生成的随机种子进行数据采 集, 并发送数据采集结果;
索引随机串生成单元,用于根据接收的数据采集单元发送的数据采集结果, 生成并保存加密函数与加密密钥索引随机串。
进一步地, 加密函数与加密密钥索引随机串生成模块 45还包括:
信息摘要值生成模块, 用于通过信息摘要运算生成索引随机串生成单元生 成的加密函数与加密密钥索引随机串的信息摘要值;
存储模块, 用于存储信息摘要值生成模块生成的加密函数与加密密钥索引 随机串的信息摘要值;
比对模块, 用于将信息摘要值生成模块的信息摘要值与存储模块先前存储 的信息摘要值进行比对,并向加密函数与加密密钥索引随机串生成模块 45发送 比对结果。
加密函数与加密密钥索引随机串生成模块 45 根据比对模块发送的信息摘 要值相同的比对结果, 重新生成加密函数与加密密钥索引随机串, 并通过比对 模块反复进行信息摘要值的比对, 直至产生不重复的加密函数与加密密钥索引 随机串。
由于完美加密系统需要满足密文被截获后的后验概率等于其先验概率, 对 于任意确定的明文, 至少有一种方式可以被转换为任意的密文, 并且这些转换 方式是完全等概的 (具体内容见文献 Shannon, Claude (1949). Communication Theory of Secrecy Systems , Bell System Technical Journal 28 (4): 656-715 )。 对 于存储在计算机中的二进制明文和密文而言, 因为所有明文和密文都是由一串 数量确定的二进制数 0或 1组成, 所以对明文任意确定的一位数据 0或 1 , 总 有至少一种方式使之转换为密文中对应位置的 0或 1 , 本发明称这种转换方式 为转换路径。
为实现本发明的完美加密需要, 需要找到一个最小的加密函数与加密密钥 集合, 使之能够覆盖从明文中任意预定位 0,1到密文中对应位置 0或 1的所有 转换路径。
参见图 5 , 本发明采用以下方法选择最小加密函数与加密密钥集合, 其实 现步骤为:
步骤 S501: 选择能覆盖最多明文到密文的可能转换路径的加密函数与加密 密钥, 记录加密函数与加密密钥覆盖的可能转换路径;
步骤 S502: 判断可能转换路径是否全被完全覆盖, 如果是, 则执行步骤 S505 , 否则, 执行步骤 S503;
步骤 S503: 确定未被覆盖的可能转换路径, 选择另一能覆盖最多未覆盖的 可能转换路径的加密函数与加密密钥, 并记录当前加密函数与加密密钥覆盖的 路径,重新选择另一能覆盖最多未覆盖的可能转换路径的加密函数与加密密钥, 执行步骤 S504;
步骤 S504: 判断是否未被覆盖的可能转换路径都被覆盖, 如果是, 则执行 步骤 S505 , 否则, 执行步骤 S503;
步骤 S505: 将所有选择的加密函数与加密密钥组成最小加密函数与加密密 钥集合。
为了验证该方法的可行性, 以下举出两例, 但是本发明的保护范围不限于 这两种实现。 记明文任意预定位置 X的数据 M(x) 到密文对应位置 x, 的数据 E(x,)的转换为 M(x) -> E(x,), 其中 M(x), E(x,)=0或者 1。
方法 A: 通过选择如下加密函数和加密密钥,
加密函数 1 : 异或运算 (XOR)。 对应运算规则是:
0 θ 0 = 0 1 = 1
0 = 1
1=0
覆盖以下转换路径
Figure imgf000011_0001
可见该实现的正是典型的 OTP (用异或运算作为加密函数), 但是在本发 明中以上仅是构成了最小的加密函数与加密密钥集合, 用户可以根据需要增加 更多加密函数与加密密钥, 从而增强整个系统的安全性。
方法 B: 通过选择如下加密函数和加密密钥,
加密函数 1: 异或运算 (XOR)。 对应运算规则是:
0 θ 0 = 0
0 ® 1 = 1
1 θ 0 = 1
1 ® 1=0
加密函数 2: 或运算 (OR), 是输入也是输出。 对应运算规则是:
1110 = 1
0110 = 0
0111 = 1
1 II 1 = 1 覆盖以下转换路径 M(x) -> Ε(χ') 转换路径(加密函数和加密密钥)
M(x)=0, E(x,)=0 加密函数 2, 加密密钥为 0, 即 E(x,) = M(x) II 0
M(x)=0, E(x,)=l 加密函数 1 ,加密密钥为 1 ,即 Ε(χ,) = Μ(χ) θ 1
M(x)=l, E(x,)=0 加密函数 1 ,加密密钥为 1 ,即 Ε(χ,) = Μ(χ) θ 1
M(x)=l, E(x,)=l 加密函数 2, 加密密钥为 0, 即 E(x,) = M(x) II 0 综上所述, 用户可以根据一定方法选定最小加密函数与加密密钥集合, 进 而通过本发明提出的加密函数与加密密钥随机分配的方法, 使从明文到密文的 转换路径是完全等概的和随机的。
在使用中, 用户在选定最小加密函数与加密密钥集合后, 可以根据需要增 加其他加密函数与加密密钥, 使系统更安全, 最终选定的加密函数与加密密钥 集合, 将被本发明提供的加密方法调用。
针对上述加密方法, 本发明实施例还提供了一种数据解密方法, 参见图 6 和图 10, 该方法包括以下步骤:
步骤 S601: 获取解密信息, 并根据解密信息从保存的随机种子中采集数据 生成加密函数与加密密钥索引随机串;
所获取的解密信息是在数据的加密过程中形成的,包括明文数据分组信息, 数据加密时存储的随机种子, 再次生成所加密的明文对应的加密函数与加密密 钥索引随机串的信息以及遍历加密函数索引随机串起始的游标位置信息;
步骤 S602: 根据解密信息, 确定加密函数与加密密钥索引随机串的遍历起 始位置, 同步遍历加密函数与加密密钥索引随机串及待解密密文, 根据解密信 息确定密文每位数据对应的加密函数与加密密钥;
步骤 S603:根据加密函数与加密密钥确定密文每位数据对应的解密函数与 解密密钥;
步骤 S604: 用解密函数与解密密钥将密文每位数据还原成明文每位数据; 步骤 S605: 将明文每位数据按其所对应的密文位置排列, 形成明文。 本发明中, 每个解密函数唯一对应一个加密函数, 解密时所需解密密钥也 唯一对应其加密函数所使用的加密密钥。
参见图 7, 本发明实施例还提供了一种数据解密装置, 为了便于说明, 仅 示出了与本发明有关的部分。 该装置包括:
获取模块 71 , 用于获取解密信息;
随机种子存储模块 76 , 用于存储加密时产生的随机种子;
加密函数与加密密钥索引随机串生成模块 72, 用于根据获取模块 71获取 的解密信息,从随机种子存储模块 76保存的随机种子中采集数据生成加密函数 与加密密钥索引随机串;
同步遍历模块 77 , 用于根据获取模块 71获取的解密信息, 确定加密函数 与加密密钥索引随机串的遍历起始位置, 同步遍历加密函数与加密密钥索引索 引随机串及待解密密文;
加密函数与加密密钥确定模块 73 , 用于根据获取模块 71获取的解密信息, 确定密文中各个比特位数据对应的加密函数与加密密钥;
解密函数与解密密钥获取模块 74 , 用于根据加密函数与加密密钥确定模块 73确定的加密函数与加密密钥, 确定密文中各个比特位数据对应的解密函数与 解密密钥;
明文还原模块 75 , 用于用解密函数与解密密钥将密文中各个比特位的数据 还原成明文中的各个比特位的数据, 并将明文中各个比特位的数据按其所对应 的密文位置排列, 形成明文。
为了进一步证明本发明的可行性, 下面举例对上述加密实现方式进行全面 说明: ¾口下。
方法 1、 加密函数与加密密钥随机串固定位方法
设定有数个明文待加密, 其中第 k个明文的位数是 m位, 有 n种加密算法 待选, 这里 m、 n、 k都取自然数, 随机为第 k个明文的每个数据位分配加密函 数与加密密钥。 首先, 生成预定长度 w位的真随机数 0、 1 串, 作为随机种子, 其中 w是 自然数, J. w > m;
对该随机种子做预定次数 u ( u是自然数)的随机数据采集, 每次数据采集 的起始游标位置和所采集的数据长度(可以大于等于 0 )都是随机的, 如果数 据采集至随机种子尾部, 则返回到头部继续数据采集;
将每次采集的数据级联成预定长度为 p位的加密函数与加密密钥索引随机 串, p是自然数, p> m X [log2 n + log2 max(^;. ) + 2] , 其中 [log2 w + log2 max(g + 2]是对 log2« + log2max(gi)+2的取整运算;
判断所生成的加密函数与加密密钥索引随机串是否曾经被使用过,如果是, 则重新生成加密函数与加密密钥索引随机串, 否则保留该加密函数与加密密钥 索引随机串待用;
为加密函数中每种加密算法分配十进制数字标识, 如第一种加密函数分配
0 , 第二种加密函数分配 1 , 第三种加密函数分配 2 , 第四种加密函数分配 3 , 依次类推;
对每种加密函数对应的供选加密密钥分配十进制数字标识, 如第一种加密 函数的第一个加密密钥分配 0 , 第二种加密函数的第二个加密密钥分配 2 ,如此 类推;
然后从产生的加密函数与加密密钥索引随机串和待存储明文的头部开始同 步遍历数据,每次遍历先取 log2«(如果 log2«是整数)或[1(¾2«]+1(如果 [log2«]+l) 不是整数)位, 其中 [log2«]是对 log2«的取整运算, 将每次遍历所取的 log2« 或 [log2«]+l位二进制数转换为十进制数, 然后将转换所得值对 n作取模运算, 取 模的值作为该位明文数据对应的加密函数索引;
然后继续遍历再取 log2max(gi) (如果 log2max(gi)是整数 )或 [log2max(gi)]+l (如果 log2max(gi)不是整数)位,对该明文数据位已分配的第 j个加密函数(算 法) 而言, 将遍历所取 log2max(gi)或 [log2max(gi)]+l位数据转换为十进制数, 对 gi做取模运算, 取模的值作为该位明文数据对应的第 j个加密函数所使用的 加密密钥索引;
继续同步遍历加密函数与加密密钥索引随机串和明文, 直到所有明文每位 或部分数据都被随机分配了加密函数与加密密钥;
每次数据采集前, 需要先产生两个随机值, 对其分别取模, 得到随机的起 始游标位置和所需采集的数据长度。
假定在数据采集前, 生成了两个真随机数 R1, R2 , 那么需要产生两个分别 小于 w和 p-q的随机值 Tl, T2, 其中 q是小于等于 p的自然数, w是随机种子 的长度,ρ是所需产生的明文加密位随机串的长度, q是已经产生的数据的长度, p-q就是随机串剩余未采集数据的位数, 那么
Tl = Rl mod w
T2 = R2 mod (p-q)
其中, mod是取模运算。
加密函数与加密密钥索引随机串的产生方法, 如图 8所示。
记第 k个明文对应的 p位加密函数与加密密钥索引随机串为 rek, 那么 rek 等于从预定长度随机种子中 u次随机采集的数据的顺序组合, 记从随机种子中 第 i次采集的数据为 (Cu^ Crn^, 其中 i是自然数, 且 u, Curs为第 i次采集 数据在随机种子中起始游标位置, 相应地 Cure为第 i次采集数据的终止游标位 置, Curs和 Cure都以从随机种子首位的偏移量标识, 可见 0 Curs Cure m, 当 Cure等于 Curs时, 数据采集的位数为 0。 那么第 i次采集的数据为预定长度 随机种子中 Curs 到 Cure之间的数据。 进一步, 第 k个明文对应的 p位加密函 数与加密密钥索引随机串 rek可以表达为:
rek =[(Curs, Cure)i , (Curs, Cure)2, .... (Curs, Cure)i , .... (Curs, Cure)u]k;
为进一步说明本发明的可行性, 现对本方法 1加密函数与加密密钥索引随 机串的真随机性 /不可重现性分析。
确保由比对模块检验的加密函数与加密密钥索引随机串的真随机性及不重 复使用, 对于整个系统不被密码分析者破解是至关重要的。 需要重申的是, 只要作为随机串使用的字符是有限的, 那么随机串就可能 重现, 其随机性体现在重现的概率很小且无规律。 假设随机串的位数是 1024 位, 因为可以组成随机串的字符只有 0和 1 , 所以无论如何随机, 其重现概率 仍然大于等于 1/2 , 即 1/ ( 1.79*10308
本方法 1中为每个明文分配加密函数与加密密钥的真随机性体现在两个地 方:一是由真随机数组成的随机种子,另一是在随机种子中随机地采集数据(数 据采集的起始位置和采集长度都来源于真随机数 ),生成 p位加密函数与加密密 钥索引随机串。
进而从固定位置遍历 p位的随机串(在本方法中是随机串的头部),产生每 个明文部分对应的加密函数与加密密钥索引 (需经过取模运算)。
进一步可以算出该方法 1对相同位数明文产生同样加密函数与加密密钥分 配索引的概率依赖于 p位加密函数与加密密钥索引随机串重现的概率, 在这里 仅考虑基于相同随机种子 p位随机串重现的概率。
对相同的随机种子,因为每次数据采集可以有 W种可能(随机种子有 W位 ), 所以该方法中, 数据采集 U次后, p位加密函数与加密密钥索引随机串重现概 率为 l/wu
假设用 4种不同加密算法 /函数及数个加密密钥加密 10M字节( Byte )的明 文,所使用的随机种子的大小是 1Gbit, 即 w=l, 000,000,000,数据采集 1000次, 即 u=1000, 那么, 通过该实现方法产生的 rek重复的最小概率是 1/109Q∞, 可见 其重复的概率已经足够低, 符合随机特征的特性。 实际使用中, 可以通过增加 u和 w继续提高其随机性, 降低其重复概率, 或定期更换随机种子, 以提高整 个方法的安全性。
方法 2、 加密函数与加密密钥随机串不固定位方法
本方法 2类似于方法 1 , 不同的是: 该方法中从 p位算法索引生成随机串 中随机位置开始遍历产生加密算法的索引值, 通过遍历起始位置的不确定性, 增强整个方法的安全性。 具体详述如下 (变量设定同方法 1 ): 首先生成预定长度 w位的真随机 0、 1 串, 作为随机种子, 其中 w是自然 数, J_ w > m。
对该随机种子做预定次数 u ( u是自然数 )的随机数据采集, 每次数据采集 的起始位置和所采集的数据长度(可以是大于等于 0 )都是随机的, 如果数据 采集已至随机种子尾部, 则回到其头部继续数据采集。
将每次采集的数据级联成预定长度 p 位的加密函数与加密密钥索引随机 串, p是自然数, p> mx [log2 w + log2
Figure imgf000017_0001
+ 2] , 其中[1082 " + 1。82 111& (1^ ) + 2]是对 log2« + log2max(gi)+2的取整运算。
判断所生成的加密函数与加密密钥索引随机串是否曾经被使用过,如果是, 则重新生成加密函数与加密密钥索引随机串, 否则保留该加密函数与加密密钥 索引随机串待用
为加密函数与加密密钥集合中每种加密算法分配十进制数字标识, 如第一 种加密函数分配 0 , 第二种加密函数分配 1 , 第三种加密函数分配 2 , 第四种加 密函数分配 3 , 依次类推。
对每种加密函数对应的供选加密密钥分配十进制数字标识, 如第一种加密 函数的第一个加密密钥分配 0 , 第二种加密函数的第二个加密密钥分配 2 ,如此 类推。
在 p位随机串中预定一个随机起始位置, 从随机串该 p位置和明文的头部 开始同步遍历数据, 每次遍历先取 log2« (如果 log2«是整数)或 [log2«]+l (如 果 log2«非整数)位,其中 [log2«]是对 log2«的取整运算,将每次遍历所取的 log2« 或 [log2«]+l位二进制数转换为十进制数, 然后将转换所得值对 n作取模运算, 取模的值作为该位明文数据对应的加密函数索引。
然后继续遍历再取 log2max(gi) (如果 log2max(gi)是整数 )或 [log2max(gi)]+l (如果 log2max(gi)不是整数 )位, 对该明文数据位已分配的第 j个加密函数 /算 法而言, 将遍历所取 log2max(gi)或 [log2max(gi)]+l位数据转换为十进制数, 对 gi做取模运算, 取模的值作为该位明文数据对应的第 j个加密函数所使用加密 密钥索引。
继续同步遍历加密函数与加密密钥索引随机串和明文, 当数据遍历到加密 函数与加密密钥索引随机串尾部时, 回到头部继续遍历, 直到所有明文位或部 分都被随机分配了加密函数。
每次数据采集前, 先产生两个随机值, 对其分别取模, 得到随机的起始游 标位置和所需采集的数据长度。 获得随机的起始游标位置和所需采集的数据长 度的方法同方法 1所述。
假定在数据遍历前, 生成了一个真随机数 R3 , 那么现在需要产生一个小于 p的随机值 T3 , T3就是 p位随机串遍历的起始位置, 那么
T3 = R3 mod p
其中, mod是取模运算。
为进一步说明本发明的可行性, 现对本方法 2加密函数与加密密钥索引随 机串的真随机性 /不可重现性分析。
与方法 1相比, 本方法 2中增加了一个影响整个方法随机性的因素, 即在 p位随机串中, 从一个随机位置开始遍历数据产生每个明文部分对应的加密算 法索引, 因为遍历的起始位置有 p种可能, 所以对应明文部分加密算法索引重 现的概率为: l/(p*wu)。
进一步以方法 1所设定数据为例, 这里 p> m x [log2 M + log2 maxC^ ) + 2] , 殳设 max(gj)=4 , 那么 p> 480,000,000 (即 480M位), 通过该实现方法产生 rek重复 的最小概率是 1/(4.8* 109∞8) , 可见其重复的概率已经足够低, 符合随机特征的 特性。 实际使用中, 还可以通过增加 、 u和 w的数值继续提高其随机性, 降 低其重复概率, 或者定期更换随机种子, 以提高整个方法的安全性。
总之, 通过以上实现可以证明加密函数与加密密钥随机分配方法在实际应 用中可行。
本发明与传统完美加密系统典型实现 OTP方法相比, 具有以下优势:
1 )因为有加密函数本身的保护作用(在不知其加密密钥的情况下, 需要 4艮 多计算能力才能将密文还原成唯一明文),可以有效降低在密码本(对本发明而 言, 对应的是加密函数索引本) 意外泄露后, 造成的数据泄漏的风险;
2 )整个系统的安全性保护被分散成三个部分一随机种子、加密函数与加密 密钥索引随机串和加密函数与加密密钥集合, 也就是说只有同时截获这三个部 分的信息, 才能够较容易破解密文, 相比于传统 OTP系统安全性仅依赖于大量 随机密钥保护一个部分, 数据泄漏风险被有效分散。
本发明实施例通过合理选择加密函数与加密密钥, 运用加密函数与加密密 钥随机轮转对明文每位数据位进行加密, 实现密文被截获后破解的后验概率与 密文破解的先验概率相等, 实现与传统 OTP方法具有相同加密强度, 同时相比 于传统 OTP系统安全性仅依赖于大量随机密钥保护一个部分,数据泄漏风险被 有效分散, 可以有效降低在密码本意外泄露后, 造成的数据泄漏的风险。
以上所述仅为本发明的较佳实施例而已, 并不用以限制本发明, 凡在本发 明的精神和原则之内所作的任何修改、 等同替换和改进等, 均应包含在本发明 的保护范围之内。

Claims

权 利 要 求 书
1、 一种数据加密方法, 其特征在于, 所述方法包括:
对待加密明文进行分组;
为每组明文数据随机分配加密函数与加密密钥;
用加密函数与加密密钥分别对所述每组明文数据进行加密;
将所述加密的数据按其对应的所述明文位置排列形成密文。
2、 如权利要求 1所述的数据加密方法, 其特征在于, 在所述对待加密明文 进行分组和为每组明文数据随机分配加密函数与加密密钥的步骤之间还包括: 生成预定长度的真随机数和由所述真随机数组成的预定长度的随机种子; 建立加密函数与加密密钥集合, 并对所述集合中的每个加密函数与加密密 钥分配索引;
对所述随机种子进行数据采集, 生成加密函数与加密密钥索引随机串; 同步遍历所述加密函数与加密密钥索引随机串和待加密明文。
3、 如权利要求 2所述的数据加密方法, 其特征在于, 所述加密函数与加密 密钥集合包括覆盖从待加密明文中任意 0、 1到密文中对应位置 0或 1的所有转 换路径的加密函数与加密密钥, 相应地, 确定所述覆盖从待加密明文中任意 0、 1到密文中对应位置 0或 1的所有转换路径的加密函数与加密密钥的步骤包括: 选择覆盖最多明文到密文可能转换路径的加密函数与加密密钥, 并记录所述可 能转换路径; 判断所述可能转换路径是否被完全覆盖, 如果是, 则将所有选择 的加密函数与加密密钥作为所述加密函数与加密密钥集合的元素; 否则, 选择 另一覆盖最多未覆盖的可能转换路径的加密函数与加密密钥, 并记录当前加密 函数与加密密钥覆盖的路径, 重新选择覆盖最多未覆盖的可能转换路径的加密 函数与加密密钥, 直至所选择的加密函数与加密密钥能覆盖所有的可能转换路 径, 将所有选择的加密函数与加密密钥作为所述加密函数与加密密钥集合的元 素。
4、 如权利要求 2所述的数据加密方法, 其特征在于, 所述对所述随机种子 进行数据采集, 生成加密函数与密密钥索引随机串的步骤还包括: 通过信息摘要运算分别生成所述加密函数与加密密钥索引随机串的信息摘 要值;
将所述信息摘要值与先前存储的信息摘要值进行比对, 如果一致, 则对所 述随机种子再次进行数据采集, 生成加密函数与加密密钥索引随机串, 否则, 保存当前所生成的加密函数与加密密钥索引随机串。
5、 如权利要求 1所述的数据加密方法, 其特征在于, 所述每组明文数据包 括至少一个明文比特位。
6、 一种数据加密装置, 其特征在于, 所述装置包括:
分组模块, 用于对待加密明文进行分组;
加密函数与加密密钥随机分配模块, 用于为所述分组模块分组后的每组明 文数据随机分配加密函数与加密密钥;
加密处理模块, 用于用所述加密函数与加密密钥随机分配模块分配的加密 函数与加密密钥对所述明文中的数据进行加密, 并将所述加密的数据按其对应 的所述明文位置排列形成密文。
7、 如权利要求 6所述的数据加密装置, 其特征在于, 所述装置还包括: 真随机数生成模块, 用于生成预定长度的真随机数和由所述真随机数组成 的预定长度的随机种子;
加密函数与加密密钥建立模块,用于建立并存储加密函数与加密密钥集合; 分配模块, 用于对所述加密函数与加密密钥建立模块建立的加密函数与加 密密钥集合中的每个加密函数与加密密钥分配索引;
加密函数与加密密钥索引随机串生成模块, 用于对所述真随机数生成模块 生成的随机种子进行数据采集, 生成加密函数与加密密钥索引随机串;
同步遍历模块, 用于同步遍历所述加密函数与加密密钥索引随机串生成模 块生成的加密函数与加密密钥索引随机串和待加密明文。
8、 如权利要求 7所述的数据加密装置, 其特征在于, 所述加密函数与加密 密钥索引随机串生成模块包括:
数据采集单元, 用于对所述真随机数生成模块生成的随机种子进行数据采 集, 并发送数据采集结果;
索引随机串生成单元, 用于根据接收的所述数据采集单元发送的数据采集 结果, 生成并保存加密函数与加密密钥索引随机串。
9、 如权利要求 8所述的数据加密装置, 其特征在于, 所述加密函数与加密 密钥索引随机串生成模块还包括:
信息摘要值生成模块, 用于通过信息摘要运算分别生成所述索引随机串生 成单元生成的加密函数与加密密钥索引随机串的信息摘要值;
存储模块, 用于存储所述信息摘要值生成模块生成的加密函数与加密密钥 索引随机串的信息摘要值;
比对模块, 用于将所述信息摘要值生成模块的信息摘要值与所述存储模块 先前存储的信息摘要值进行比对, 并向所述加密函数与加密密钥索引随机串生 成模块发送比对结果。
10、 一种数据解密方法, 其特征在于, 所述方法包括:
获取解密信息, 并根据所述解密信息从保存的随机种子中采集数据生成加 密函数与加密密钥索引随机串;
根据所述解密信息, 确定所述加密函数与加密密钥索引随机串的遍历起始 位置, 同步遍历所述加密函数与加密密钥索引随机串及待解密密文;
根据所述解密信息确定所述密文中各个比特位数据对应的加密函数与加密 密钥;
根据所述加密函数与加密密钥, 确定所述密文中各个比特位数据对应的解 密函数与解密密钥;
用所述解密函数与解密密钥将所述密文中各个比特位的数据还原成明文中 的各个比特位的数据;
将所述明文中各个比特位的数据按其所对应的密文位置排列, 形成明文。
11、 一种数据解密装置, 其特征在于, 所述装置包括:
获取模块, 用于获取解密信息;
随机种子存储模块, 用于存储加密时产生的随机种子;
加密函数与加密密钥索引随机串生成模块, 用于根据所述获取模块获取的 解密信息, 从所述随机种子存储模块保存的随机种子中采集数据生成加密函数 与加密密钥索引随机串;
同步遍历模块, 用于根据所述获取模块获取的解密信息, 确定所述加密函 数与加密密钥索引随机串的遍历起始位置, 同步遍历所述加密函数与加密密钥 索引随机串及待解密密文;
加密函数与加密密钥确定模块, 用于根据所述获取模块获取的解密信息, 确定所述密文中各个比特位数据对应的加密函数与加密密钥;
解密函数与解密密钥获取模块, 用于根据所述加密函数与加密密钥确定模 块确定的加密函数与加密密钥, 确定所述密文中各个比特位数据对应的解密函 数与解密密钥;
明文还原模块, 用于用所述解密函数与解密密钥将所述密文中各个比特位 的数据还原成明文中的各个比特位的数据, 并将所述明文中各个比特位的数据 按其所对应的密文位置排列, 形成明文。
PCT/CN2010/079319 2010-11-29 2010-12-01 一种数据加解密方法及装置 WO2012071717A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010563720.0 2010-11-29
CN201010563720A CN101984574B (zh) 2010-11-29 2010-11-29 一种数据加解密方法及装置

Publications (1)

Publication Number Publication Date
WO2012071717A1 true WO2012071717A1 (zh) 2012-06-07

Family

ID=43641745

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/079319 WO2012071717A1 (zh) 2010-11-29 2010-12-01 一种数据加解密方法及装置

Country Status (3)

Country Link
US (1) US9001998B2 (zh)
CN (1) CN101984574B (zh)
WO (1) WO2012071717A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114040366A (zh) * 2021-09-22 2022-02-11 惠州城市职业学院(惠州商贸旅游高级职业技术学校) 一种网络通信安全性高的蓝牙连接加密方法
CN114285575A (zh) * 2021-12-28 2022-04-05 中国电信股份有限公司 图像加密和解密方法和装置、存储介质及电子装置
CN114340113A (zh) * 2021-12-30 2022-04-12 智马达汽车有限公司 基于车辆灯光的信息处理方法及装置
CN117614731A (zh) * 2023-12-11 2024-02-27 杭州广安汽车电器有限公司 基于云计算平台的车辆空调数据安全传输方法

Families Citing this family (36)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101824044B1 (ko) * 2011-05-17 2018-01-31 삼성전자주식회사 부호화 출력 기능을 구비한 데이터 저장 장치 및 시스템
CN102611711A (zh) * 2012-04-09 2012-07-25 中山爱科数字科技股份有限公司 一种云数据安全存储方法
US9425825B2 (en) 2012-05-22 2016-08-23 International Business Machines Corporation Path encoding and decoding
EP2974116B1 (en) * 2013-03-15 2018-10-31 EntIT Software LLC Sending encrypted data to a service provider
CN103312496A (zh) * 2013-05-10 2013-09-18 北京国基科技股份有限公司 数据加密、解密方法和装置及数据加解密系统
US9043613B2 (en) * 2013-06-28 2015-05-26 International Business Machines Corporation Multiple volume encryption of storage devices using self encrypting drive (SED)
CN103488915B (zh) * 2013-09-24 2015-12-23 无锡德思普科技有限公司 一种软硬件相结合的双重密钥加密的资源加密解密方法
WO2015120170A1 (en) * 2014-02-05 2015-08-13 Bigdatabio, Llc Methods and systems for biological sequence compression transfer and encryption
GB2533392A (en) 2014-12-19 2016-06-22 Ibm Path encoding and decoding
GB2533391A (en) 2014-12-19 2016-06-22 Ibm Wall encoding and decoding
GB2533393A (en) 2014-12-19 2016-06-22 Ibm Pad encoding and decoding
US10728043B2 (en) * 2015-07-21 2020-07-28 Entrust, Inc. Method and apparatus for providing secure communication among constrained devices
US9660803B2 (en) 2015-09-15 2017-05-23 Global Risk Advisors Device and method for resonant cryptography
CN105933287A (zh) * 2016-04-05 2016-09-07 江苏电力信息技术有限公司 一种移动安全数据的防护方法
CN108028754B (zh) * 2016-04-28 2020-12-01 华为技术有限公司 加密、解密方法、装置及终端
US9950261B2 (en) 2016-04-29 2018-04-24 International Business Machines Corporation Secure data encoding for low-resource remote systems
CN105871550B (zh) * 2016-06-13 2019-04-09 四川特伦特科技股份有限公司 一种实现数字信号加密传输的系统
CN106788983B (zh) * 2017-03-01 2020-07-10 北京同有飞骥科技股份有限公司 一种基于客户端/服务器模式的通讯数据加密方法及装置
CN109218774B (zh) * 2017-06-30 2020-10-16 武汉斗鱼网络科技有限公司 一种提高视频播放安全性的方法、服务器及计算机设备
CN107612684B (zh) * 2017-10-20 2020-09-15 中博龙辉装备集团股份有限公司 基于国产化处理器平台专有指令集的数据对称加密方法
CN108377183B (zh) * 2017-12-20 2020-11-13 中国移动通信集团福建有限公司 Xdr数据信息加密方法、装置、设备及介质
CN108123804B (zh) * 2017-12-29 2021-03-26 广州汇智通信技术有限公司 一种数据解密的执行方法、装置及介质
CN108768649A (zh) * 2018-06-26 2018-11-06 苏州蜗牛数字科技股份有限公司 一种动态加密网络数据的方法及存储介质
CN109714154B (zh) * 2019-03-05 2021-10-29 同济大学 一种代码体积困难白盒安全模型下的白盒密码算法的实现方法
CN110069939A (zh) * 2019-03-12 2019-07-30 平安科技(深圳)有限公司 加密数据一致性校验方法、装置、计算机设备及存储介质
CN110519039B (zh) * 2019-07-29 2022-11-18 北京多思安全芯片科技有限公司 一种数据的同态处理方法、设备和介质
CN111224974A (zh) * 2019-12-31 2020-06-02 北京安码科技有限公司 用于网络通信内容加密的方法、系统、电子设备及存储介质
CN111212068B (zh) * 2019-12-31 2022-02-08 北京升鑫网络科技有限公司 一种输入法对文字加解密的方法
CN112165443B (zh) * 2020-08-01 2023-06-02 广东电网有限责任公司广州供电局 一种多密钥信息加密解密方法、装置及存储介质
CN112260822B (zh) * 2020-09-16 2024-02-27 杜绍森 一种结构化数字水印加密方法及装置
CN112702318A (zh) * 2020-12-09 2021-04-23 江苏通付盾信息安全技术有限公司 一种通讯加密方法、解密方法、客户端及服务端
CN114006767A (zh) * 2021-11-10 2022-02-01 中交长大桥隧技术有限公司 一种基于科技智能的隧道安全健康评定、监测系统
CN114553549B (zh) * 2022-02-24 2024-01-02 江苏商贸职业学院 一种数据加密方法及系统
CN114640443B (zh) * 2022-03-17 2023-05-09 浙江广厦建设职业技术大学 一种在线工程报价安全交互方法和系统
CN117336100B (zh) * 2023-11-27 2024-02-23 湖南湘科智慧科技有限公司 基于押运服务多方扁平化沟通的数据处理方法及装置
CN117521149B (zh) * 2024-01-03 2024-03-19 中电信量子科技有限公司 基于量子密码设备的文件系统流加解密方法及系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1645796A (zh) * 2005-02-28 2005-07-27 胡祥义 采用双重认证协议来防止用户口令被盗用的方法
CN1924835A (zh) * 2006-09-01 2007-03-07 西安交通大学 一种基于动态密钥的硬盘数据加密方法及其装置
US20090214043A1 (en) * 2008-02-22 2009-08-27 Sungkyunkwan University Foundation For Corporate Collaboration Key distribution method and authentication server
CN101692636A (zh) * 2009-10-27 2010-04-07 中山爱科数字科技有限公司 一种基于数据元和坐标算法的混合型数据加密的方法和装置

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4803725A (en) * 1985-03-11 1989-02-07 General Instrument Corp. Cryptographic system using interchangeable key blocks and selectable key fragments
US5319712A (en) * 1993-08-26 1994-06-07 Motorola, Inc. Method and apparatus for providing cryptographic protection of a data stream in a communication system
JP3747520B2 (ja) * 1996-01-30 2006-02-22 富士ゼロックス株式会社 情報処理装置及び情報処理方法
US6704871B1 (en) * 1997-09-16 2004-03-09 Safenet, Inc. Cryptographic co-processor
FI108827B (fi) * 1998-01-08 2002-03-28 Nokia Corp Menetelmä yhteyden suojauksen toteuttamiseksi langattomassa verkossa
US6834341B1 (en) * 2000-02-22 2004-12-21 Microsoft Corporation Authentication methods and systems for accessing networks, authentication methods and systems for accessing the internet
CA2413690A1 (en) * 2002-12-06 2004-06-06 Ibm Canada Limited-Ibm Canada Limitee Zero knowledge document comparison between mutually distrustful parties
CA2560550A1 (en) * 2004-03-18 2005-09-29 Qualcomm Incorporated Efficient transmission of cryptographic information in secure real time protocol
CN1697369A (zh) * 2005-06-14 2005-11-16 河北工业大学 分组密码加密解密的方法及其加密解密器
US8020006B2 (en) * 2006-02-10 2011-09-13 Cisco Technology, Inc. Pipeline for high-throughput encrypt functions
US20100208894A1 (en) * 2006-09-29 2010-08-19 Linx Technologies, Inc. Encoder and decoder apparatus and methods
CN101013938B (zh) * 2007-01-12 2010-04-07 广州市诚毅科技软件开发有限公司 一种分组密码加密方法
GB0905184D0 (en) * 2009-03-26 2009-05-06 Univ Bristol Encryption scheme

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1645796A (zh) * 2005-02-28 2005-07-27 胡祥义 采用双重认证协议来防止用户口令被盗用的方法
CN1924835A (zh) * 2006-09-01 2007-03-07 西安交通大学 一种基于动态密钥的硬盘数据加密方法及其装置
US20090214043A1 (en) * 2008-02-22 2009-08-27 Sungkyunkwan University Foundation For Corporate Collaboration Key distribution method and authentication server
CN101692636A (zh) * 2009-10-27 2010-04-07 中山爱科数字科技有限公司 一种基于数据元和坐标算法的混合型数据加密的方法和装置

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114040366A (zh) * 2021-09-22 2022-02-11 惠州城市职业学院(惠州商贸旅游高级职业技术学校) 一种网络通信安全性高的蓝牙连接加密方法
CN114040366B (zh) * 2021-09-22 2024-04-09 惠州城市职业学院(惠州商贸旅游高级职业技术学校) 一种网络通信安全性高的蓝牙连接加密方法
CN114285575A (zh) * 2021-12-28 2022-04-05 中国电信股份有限公司 图像加密和解密方法和装置、存储介质及电子装置
CN114285575B (zh) * 2021-12-28 2024-04-05 中国电信股份有限公司 图像加密和解密方法和装置、存储介质及电子装置
CN114340113A (zh) * 2021-12-30 2022-04-12 智马达汽车有限公司 基于车辆灯光的信息处理方法及装置
CN114340113B (zh) * 2021-12-30 2023-10-13 浙江智马达智能科技有限公司 基于车辆灯光的信息处理方法及装置
CN117614731A (zh) * 2023-12-11 2024-02-27 杭州广安汽车电器有限公司 基于云计算平台的车辆空调数据安全传输方法
CN117614731B (zh) * 2023-12-11 2024-06-04 杭州广安汽车电器有限公司 基于云计算平台的车辆空调数据安全传输方法

Also Published As

Publication number Publication date
CN101984574B (zh) 2012-09-05
US20140105382A1 (en) 2014-04-17
CN101984574A (zh) 2011-03-09
US9001998B2 (en) 2015-04-07

Similar Documents

Publication Publication Date Title
WO2012071717A1 (zh) 一种数据加解密方法及装置
WO2012071714A1 (zh) 一种数据加解密方法及装置
US8401186B2 (en) Cloud storage data access method, apparatus and system based on OTP
US8942373B2 (en) Data encryption and decryption method and apparatus
US10237248B2 (en) Encoder, decoder and method
WO2012071722A1 (zh) 一种基于otp的云存储数据存储方法、装置及系统
KR102619383B1 (ko) 에폭 키 교환을 이용한 종단간 이중 래칫 암호화
WO2012071725A1 (zh) 一种数据选择加密解密方法及装置
WO2016119625A1 (zh) 乱码本有限单向变换及其加解密应用的方法、装置和电路
WO2012071728A1 (zh) 一种云存储数据加密方法、装置及系统
US20220303118A1 (en) Cryptographic systems and methods for extending apparent size of pools of truly random numbers
US11296869B2 (en) Apparatus and method for unbreakable data encryption
KR102482908B1 (ko) 네트워크 보안 대칭형 양자 암호키 기반 암호화 장치
Chakrabarti et al. A novel approach towards realizing optimum data transfer and Automatic Variable Key (AVK) in cryptography
WO2012071718A1 (zh) 一种云存储的数据存储与取回的方法、装置及系统
CA3056814A1 (en) Symmetric cryptographic method and system and applications thereof
US8458452B1 (en) System and method for encryption and decryption of data transferred between computer systems
WO2019225735A1 (ja) データ処理装置、方法及びコンピュータプログラム
CN116132016A (zh) 一种密码算法的加性扩展实现方法
Meng et al. A multi-connection encryption algorithm applied in secure channel service system
Pushpa Enhancing Data Security by Adapting Network Security and Cryptographic Paradigms
KR20220137024A (ko) 대칭 비동기 생성 암호화 방법
Kumar et al. Enhanced cost effective symmetric key algorithm for small amount of data
Khalil et al. Modify PRESENT Algorithm by New technique and key Generator by External unit
Zhou et al. An encryption algorithm based on multi-connection transmission

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10860164

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10860164

Country of ref document: EP

Kind code of ref document: A1