Data encryption method and device, data decryption method and device, electronic equipment and storage medium

The key is generated and managed through the key management system, and the data is encrypted multiple times, which solves the problem of reduced security caused by key leakage after data encryption and improves the security of data transmission.

CN118764256APending Publication Date: 2024-10-11CHINA TELECOM CORP LTD

Patent Information

Application Number
CN202410917766.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-09
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

In the existing technology, after the encrypted ciphertext of data is leaked, sensitive data can be decrypted using the leaked key, resulting in reduced data transmission security.

Method used

The initial key is generated through the key management system, and the key is used for multiple encryptions to generate the final ciphertext. The key is not stored at the data sending end or receiving end, but is stored in the key management system, using different encryption keys. The key encrypts the data multiple times.

Benefits of technology

It improves the security of data encryption, reduces the risk of key leakage, ensures that even if the key is leaked, the data cannot be directly decrypted, and enhances the security of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118764256A_ABST
    Figure CN118764256A_ABST
Patent Text Reader

Abstract

The invention provides a data encryption method and device, a data decryption method and device, electronic equipment and a storage medium, and the encryption method comprises the steps: generating an initial secret key for a data transmitting end in response to the received application of the data transmitting end; encrypting plaintext data to be sent by the data sending end by using the initial key to obtain a first ciphertext; generating a second key based on the initial key; encrypting the first ciphertext by using the second secret key to obtain a second ciphertext; encrypting the second ciphertext based on the key identifier of the second key to generate a final ciphertext; and sending the final ciphertext to a data sending end, so that the data sending end sends the received final ciphertext to a data receiving end. According to the invention, the to-be-transmitted data is encrypted for multiple times through different keys, so that the security of data encryption is improved. And the encrypted secret key is generated and managed by the secret key management system, so that the risk of secret key leakage is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data security technology, and in particular to a data encryption method, a data decryption method, a device, an electronic device and a computer-readable storage medium. Background Art

[0002] With the development of Internet communication technology, the amount of accumulated information is increasing, especially information involving personal privacy or confidential information of enterprises and institutions, which needs to be encrypted during the transmission process.

[0003] In the related art, the commonly used encryption / decryption method is to configure the key in the system environment variable, and obtain the key from the operating system environment variable for encryption / decryption each time the data is encrypted or decrypted. However, the currently configured keys are fixed, and as the use time increases, the risk of key leakage or cracking will also increase. Once the encrypted sensitive data ciphertext is leaked, the leaked key can be used to decrypt and obtain the sensitive data, resulting in a problem of reduced data security.

[0004] Therefore, how to effectively protect data to improve the security of data transmission is a technical problem that needs to be solved. Summary of the invention

[0005] The present invention provides a data encryption method, a data decryption method, a device, an electronic device, and a computer-readable storage medium, to at least solve the technical problem in the related art that the security of data transmission is reduced due to the leakage of encrypted data and the use of the leaked key to decrypt and obtain sensitive data. The technical solution of the present invention is as follows:

[0006] According to a first aspect of an embodiment of the present invention, a data encryption method is provided, the method being applied to a key management system, comprising:

[0007] In response to receiving an application from a data sending terminal for generating an initial secret key, generating an initial secret key for the data sending terminal;

[0008] Using the initial key to encrypt the plaintext data to be sent by the data sending end to obtain a first ciphertext;

[0009] generating a second key based on the initial key;

[0010] Encrypting the first ciphertext using the second secret key to obtain a second ciphertext;

[0011] Encrypting the second ciphertext based on the key identifier of the second secret key to generate a final ciphertext;

[0012] The final ciphertext is sent to a data sending end, so that the data sending end sends the final ciphertext to a data receiving end.

[0013] Optionally, generating a second key based on the initial key includes:

[0014] Using a hash function to convert the initial key into a binary string of fixed length;

[0015] Obtain a true random value, and convert the true random value into a binary sequence of the same length;

[0016] Performing a logical operation on the binary string of the same length and the binary sequence;

[0017] The result of the logical operation is used as the second key.

[0018] Optionally, performing a logical operation on the binary character string of the same length and the binary sequence includes:

[0019] Performing an XOR operation on the binary string of the same length and the binary sequence;

[0020] Compare two binary numbers of the same length.

[0021] If they are the same, the comparison result bit is set to 0, if they are different, the comparison result bit is set to 1.

[0022] Optionally, encrypting the second ciphertext based on the key identifier of the second secret key to generate a final ciphertext includes:

[0023] The final ciphertext is generated according to the set ciphertext structure using the key identifier length of the second key, the key identifier, the length of the second ciphertext and the second ciphertext.

[0024] Optionally, the method further includes:

[0025] Receiving the final ciphertext sent by the data receiving end;

[0026] Obtaining a first ciphertext and an initial key for initial encryption of the final ciphertext;

[0027] The first ciphertext is decrypted using the initial key to obtain plaintext data.

[0028] Optionally, obtaining the first ciphertext and the initial key for initial encryption of the final ciphertext includes:

