Disclosure of Invention
The invention aims to provide a data encryption method and a data encryption system so as to improve the quantum key amount of data to be encrypted.
The invention solves the technical problems through the following technical scheme: the embodiment of the invention provides a data encryption method, which is applied to a data encryption storage module in a quantum encryption database system, and comprises the following steps:
inputting data to be encrypted, and generating a data index value of the data to be encrypted;
generating a quantum random number;
encrypting the data to be encrypted by taking the quantum random number as an encryption key;
storing the encrypted data to be encrypted;
quantum keys are generated in a data encryption storage module and a key encryption storage module by using a quantum key distribution technology, a data index value of the data to be encrypted and the encryption key are encrypted by using the quantum keys through a classical encryption algorithm, and the encrypted encryption key and the data index value are sent to a key encryption storage module so that the key encryption storage module stores the encryption key and the data index value.
Optionally, the encrypting the data to be encrypted by using the quantum random number as an encryption key includes:
judging whether the data volume of the data to be encrypted is larger than a first preset threshold value or not;
if so, encrypting the data to be encrypted with the data volume of a second preset threshold value by using the quantum random number as an encryption key, wherein the second preset threshold value is larger than the first preset threshold value;
and if not, encrypting the data to be encrypted by taking the quantum random number with the same character length as the data to be encrypted as an encryption key.
The embodiment of the invention also provides a data encryption method, which is applied to a key encryption storage module in a quantum encryption database system, and the method comprises the following steps:
receiving an encrypted data index value and the encryption key which are sent by a data encryption storage module in the quantum encryption database system, wherein the encryption key is a quantum random number sent by the data encryption storage module in the quantum encryption database system;
decrypting the data index value and the encryption key by using a quantum key obtained by a quantum key distribution technology through a classical decryption algorithm, and encrypting the encryption key by using a root key;
the data index value is stored along with the encryption key encrypted using the root key.
An embodiment of the present invention further provides a data encryption system, where the system includes: a data encryption storage module and a key encryption storage module, wherein,
the data encryption storage module comprises: the device comprises a data encryption and decryption device, and a data index generation device, a quantum random number generation device, a data storage device and a first quantum key distribution device which are respectively in communication connection with the data encryption and decryption device, wherein the data index generation device is used for generating a data index value of data to be encrypted; quantum random number generating means for generating quantum random numbers; the data encryption and decryption device is used for encrypting the data to be encrypted by taking the quantum random number as an encryption key; generating a quantum key at a data encryption storage module and a key encryption storage module by using a quantum key distribution technology, encrypting a data index value of the data to be encrypted and the encryption key by using the quantum key through a classical encryption algorithm, and sending the encrypted encryption key and the data index value to a key encryption storage module so that the key encryption storage module stores the encryption key and the data index value; the data storage device is used for storing the data index value and the encrypted data to be encrypted;
the key encryption storage module comprises: the system comprises a key encryption and decryption device, a key storage device and a second quantum key distribution device, wherein the key storage device and the second quantum key distribution device are respectively in communication connection with the key encryption and decryption device, the key encryption and decryption device is used for receiving the encrypted data index value and the encrypted key which are sent by the data encryption storage module, decrypting the data index value and the encrypted key by using a quantum key obtained by using a quantum key distribution technology through a classical decryption algorithm, and encrypting the encrypted key by using a root key; the key storage device is used for storing the data index value and an encryption key encrypted by using a root key;
the first quantum key distribution device and the second quantum key distribution device are used for generating a pair of quantum keys in the data encryption storage module and the key encryption storage module by using a quantum key distribution technology.
Optionally, the data encryption and decryption apparatus is further configured to:
judging whether the data volume of the data to be encrypted is larger than a first preset threshold value or not;
if so, encrypting the data to be encrypted with the data volume of a second preset threshold value by using the quantum random number as an encryption key, wherein the second preset threshold value is larger than the first preset threshold value;
if not, the quantum random number with the character length equal to that of the data to be encrypted is used as an encryption key to encrypt the data to be encrypted.
Optionally, the data to be encrypted is composed of multiple lines of data, and the second preset threshold is:
the sum of the data amounts of the data to be encrypted of at least one line.
Optionally, the root key is a hardware root key.
Optionally, the classical encryption algorithm includes: a symmetric encryption algorithm.
Optionally, the data index generating device is configured to generate a data index value of the data to be encrypted by using an irreversible algorithm.
Optionally, the irreversible algorithm includes: and (4) carrying out a hash algorithm.
Compared with the prior art, the invention has the following advantages:
by applying the embodiment of the invention, the quantum true random number generated by the quantum random number generator is used as the database data segment encryption key, the generation rate of the quantum random number generator key can reach Gbps magnitude, and the requirement of large key amount for large data encryption can be met.
Detailed Description
The following examples are given for the detailed implementation and the specific operation procedures, but the scope of the present invention is not limited to the following examples.
Example 1
Fig. 2 is a schematic structural diagram of a data encryption system according to an embodiment of the present invention, and as shown in fig. 2, the system includes: a data encryption storage module and a key encryption storage module, wherein,
the data encryption storage module comprises: the device comprises a data encryption and decryption device, and a data index generation device, a quantum random number generation device, a data storage device and a first quantum key distribution device which are respectively in communication connection with the data encryption and decryption device, wherein the data index generation device is used for generating a data index value of data to be encrypted; quantum random number generating means for generating quantum random numbers; the data encryption and decryption device is used for judging whether the data volume of the data to be encrypted is larger than a first preset threshold value or not; if so, encrypting the data to be encrypted with the data volume of a second preset threshold value by using the quantum random number as an encryption key, wherein the second preset threshold value is larger than the first preset threshold value; if not, encrypting the data to be encrypted by taking the quantum random number with the same character length as the data to be encrypted as an encryption key; encrypting the data to be encrypted by using the quantum random number as an encryption key; generating a quantum key at a data encryption storage module and a key encryption storage module by using a quantum key distribution technology, encrypting a data index value of the data to be encrypted and the encryption key by using the quantum key through a classical encryption algorithm, and sending the encrypted encryption key and the data index value to a key encryption storage module so that the key encryption storage module stores the encryption key and the data index value; the classical encryption algorithm comprises: a symmetric encryption algorithm; sending the data index value of the data to be encrypted and the encryption key to a key encryption storage module in the quantum encryption database system so that the key encryption storage module stores the encryption key; the data storage device is used for storing the data index value and the encrypted data to be encrypted;
the key encryption storage module comprises: the system comprises a key encryption and decryption device, a key storage device and a second quantum key distribution device, wherein the key storage device and the second quantum key distribution device are respectively in communication connection with the key encryption and decryption device, the key encryption and decryption device is used for receiving an encrypted data index value and an encrypted key which are sent by the data encryption storage module, decrypting the data index value and the encrypted key by using a classical decryption algorithm through a quantum key obtained by using a quantum key distribution technology, and encrypting the encrypted key by using a root key; the key storage device is used for storing a data index value and an encryption key encrypted by using a root key.
The first quantum key distribution device and the second quantum key distribution device are used for generating a pair of quantum keys in the data encryption storage module and the key encryption storage module by using a quantum key distribution technology.
By applying the embodiment shown in FIG. 2 of the invention, the quantum random number generated by the quantum random number generator is used as the encryption key of the database data segment, the generation rate of the key of the quantum random number generator can reach Gbps magnitude, and the requirement of large key amount for large data encryption can be met.
Example 2
It is first emphasized that the embodiments of the present invention provide a data encryption method, which is preferably applied to a data encryption storage module in a quantum encryption database system.
Fig. 3 is a schematic flow chart of a data encryption method according to an embodiment of the present invention, as shown in fig. 3, the method includes:
s301: inputting data to be encrypted, and generating a data index value of the data to be encrypted.
Specifically, in this step, the data index generating device receives the data to be encrypted, or obtains the data to be encrypted from the database, and processes the data to be encrypted by using a one-way irreversible algorithm, such as a hash algorithm, to obtain a data index value of the data to be encrypted.
In practical application, the data index generating device intercepts fields with set length from the data to be encrypted, or intercepts fields with set length from the data to be encrypted in the database as the input of a one-way irreversible algorithm, and processes the data to be encrypted by using the one-way irreversible algorithm, such as a hash algorithm, to obtain the data index value of the data to be encrypted.
S302: quantum random numbers are generated.
Specifically, the data encryption/decryption device in the data encryption memory module may use the quantum random number in the quantum random number sequence generated from the quantum random number generation device as the encryption key.
S303: and encrypting the data to be encrypted by taking the quantum random number as an encryption key.
S304: and storing the data index value and the encrypted data to be encrypted.
Fig. 4 is a comparison diagram of plaintext data, encrypted key data, and encrypted ciphertext data according to an embodiment of the present invention; as shown in fig. 4, the plaintext data is encrypted by the data encryption/decryption device and stored in the data storage device as ciphertext data.
S305: quantum keys are generated in a data encryption storage module and a key encryption storage module by using a quantum key distribution technology, a data index value of the data to be encrypted and the encryption key are encrypted by using the quantum keys through a classical encryption algorithm, and the encrypted encryption key and the data index value are sent to a key encryption storage module so that the key encryption storage module stores the encryption key and the data index value.
Specifically, a quantum key may be generated in a data encryption storage module and a key encryption storage module by using a quantum key distribution technology, the data index value of the data to be encrypted and the encryption key are encrypted by using the quantum key, and the encrypted data index value of the data to be encrypted and the encryption key are sent to a key encryption storage module in the quantum encryption database system. The key encryption and decryption device decrypts by using the quantum key after receiving the encrypted encryption key and the encrypted data index value, encrypts the encryption key by using the root key, and stores the data index value and the encrypted key into the key storage device in the key encryption storage module.
As shown in fig. 4, the data index value and the encryption key encrypted using the root key are stored in the key storage device. The plaintext data in fig. 4 corresponds to data to be encrypted, the key data corresponds to an encryption key, and the ciphertext data corresponds to encrypted data. The plaintext data is encrypted by using the key data in fig. 4 to obtain ciphertext data.
In the prior art, a quantum key distribution technique is used to generate keys, which are generated at a rate on the order of hundreds of kb per second and decay as the distance between the data encryption memory module and the key encryption memory module increases.
By applying the embodiment shown in FIG. 2 of the invention, the quantum random number generated by the quantum random number generator is used as the encryption key of the database data segment, the generation rate of the key of the quantum random number generator can reach Gbps magnitude, and the requirement of large key amount for large data encryption can be met.
In addition, in the prior art, the number of keys generated by the quantum key distribution device needs to meet the encryption requirement of each data segment in the database and the encryption transmission requirement of the keys during query, so that the requirement amount of the keys is large, and the key requirement is difficult to meet especially in large-scale data encryption application scenes such as data centers.
In a specific implementation manner of the embodiment of the present invention, in order to improve the security of data in the database, the data encryption storage module and the key encryption storage module are mutually independent devices, for example, there is no shared device or component between the data encryption storage module and the key encryption storage module, and the data encryption storage module and the key encryption storage module may be located in different cabinets in the same machine room or may be located in machine rooms in different places respectively.
Example 3
The difference between embodiment 3 of the present invention and embodiment 2 of the present invention is that in step S303, it may be determined whether the data size of the data to be encrypted is greater than a first preset threshold; if so, encrypting the data to be encrypted with the data volume of a second preset threshold value by using the quantum random number as an encryption key, wherein the second preset threshold value is larger than the first preset threshold value; and if not, encrypting the data to be encrypted by taking the quantum random number with the same character length as the data to be encrypted as an encryption key.
For example, when the data amount of the data to be encrypted is small, for example, the data amount is smaller than a first preset threshold, for example, 1kb, the data to be encrypted is encrypted by using a quantum random number string having the same length as the character length of the data to be encrypted, and this encryption manner may also be referred to as "one-time pad". When the data volume of the data to be encrypted is large, for example, the data volume of the data to be encrypted is a second preset threshold, for example, 2.3kb, the encryption key is directly used for encryption, for example, 150kb of data to be encrypted can be encrypted by using a 50kb quantum random number, or 2.3kb of data to be encrypted can be encrypted by using a 0.5kb quantum random number.
In practical applications, the number of rows of the character string, the number of bits corresponding to the character string, and other ways may be used to measure the data amount, and the embodiment of the present invention is not limited thereto. By applying the embodiment of the invention, the security of the database and the key amount requirement of big data encryption can be well considered.
Further, the data to be encrypted may be composed of a plurality of lines of data, and the second preset threshold is: sum of data amounts of data to be encrypted of at least one line.
The data encryption and decryption device stores the data to be encrypted, which is encrypted by using the quantum random number, in the data storage device, and then the first quantum key distribution device and the second quantum key distribution device generate a pair of quantum keys. The data encryption and decryption device encrypts the data index value and the key by using a quantum key by using a symmetric encryption algorithm, and sends the encrypted data index value and the key to the key encryption and decryption device, so that the key encryption and decryption device decrypts by using the quantum key after receiving the encrypted encryption key and the encrypted data index value, and then stores the data index value and the key to the key encryption and decryption device in the key encryption storage terminal.
Example 4
Theembodiment 4 of the invention is applied to a key encryption storage module in a quantum encryption database system, and the method comprises the following steps:
receiving an encrypted data index value and the encryption key which are sent by a data encryption storage module in the quantum encryption database system, wherein the encryption key is a quantum random number sent by the data encryption storage module in the quantum encryption database system;
and decrypting the data index value and the encryption key by using a quantum key obtained by using a quantum key distribution technology through a classical decryption algorithm, and encrypting the encryption key by using a root key.
Specifically, a key encryption/decryption device in the key encryption/storage module may receive the encrypted data index value and the encrypted encryption key, acquire a quantum key by using a quantum key distribution technique, and decrypt the encryption key through a classical decryption algorithm according to the quantum key, where the classical decryption algorithm includes: a symmetric decryption algorithm.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.