[0029] Obtaining a key identifier and a final key of a final key based on the final ciphertext;

[0030] Decrypting the final ciphertext based on the final secret key to obtain a second ciphertext that is twice encrypted;

[0031] Decrypting the second ciphertext encrypted twice using the final key to obtain the first ciphertext encrypted once;

[0032] According to the corresponding relationship between the final key and the true random value, find the corresponding true random value;

[0033] Converting the true random value into a binary sequence;

[0034] Performing logical processing on the binary sequence and the final key to obtain a binary string;

[0035] The binary string is converted using a hash function to obtain an initial key.

[0036] According to a second aspect of an embodiment of the present invention, a data encryption method is provided, the method being applied to a data sending end, comprising:

[0037] Applying for an initial key from a key management system so that the key management system generates an initial key for the data sending end;

[0038] Apply to the key management system to use the initial key to encrypt data, so that the key management system uses the initial key to encrypt the plaintext data to be sent to obtain a first ciphertext; generate a second key based on the initial key; encrypt the first ciphertext using the second key to obtain a second ciphertext; encrypt the second ciphertext based on the key identifier of the second key to generate a final ciphertext;

[0039] The final ciphertext is sent to the data receiving end.

[0040] According to a third aspect of an embodiment of the present invention, a data decryption method is provided, the method being applied to a data receiving end, comprising:

[0041] Receive the final ciphertext sent by the data receiving end;

[0042] The final ciphertext is sent to the key management system so that the key management system receives the final ciphertext sent by the data receiving end; obtains the first ciphertext and the initial key of the initial encryption of the final ciphertext; and uses the initial key to decrypt the first ciphertext to obtain plaintext data.

[0043] According to a fourth aspect of an embodiment of the present invention, there is provided a data encryption device, which is applied to a key management system and includes:

[0044] A first generating module, configured to generate an initial key for the data sending end in response to receiving an application from the data sending end for generating an initial key;

[0045] A first encryption module, used to encrypt the plaintext data to be sent by the data sending end using the initial key to obtain a first ciphertext;

[0046] A second generating module, used for generating a second key based on the initial key;

[0047] A second encryption module, used to encrypt the first ciphertext using the second secret key to obtain a second ciphertext;

[0048] A third encryption module, used to encrypt the second ciphertext based on the key identifier of the second secret key to generate a final ciphertext;

[0049] The sending module is used to send the final ciphertext to the data sending end, so that the data sending end sends the final ciphertext to the data receiving end.

[0050] Optionally, the second generating module includes:

[0051] A first conversion module, used for converting the initial key into a binary string of fixed length using a hash function;

[0052] A first acquisition module, used to acquire a true random value, and convert the true random value into a binary sequence of the same length;

[0053] A logic operation module, used for performing a logic operation on the binary character string of the same length and the binary sequence;

[0054] The determination module is used to use the result obtained by the logic operation as the second key.

[0055] Optionally, the logic operation module includes:

[0056] An XOR operation module, used for performing an XOR operation on the binary string of the same length and the binary sequence;

[0057] A comparison module, used for comparing two binary corresponding bit numbers of the same length;

[0058] The setting module is used to set the comparison result bit to 0 when the numbers of the corresponding bits compared by the comparison module are the same, and to set the comparison result bit to 1 when the numbers of the corresponding bits compared are different.

[0059] Optionally, the third encryption module includes a module specifically used to generate a final ciphertext according to a set ciphertext structure using the key identifier length of the second key, the key identifier, the length of the second ciphertext and the second ciphertext.

[0060] Optionally, the device further comprises:

[0061] A receiving module, used for receiving the final ciphertext sent by the data receiving end;

[0062] A second acquisition module, used to obtain the first ciphertext and the initial key of the initial encryption of the final ciphertext;

[0063] The decryption module is used to decrypt the first ciphertext using the initial key to obtain plaintext data.

[0064] Optionally, the acquisition module includes:

[0065] A key acquisition module, used to acquire a key identifier and a final key of a final key based on the final ciphertext;

[0066] A first decryption module, used to decrypt the final ciphertext based on the final secret key to obtain a second ciphertext that is twice encrypted;

[0067] A second decryption module is used to decrypt the second ciphertext encrypted twice using the final key to obtain the first ciphertext encrypted once;

[0068] A search module, used for searching the corresponding true random value according to the corresponding relationship between the final key and the true random value;

[0069] A second conversion module, used for converting the true random value into a binary sequence;

[0070] A processing module, used for performing logical processing on the binary sequence and the final key to obtain a binary string;

[0071] The third conversion module is used to convert the binary string using a hash function to obtain an initial key.

[0072] According to a fifth aspect of an embodiment of the present invention, there is provided a data encryption device, which is applied to a data sending end and includes:

[0073] A key application module, used to apply for an initial key from a key management system so that the key management system generates an initial key for the data sending end;

[0074] An application encryption module is used to apply to the key management system to use the initial key to encrypt data, so that the key management system uses the initial key to encrypt the plaintext data to be sent to obtain a first ciphertext; generate a second key based on the initial key; encrypt the first ciphertext using the second key to obtain a second ciphertext; encrypt the second ciphertext based on the key identifier of the second key to generate a final ciphertext;

[0075] The sending module is used to send the final ciphertext to the data receiving end.

[0076] According to a sixth aspect of an embodiment of the present invention, a data decryption device is provided, the device being applied to a data receiving end, comprising:

[0077] A receiving module, used for receiving the final ciphertext sent by the data receiving end;

[0078] The sending module is used to send the final ciphertext to the key management system so that when the key management system receives the final ciphertext sent by the data receiving end, it obtains the first ciphertext and the initial key of the initial encryption of the final ciphertext; and uses the initial key to decrypt the first ciphertext to obtain plaintext data.

[0079] According to a seventh aspect of an embodiment of the present invention, there is provided an electronic device, including:

[0080] processor;

[0081] a memory for storing instructions executable by the processor;

[0082] The processor is configured to execute the instructions to implement the data encryption method or the data decryption method as described above.

[0083] According to an eighth aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data encryption method as described above or the data decryption method as described above.

[0084] According to a ninth aspect of an embodiment of the present invention, there is provided a computer program product, comprising a computer program or instructions, which, when executed by a processor of an electronic device, implements the data encryption method as described above or the data decryption method as described above.

[0085] The technical solution provided by the embodiments of the present invention brings at least the following beneficial effects:

[0086] In an embodiment of the present invention, in response to receiving an application from a data sending end to generate an initial key, an initial key is generated for the data sending end; the plaintext data to be sent by the data sending end is encrypted using the initial key to obtain a first ciphertext; a second key is generated based on the initial key; the first ciphertext is encrypted using the second key to obtain a second ciphertext; the second ciphertext is encrypted based on a key identifier of the second key to generate a final ciphertext; the final ciphertext is sent to the data sending end so that the data sending end sends the final ciphertext to the data receiving end. In the present invention, the data to be transmitted is encrypted multiple times using different keys, thereby improving the security of data encryption. The encrypted keys are generated and managed by a key management system, thereby reducing the risk of key leakage.

[0087] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0088] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present invention, and are used together with the specification to explain the principles of the present invention, and do not constitute an improper limitation of the present invention. In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0089] Figure 1 It is a flow chart of a data encryption method provided by an embodiment of the present invention.

[0090] Figure 2 This is another flow chart of a data encryption method provided by an embodiment of the present invention.

[0091] Figure 3 The present invention provides a flowchart of a data decryption method.

[0092] Figure 4 It is a flow chart of an application example of a data encryption method provided by an embodiment of the present invention.

[0093] Figure 5 It is a block diagram of a data encryption device provided by an embodiment of the present invention.

[0094] Figure 6 It is another block diagram of a data encryption device provided by an embodiment of the present invention.

[0095] Figure 7 The invention discloses a block diagram of a data decryption device.

[0096] Figure 8 It is a block diagram of an electronic device provided by an embodiment of the present invention.

[0097] Fig. 9 It is a block diagram of a device for data encryption or decryption provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0098] In order to enable ordinary persons in the art to better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings.

[0099] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0100] Technical terms:

[0101] Ciphertext: Ciphertext is the encrypted text, and plaintext is the text before encryption. The word encryption sometimes refers to ciphertext, but it is usually used to refer to the method of encryption. The output after applying some disguise or transformation to the plaintext. It can also be understood as a set of characters or bits that cannot be directly understood. But the scrambled message can be restored by an algorithm, which is the opposite of plaintext.

[0102] Plain text: refers to unencrypted text (or string of characters) that can be understood by ordinary people. It is a cryptographic term. In a communication system, it may be a bit stream, such as text, bitmap, digitized voice or digitized video image.

[0103] Key: A key is a parameter that is input into an algorithm that converts plaintext into ciphertext or ciphertext into plaintext. Keys are divided into symmetric keys and asymmetric keys.

[0104] On the basis of understanding the above technical terms, please refer to the following embodiments.

[0105] Figure 1 is a flow chart of a data encryption method provided by an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0106] Step 101: In response to receiving an application from a data sending end for generating an initial key, an initial key is generated for the data sending end.

[0107] Step 102: Use the initial key to encrypt the plaintext data to be sent by the data sending end to obtain a first ciphertext.

[0108] Step 103: Generate a second key based on the initial key.

[0109] Step 104: Use the second secret key to encrypt the first ciphertext to obtain a second ciphertext.

[0110] Step 105: Encrypt the second ciphertext based on the key identifier of the second secret key to generate a final ciphertext.

[0111] Step 106: Send the final ciphertext to the data sending end, so that the data sending end sends the received final ciphertext to the data receiving end.

[0112] In the embodiment of the present invention, after the initial key is generated by the key management system, the data is encrypted using the initial key, and then a new key is generated using the initial key, and finally the encrypted data is encrypted again using the new key. In this way, the key does not need to be stored at the data sending end or the data receiving end, but is stored in the key management system; at the same time, the embodiment of the present invention encrypts the data twice using different keys, and the second key is also obtained by encrypting the first key. Such a three-step encryption process makes the data encryption process more secure and improves the security of data encryption.

[0113] The data encryption method described in the present invention can be applied to terminals, servers, etc., without limitation herein. The terminal implementation device can be electronic devices such as smart phones, laptops, tablet computers, desktop computers, personal digital assistants (PDAs) and wearable devices. The server can be an independent server or a server cluster, or a server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, intermediate services, domain name services, security services, content distribution networks, or big data and artificial intelligence platforms, etc., without limitation herein.

[0114] Combine the following Figure 1 , the specific implementation steps of a data encryption method provided by an embodiment of the present invention are described in detail.

[0115] In step 101, in response to receiving an application from a data sending end for generating an initial key, an initial key is generated for the data sending end.

[0116] In this step, when the data sender applies to the key management system for generating an initial key, the key management system uses the key generator to obtain an initial key of a fixed length. For example, a 20-bit true random number can be obtained from a quantum random number generator, or a 32-bit true random number can be obtained from a quantum random number generator, etc. In specific applications, this example is not limited to this.

[0117] In step 102, the initial key is used to encrypt the plaintext data to be sent by the data sending end to obtain a first ciphertext.

[0118] In this step, the process of using the initial key to encrypt the plaintext data to be sent by the data sending end is a well-known technology for those skilled in the art and will not be described in detail here.

[0119] In step 103, a second key is generated based on the initial key.

[0120] In this step, the initial key is first converted into a binary string of fixed length using a hash function; a true random value is obtained, and the true random value is converted into a binary sequence of the same length; a logical operation is performed on the binary string of the same length and the binary sequence; and the result of the logical operation is used as the second key.

[0121] That is to say, in the embodiment of the present invention, first, the initial key is converted into a binary string of fixed length using a hash function, such as the MD5 algorithm, the SHA-1 algorithm, the SHA-56 or the SHA-3 algorithm, etc. The binary in this embodiment can be understood as a basic symbol of a machine language, and the binary is a string of symbols composed of 0 and 1, which is easy for the computer to recognize.

[0122] Secondly, a unique and random true random value is obtained from a key management system (such as from a quantum random number generator), and the true random value is converted into a binary sequence.

[0123] Again, the binary string is XORed with the binary sequence to compare the corresponding bits of two binary numbers of the same length. If they are the same, the result bit is set to 0, and if they are different, the result bit is set to 1.

[0124] Finally, the value obtained by the XOR operation (i.e., a string of binary characters) is used as the final key.

[0125] It should be noted that the logical operation in this embodiment is not limited to the XOR operation, but may also be an AND or OR operation, which can be specifically set according to actual needs. Its implementation process is similar to that of the XOR operation and will not be repeated here.

[0126] It should be noted that, in specific implementation, step 102 and step 103 may be performed in any order and may be performed simultaneously, which is not limited in this embodiment.

[0127] In step 104, the first ciphertext is encrypted using the second secret key to obtain a second ciphertext.

[0128] In this step, the process of encrypting the first ciphertext using the second secret key is a well-known technique for those skilled in the art and will not be described in detail here.

[0129] In step 105, the second ciphertext is encrypted based on the key identifier of the second secret key to generate a final ciphertext.

[0130] In this step, the final ciphertext may be generated according to the set ciphertext structure using the key identifier length of the second key, the key identifier, the length of the second ciphertext, and the second ciphertext.

[0131] Among them, a ciphertext structure is shown in Table 1. Table 1 is only an example and is not limited to this in practical applications.

[0132] Table 1

[0133]

[0134] As can be seen from Table 1, in this embodiment, the 0th to 3rd bits can be used as the key identifier length n of the final key, the 4th to (4+n)th bits can be used as the key identifier of the final key, the 5th to (8+n)th bits can be used as the length m of the secondary encrypted ciphertext (i.e., the second ciphertext), and the 9th to (9+n+m)th bits can be used as the secondary encrypted ciphertext.

[0135] For example, if the final ciphertext is 0100 0011 0110 10…, then the 0th to 3rd bits are 0100, the key length n is 4, the 4th to 8th bits "0011 0110" are the key identifier, and the 9th to 12th bits are the length of the secondary encrypted ciphertext. Converting the 9th to 12th bits to binary gives m. Assuming m is 8, the 13th to 21st bits are the secondary encrypted ciphertext.

[0136] In this embodiment, the key identifier is integrated into the ciphertext structure, and there is no need to determine the correspondence between the key and the ciphertext, or to transmit the ciphertext identifier, which further reduces the risk of key leakage and improves data security.

[0137] In step 106, the final ciphertext is sent to the data sending end, so that the data sending end sends the received final ciphertext to the data receiving end.

[0138] In this step, the key management system sends the final ciphertext to the data sending end, so that the data sending end sends the final ciphertext to the data receiving end.

[0139] In an embodiment of the present invention, in response to receiving an application from a data sending end to generate an initial key, an initial key is generated for the data sending end; the plaintext data to be sent by the data sending end is encrypted using the initial key to obtain a first ciphertext; a second key is generated based on the initial key; the first ciphertext is encrypted using the second key to obtain a second ciphertext; the second ciphertext is encrypted based on a key identifier of the second key to generate a final ciphertext; the final ciphertext is sent to the data sending end so that the data sending end sends the final ciphertext to the data receiving end. In the present invention, the data to be transmitted is encrypted multiple times using different keys, thereby improving the security of data encryption. The encrypted keys are generated and managed by a key management system, thereby reducing the risk of key leakage.

[0140] See also Figure 2 , is a flow chart of a data encryption method provided by an embodiment of the present invention, the method is applied to a data sending end, and includes:

[0141] Step 201: Apply for an initial key from a key management system so that the key management system generates an initial key for the data sending end;

[0142] Step 202: Apply to the key management system to use the initial key for data encryption, so that the key management system uses the initial key to encrypt the plaintext data to be sent to obtain a first ciphertext; generate a second key based on the initial key; encrypt the first ciphertext using the second key to obtain a second ciphertext; encrypt the second ciphertext based on the key identifier of the second key to generate a final ciphertext;

[0143] Step 203: Send the final ciphertext to the data receiving end.

[0144] In the embodiment of the present invention, after the data sending end generates an initial key through the key management system, the data is encrypted using the initial key, and then a new key is generated using the initial key, and finally the encrypted data is encrypted using the new key and sent to the data receiving end. In this way, the key does not need to be stored in the data sending end or the data receiving end, but is stored in the key management system; at the same time, the data is encrypted twice using different keys, and the second key is also obtained by encrypting the first key. Such a three-step encryption process makes the data encryption process more secure.

[0145] See also Figure 3 A flowchart of a data decryption method provided by an embodiment of the present invention, the method is applied to a data receiving end, comprising:

[0146] Step 301: receiving the final ciphertext sent by the data receiving end;

[0147] Step 302: Send the final ciphertext to the key management system so that the key management system receives the final ciphertext sent by the data receiving end; obtains the initially encrypted first ciphertext and the initial key of the final ciphertext; and uses the initial key to decrypt the first ciphertext to obtain plaintext data.

[0148] In the embodiment of the present invention, the key management system not only encrypts the plaintext twice with two keys, but also decrypts the ciphertext twice with two keys. At the same time, the final key is also obtained by encrypting the initial key, and the transmitted ciphertext data is not the ciphertext data directly encrypted with the plaintext, but the ciphertext combined with the key. In this way, the security of the data encryption process is improved.

[0149] See also Figure 4 , is an application example of a data encryption method provided by an embodiment of the present invention. Figure 4 As shown, including:

[0150] Step 401: The data sending end applies for an initial key from the key management system.

[0151] Step 402: The key management system generates an initial key and a final key for the data sending end, and saves the initial key and the final key.

[0152] In this step, the key management system can use the encryption machine to generate an initial key for the high data sending end, generate a second key based on the initial key, extract the key identifier of the second key as the final key, and save the initial key and the final key.

[0153] Among them, in this step, after generating the initial secret key and the corresponding final secret key, the key management system can also send a notification that the secret key has been generated to the data sending end.

[0154] Step 403: The data sending end applies to the key management system for using the initial key to encrypt data.

[0155] Step 404: The key management system uses the initial key to encrypt the plaintext data to be sent to obtain a first ciphertext.

[0156] In this step, the first ciphertext may also be stored.

[0157] Step 405: The key management system generates a second key based on the initial key.

[0158] In this step, the generated second secret key may also be stored.

[0159] Step 406: The key management system uses the second secret key to encrypt the first ciphertext to obtain a second ciphertext.

[0160] Step 407: The key management system encrypts the second ciphertext based on the key identifier of the second key (ie, the final key) to generate a final ciphertext.

[0161] In this step, the final ciphertext can also be stored.

[0162] Step 408: The key management system sends the final ciphertext to the data sending end.

[0163] Step 409: The data sending end sends the received final ciphertext to the data receiving end.

[0164] Step 410: The data receiving end applies to the key management system for using the secret key to decrypt the final ciphertext.

[0165] In this step, the data receiving end may send the final ciphertext to the key management system for decryption; or the data receiving end may call the key management system to decrypt the final ciphertext, which is not limited in this embodiment.

[0166] Step 411: The key management system obtains the first ciphertext and the initial key of the initial encryption of the final ciphertext;

[0167] In this step, the first ciphertext and the initial key of the initial encryption of the final ciphertext can be obtained from a local or stored database. Specifically, it includes:

[0168] The key management system obtains a key identifier and a final key of a final key based on the final ciphertext; decrypts the final ciphertext based on the final key to obtain a second ciphertext that is twice encrypted; uses the final key to decrypt the second ciphertext that is twice encrypted to obtain a first ciphertext that is once encrypted; searches for a corresponding true random value based on a corresponding relationship between the final key and the true random value; converts the true random value into a binary sequence; performs logical processing on the binary sequence and the final key to obtain a binary string; and performs conversion processing on the binary string using a hash function to obtain an initial key.

[0169] Step 412: The key management system uses the initial key to decrypt the first ciphertext to obtain plaintext data.

[0170] In this embodiment, the implementation process of each step is detailed in the above corresponding embodiment and will not be repeated here.

[0171] In the present invention, the security of data encryption transmission is improved through multiple encryption processes: compared with the traditional one-time encryption or two-time encryption process, the embodiment of the present invention improves the security of data encryption transmission through three-time encryption process.

[0172] In the embodiment of the present invention, data encryption is performed by a third party, that is, key generation and data encryption are performed through a key management system, thereby reducing the risk of key leakage. In other words, the key in the embodiment of the present invention does not need to be stored at the data sending end or the data receiving end, but is stored in the key management system, thereby reducing the risk of key leakage. At the same time, the data encryption process is also in the key management system, which further improves the security of the data encryption process.

[0173] The embodiment of the present invention performs encryption twice using different keys respectively, and even if one of the keys is leaked, it will not affect data security. Compared with performing multiple encryption processes using a fixed key after the keys are configured, performing encryption twice using different keys respectively reduces the possibility that key leakage will affect data security.

[0174] By encrypting the key multiple times, even if the key is leaked, the key cannot be used to decrypt the data, further ensuring the security of the data. Compared with directly obtaining multiple sets of keys and then using multiple sets of keys to encrypt data, the risk of key leakage and cracking is reduced, thus further ensuring the security of the data.

[0175] The embodiment of the present invention integrates the key identifier into the ciphertext structure: there is no need to determine the correspondence between the key and the ciphertext, or to transmit the ciphertext identifier, which further reduces the risk of key leakage and improves data security.

[0176] It should be noted that, for the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that this implementation disclosure is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the present invention.

[0177] Figure 5 1 is a block diagram of a data encryption device provided by an embodiment of the present invention, the device is applied to a key management system, including: a first generation module 501, a first encryption module 502, a second generation module 503, a second encryption module 504, a third encryption module 505 and a sending module 506, wherein:

[0178] A first generating module 501, configured to generate an initial key for the data sending end in response to receiving an application from the data sending end for generating an initial key;

[0179] A first encryption module 502, configured to encrypt the plaintext data to be sent by the data sending end using the initial key to obtain a first ciphertext;

[0180] A second generating module 503, configured to generate a second key based on the initial key;

[0181] A second encryption module 504, configured to encrypt the first ciphertext using the second secret key to obtain a second ciphertext;

[0182] A third encryption module 505 is used to encrypt the second ciphertext based on the key identifier of the second secret key to generate a final ciphertext;

[0183] The sending module 506 is used to send the final ciphertext to the data sending end, so that the data sending end sends the final ciphertext to the data receiving end.

[0184] Optionally, in another embodiment, based on the above embodiment, the second generating module includes: a first conversion module, a first acquisition module, a logic operation module and a determination module, wherein:

[0185] A first conversion module, used for converting the initial key into a binary string of fixed length using a hash function;

[0186] A first acquisition module, used to acquire a true random value, and convert the true random value into a binary sequence of the same length;

[0187] A logic operation module, used for performing a logic operation on the binary character string of the same length and the binary sequence;

[0188] The determination module is used to use the result obtained by the logic operation as the second key.

[0189] Optionally, in another embodiment, based on the above embodiment, the logic operation module includes: an XOR operation module, a comparison module and a setting module, wherein:

[0190] An XOR operation module, used for performing an XOR operation on the binary string of the same length and the binary sequence;

[0191] A comparison module, used for comparing two binary corresponding bit numbers of the same length;

[0192] The setting module is used to set the comparison result bit to 0 when the numbers of the corresponding bits compared by the comparison module are the same, and to set the comparison result bit to 1 when the numbers of the corresponding bits compared are different.

[0193] Optionally, in another embodiment, based on the above embodiment, the third encryption module includes a module specifically used to generate a final ciphertext according to a set ciphertext structure using the key identifier length of the second key, the key identifier, the length of the second ciphertext and the second ciphertext.

[0194] Optionally, in another embodiment, based on the above embodiment, the device further includes: a receiving module, a second acquisition module and a decryption module, wherein:

[0195] A receiving module, used for receiving the final ciphertext sent by the data receiving end;

[0196] A second acquisition module, used to obtain the first ciphertext and the initial key of the initial encryption of the final ciphertext;

[0197] The decryption module is used to decrypt the first ciphertext using the initial key to obtain plaintext data.

[0198] Optionally, in another embodiment, based on the above embodiment, the acquisition module includes: a key acquisition module, a first decryption module, a second decryption module, a search module, a second conversion module, a processing module and a third conversion module, wherein:

[0199] A key acquisition module, used to acquire a key identifier and a final key of a final key based on the final ciphertext;

[0200] A first decryption module, used to decrypt the final ciphertext based on the final secret key to obtain a second ciphertext that is twice encrypted;

[0201] A second decryption module is used to decrypt the second ciphertext encrypted twice using the final key to obtain the first ciphertext encrypted once;

[0202] A search module, used for searching the corresponding true random value according to the corresponding relationship between the final key and the true random value;

[0203] A second conversion module, used for converting the true random value into a binary sequence;

[0204] A processing module, used for performing logical processing on the binary sequence and the final key to obtain a binary string;

[0205] The third conversion module is used to convert the binary string using a hash function to obtain an initial key.

[0206] See also Figure 6, a block diagram of a data encryption device is provided in an embodiment of the present invention, the device is applied to a data sending end, and includes: a key application module 601, an encryption application module 602 and a sending module 603, wherein,

[0207] A key application module 601 is used to apply for an initial key from a key management system so that the key management system generates an initial key for the data sending end;

[0208] An encryption application module 602 is used to apply to the key management system to use the initial key for data encryption, so that the key management system uses the initial key to encrypt the plaintext data to be sent to obtain a first ciphertext; generates a second key based on the initial key; encrypts the first ciphertext using the second key to obtain a second ciphertext; encrypts the second ciphertext based on the key identifier of the second key to generate a final ciphertext;

[0209] The sending module 603 is used to send the final ciphertext to the data receiving end.

[0210] See also Figure 7 , a data decryption device is provided for an embodiment of the present invention, and the device is applied to a data receiving end, comprising: a receiving module 701 and a sending module 702, wherein:

[0211] Receiving module 701, used to receive the final ciphertext sent by the data receiving end;

[0212] The sending module 702 is used to send the final ciphertext to the key management system so that when the key management system receives the final ciphertext sent by the data receiving end, it obtains the first ciphertext and the initial key of the initial encryption of the final ciphertext; and uses the initial key to decrypt the first ciphertext to obtain plaintext data.

[0213] According to a seventh aspect of an embodiment of the present invention, there is provided an electronic device, including:

[0214] processor;

[0215] a memory for storing instructions executable by the processor;

[0216] The processor is configured to execute the instructions to implement the data encryption method or the data decryption method as described above.

[0217] According to an eighth aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data encryption method as described above or the data decryption method as described above.

[0218] According to a ninth aspect of an embodiment of the present invention, a computer program product is provided, including a computer program or an instruction, wherein when the computer program or the instruction is executed by a processor of an electronic device, the data encryption method or the data decryption method described above is implemented.

[0219] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0220] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0221] Figure 8 800 is a block diagram of an electronic device 800 provided in an embodiment of the present invention. For example, the electronic device 800 may be a mobile terminal or a server, and the electronic device is a mobile terminal as an example for explanation in the embodiment of the present invention. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a message transceiver device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0222] Reference Figure 8 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0223] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0224] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0225] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

[0226] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0227] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0228] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0229] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0230] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0231] In an embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the data encryption method or data decryption method shown above.

[0232] In an embodiment, a computer-readable storage medium is also provided, and when the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device 800 can perform the data encryption method or data decryption method shown above. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0233] In an embodiment, a computer program product is also provided, including a computer program or instructions. When the computer program or instructions are executed by the processor 820 of the electronic device 800, the electronic device 800 executes the above-mentioned data encryption method or data decryption method.

[0234] Fig. 9 is a block diagram of a device 900 for data encryption or decryption provided by an embodiment of the present invention. For example, the device 900 may be provided as a server. Fig. 9 , the apparatus 900 includes a processing component 922, which further includes one or more processors, and a memory resource represented by a memory 932 for storing instructions, such as an application, that can be executed by the processing component 922. The application stored in the memory 932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 922 is configured to execute the instructions to perform the above method.

[0235] The device 900 may also include a power supply component 926 configured to perform power management of the device 900, a wired or wireless network interface 950 configured to connect the device 900 to a network, and an input / output (I / O) interface 958. The device 900 may operate based on an operating system stored in the memory 932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.

[0236] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.

[0237] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A data encryption method, characterized in that: The method is applied to a key management system, comprising: In response to receiving an application from a data sending terminal for generating an initial secret key, generating an initial secret key for the data sending terminal; Using the initial key to encrypt the plaintext data to be sent by the data sending end to obtain a first ciphertext; generating a second key based on the initial key; Encrypting the first ciphertext using the second secret key to obtain a second ciphertext; Encrypting the second ciphertext based on the key identifier of the second secret key to generate a final ciphertext; The final ciphertext is sent to the data sending end, so that the data sending end sends the received final ciphertext to the data receiving end.

2. The data encryption method according to claim 1, characterized in that: Generating a second key based on the initial key comprises: Using a hash function to convert the initial key into a binary string of fixed length; Obtain a true random value, and convert the true random value into a binary sequence of the same length; Performing a logical operation on the binary string of the same length and the binary sequence; The result of the logical operation is used as the second key.

3. The data encryption method according to claim 2, characterized in that: The performing a logical operation on the binary character string of the same length and the binary sequence comprises: Performing an XOR operation on the binary string of the same length and the binary sequence; Compare two binary numbers of the same length. If they are the same, the comparison result bit is set to 0, if they are different, the comparison result bit is set to 1.

4. The data encryption method according to claim 1, characterized in that: The step of encrypting the second ciphertext based on the key identifier of the second secret key to generate a final ciphertext includes: The final ciphertext is generated according to the set ciphertext structure using the key identifier length of the second key, the key identifier, the length of the second ciphertext and the second ciphertext.

5. The data encryption method according to any one of claims 1 to 4, characterized in that: The method further comprises: Receiving the final ciphertext sent by the data receiving end; Obtaining a first ciphertext and an initial key for initial encryption of the final ciphertext; The first ciphertext is decrypted using the initial key to obtain plaintext data.

6. The data encryption method according to claim 5, characterized in that: The obtaining of the first ciphertext and the initial key of the initial encryption of the final ciphertext comprises: Obtaining a key identifier and a final key of a final key based on the final ciphertext; Decrypting the final ciphertext based on the final secret key to obtain a second ciphertext that is twice encrypted; Decrypting the second ciphertext encrypted twice using the final key to obtain the first ciphertext encrypted once; According to the corresponding relationship between the final key and the true random value, find the corresponding true random value; Converting the true random value into a binary sequence; Performing logical processing on the binary sequence and the final key to obtain a binary string; The binary string is converted using a hash function to obtain an initial key.

7. A data encryption method, characterized in that: The method is applied to a data sending end, comprising: Applying for an initial key from a key management system so that the key management system generates an initial key for the data sending end; Apply to the key management system to use the initial key to encrypt data, so that the key management system uses the initial key to encrypt the plaintext data to be sent to obtain a first ciphertext; generate a second key based on the initial key; encrypt the first ciphertext using the second key to obtain a second ciphertext; encrypt the second ciphertext based on the key identifier of the second key to generate a final ciphertext; The final ciphertext is sent to the data receiving end.

8. A data decryption method, characterized in that: The method is applied to a data receiving end, comprising: Receive the final ciphertext sent by the data receiving end; The final ciphertext is sent to the key management system so that the key management system receives the final ciphertext sent by the data receiving end; obtains the first ciphertext and the initial key of the initial encryption of the final ciphertext; and uses the initial key to decrypt the first ciphertext to obtain plaintext data.

9. A data encryption device, characterized in that: The device is applied to a key management system, comprising: A first generating module, configured to generate an initial key for the data sending end in response to receiving an application from the data sending end for generating an initial key; A first encryption module, used to encrypt the plaintext data to be sent by the data sending end using the initial key to obtain a first ciphertext; A second generating module, used for generating a second key based on the initial key; A second encryption module, used to encrypt the first ciphertext using the second secret key to obtain a second ciphertext; A third encryption module, used to encrypt the second ciphertext based on the key identifier of the second secret key to generate a final ciphertext; The sending module is used to send the final ciphertext to the data sending end, so that the data sending end sends the received final ciphertext to the data receiving end.

10. A data encryption device, characterized in that: The device is applied to a data sending end, and comprises: A key application module, used to apply for an initial key from a key management system so that the key management system generates an initial key for the data sending end; An application encryption module is used to apply to the key management system to use the initial key to encrypt data, so that the key management system uses the initial key to encrypt the plaintext data to be sent to obtain a first ciphertext; generate a second key based on the initial key; encrypt the first ciphertext using the second key to obtain a second ciphertext; encrypt the second ciphertext based on the key identifier of the second key to generate a final ciphertext; The sending module is used to send the final ciphertext to the data receiving end.

11. A data decryption device, characterized in that: The device is applied to a data receiving end, and comprises: A receiving module, used for receiving the final ciphertext sent by the data receiving end; The sending module is used to send the final ciphertext to the key management system so that when the key management system receives the final ciphertext sent by the data receiving end, it obtains the first ciphertext and the initial key of the initial encryption of the final ciphertext; and uses the initial key to decrypt the first ciphertext to obtain plaintext data.

12. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the data encryption method according to any one of claims 1 to 7 or the data decryption method according to claim 8.

13. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data encryption method according to any one of claims 1 to 7 or the data decryption method according to claim 8.

Citation Information

Patent Citations

  • Data encryption method and device, and data decryption method and device

    CN112003859A

  • Encryption and decryption network transmission method and equipment

    CN115442030A

  • Dynamic encryption method and system for data transmission

    CN117201191A

  • Dynamic data encryption

    US20210258151A1

Cited By

  • Key management method, method for protecting artificial intelligence model data and related device

    CN121441497A