Data encryption and decryption method, device, storafe medium and encrypted file

LAP808AUndetermined Publication Date: 2024-10-24CHINA UNIONPAY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
LAP808
Authority / Receiving Office
LA · LA
Patent Type
Applications
Current Assignee / Owner
Priority Date
2019-11-26
Filing Date
2020-09-28
Publication Date
2024-10-24

AI Technical Summary

Technical Problem

Existing encryption technology has low security during ciphertext transmission, is easily tampered with, and cannot effectively protect the integrity of sensitive data.

Method used

The four-fold protection method of obfuscation, signature, encryption and re-signing is used to process the encrypted data and generate an encrypted file including the target ciphertext and the second signature. The decryption device performs verification during the decryption process to detect tampering.

Benefits of technology

The security during data transmission is improved. If the content of the encrypted file is tampered with, the decryption device can detect it in time through verification and detection, ensuring the integrity and security of the data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of data processing, and provided are methods and apparatuses for encrypting and decrypting data, a storage medium, and an encrypted file. The method for encrypting data comprises: acquiring a first key, and performing an obfuscation operation on the first key and data to be encrypted to obtain obfuscation operation result data; acquiring a second key, and obtaining a first signature of the obfuscation operation result data according to the second key; acquiring a third key, and using the third key to encrypt the first key, the data, and the first signature to obtain target ciphertext; acquiring a fourth key, and obtaining a second signature of the target ciphertext according to the fourth key; and generating an encrypted file comprising the target ciphertext and the second signature. The security of data protection may be improved by using the technical solution of the present application.
Need to check novelty before this filing date? Find Prior Art

Description

Data encryption and decryption method and device, storage medium and encrypted file

[0001] Cross-reference to related applications

[0002] This application claims priority to Chinese Patent Application No. 201911176393.0, filed on November 26, 2019, entitled "Data encryption and decryption method and device, storage medium and encrypted file", the entire contents of which are incorporated herein by reference. TECHNICAL FIELD

[0003] The present application belongs to the technical field of data processing, and particularly relates to a data encryption and decryption method, device and encrypted file. BACKGROUND

[0004] With the development of network technology, data transmission using a network facilitates information transmission. In the data transmission process, data may be leaked or tampered with. There is sensitive data in the data being transmitted, and the sensitive data is not expected to be leaked or tampered with. Therefore, the transmission of data including sensitive data has a higher requirement for transmission security.

[0005] At present, an encryption device encrypts data, i.e., plaintext, and transmits encrypted data, i.e., ciphertext, to a decryption device. The decryption device decrypts the ciphertext to obtain the plaintext. However, the ciphertext may be tampered with during transmission, and the security of data protection is still low.

[0006] SUMMARY

[0007] The present application provides a data encryption and decryption method, device, storage medium and encrypted file, which can improve the security of data protection.

[0008] In a first aspect, the present application provides a data encryption method applied to an encryption device, which includes: obtaining a first key, performing a confusion operation on the first key and data to be encrypted to obtain confusion operation result data; obtaining a second key, and obtaining a first signature of the confusion operation result data according to the second key; obtaining a third key, and encrypting the first key, the data to be encrypted and the first signature by using the third key to obtain target ciphertext; obtaining a fourth key, and obtaining a second signature of the target ciphertext according to the fourth key; and generating an encrypted file including the target ciphertext and the second signature.

[0009] In a second aspect, the embodiments of the present application provide a decryption method of data, applied to a decryption device, and the method comprises the following steps: receiving an encrypted file comprising target ciphertext and a second signature, the second signature being a signature of the target ciphertext obtained by the encryption device according to a fourth key; decrypting the target ciphertext by using a pre-stored fifth key paired with a third key to obtain a first key, to-be-encrypted data and a first signature; verifying the target ciphertext and the second signature by using a sixth key paired with the fourth key; performing the same confusion operation on the decrypted first key and the to-be-encrypted data as in the encryption device to obtain confusion operation result data, and verifying the obtained confusion operation result data and the first signature by using a seventh key paired with a second key, the first signature being a signature of the confusion operation result data obtained by the encryption device according to the second key.

[0010] In a third aspect, the embodiments of the present application provide an encryption device, which comprises: a confusion operation module, configured to obtain a first key and perform a confusion operation on the first key and to-be-encrypted data to obtain confusion operation result data; a signature module, configured to obtain a second key and obtain a first signature of the confusion operation result data according to the second key; an encryption module, configured to obtain a third key and encrypt the first key, the to-be-encrypted data and the first signature by using the third key to obtain target ciphertext; the signature module is further configured to obtain a fourth key and obtain a second signature of the target ciphertext according to the fourth key; and an encrypted file generation module, configured to generate an encrypted file comprising the target ciphertext and the second signature.

[0011] In a fourth aspect, the embodiments of the present application provide a decryption device, which comprises: a receiving module, configured to receive an encrypted file comprising target ciphertext and a second signature, the second signature being a signature of the target ciphertext obtained by the encryption device according to a fourth key; a decryption module, configured to decrypt the target ciphertext by using a pre-stored fifth key corresponding to a third key to obtain a first key, to-be-encrypted data and a first signature; a first verification module, configured to verify the target ciphertext and the second signature by using a sixth key paired with the fourth key; and a second verification module, configured to perform the same confusion operation on the decrypted first key and the to-be-encrypted data as in the encryption device to obtain confusion operation result data, and verify the confusion operation result data and the first signature by using a seventh key paired with a second key, the first signature being a signature of the confusion operation result data obtained by the encryption device according to the second key.

[0012] In a fifth aspect, the embodiments of the present application provide an encryption device, which comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, and the computer program is executed by the processor to implement the encryption method of data in the technical solution of the first aspect.

[0013] In a sixth aspect, an embodiment of the present application provides a decryption device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, and when the computer program is executed by the processor, the decryption method of the data in the technical solution of the second aspect is implemented.

[0014] In a seventh aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the encryption method of the data in the technical solution of the first aspect or the decryption method of the data in the technical solution of the second aspect is implemented.

[0015] In an eighth aspect, an embodiment of the present application provides an encrypted file, comprising: target ciphertext, which is ciphertext obtained by encrypting a first key, to-be-encrypted data, and a first signature by using a third key, the first signature being a signature of obfuscated operation result data obtained according to a second key, the obfuscated operation result data being data obtained by obfuscating the first key and the to-be-encrypted data; and a second signature, which is a signature of the target ciphertext obtained according to a fourth key.

[0016] The encryption and decryption method, device, storage medium, and encrypted file provided in the embodiments of the present application are used to obfuscate the first key and the to-be-encrypted data, sign the obfuscated first key and to-be-encrypted data, obtain a first signature, encrypt the first key, to-be-encrypted data, and obtained first signature by using a third key, and sign the encrypted first key, to-be-encrypted data, and first signature to obtain a second signature, thereby obtaining an encrypted file comprising the second signature and the encrypted first key, to-be-encrypted data, and first signature. The encrypted file received by the decryption device comprises target ciphertext and a second signature, and the target ciphertext is decrypted by using a fifth key paired with the third key to obtain the first key, to-be-encrypted data, and first signature. The target ciphertext and second signature are verified by using a sixth key paired with a fourth key. The decrypted first key and to-be-encrypted data are obfuscated in the same way as in the encryption device, and the obfuscated decrypted first key and to-be-encrypted data and first signature are verified by using a seventh key paired with a second key to complete the whole process of decryption and verification. The encryption device processes the to-be-encrypted data through four protection means of obfuscation, signing, encryption, and re-signing. If the content in the encrypted file is tampered with, the decryption device can detect it through verification, thereby improving the security of data protection. BRIEF DESCRIPTION OF DRAWINGS

[0017] The present application can be better understood from the following description of specific embodiments of the present application in conjunction with the accompanying drawings, in which like or similar designations are used for like or similar features.

[0018] FIG. 1 is a schematic diagram of an application scenario of a data encryption and decryption method according to an embodiment of the present application;

[0019] FIG. 2 is a flowchart of an embodiment of a data encryption method according to a first aspect of the present application;

[0020] FIG. 3 is a schematic diagram of a structure of an example of an encrypted file visible to a user according to an embodiment of the present application;

[0021] FIG. 4 is a schematic diagram of a structure of an example of a plaintext corresponding to the structure of the encrypted file shown in FIG. 3 according to an embodiment of the present application;

[0022] FIG. 5 is a schematic diagram of an example of a form of an encrypted file according to an embodiment of the present application;

[0023] FIG. 6 is a flowchart of an embodiment of a data decryption method according to a second aspect of the present application;

[0024] FIG. 7 is a schematic diagram of a structure of an embodiment of an encryption apparatus according to a third aspect of the present application;

[0025] FIG. 8 is a schematic diagram of a structure of another embodiment of an encryption apparatus according to the third aspect of the present application;

[0026] FIG. 9 is a schematic diagram of a structure of an embodiment of a decryption apparatus according to a fourth aspect of the present application;

[0027] FIG. 10 is a schematic diagram of a structure of another embodiment of a decryption apparatus according to the fourth aspect of the present application;

[0028] FIG. 11 is a schematic diagram of a structure of an embodiment of an encryption apparatus according to a fifth aspect of the present application. DETAILED DESCRIPTION

[0029] Features and exemplary embodiments of various aspects of the present application will be described in detail below. In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the present application. However, it will be apparent to one of ordinary skill in the art that the present application can be practiced without some or all of these specific details. The description of the embodiments is merely intended to provide a better understanding of the present application by showing examples of the present application. The present application is not limited to any particular configuration and algorithm set forth below, but covers any modifications, replacements, and improvements of elements, components, and algorithms without departing from the spirit of the present application. In the accompanying drawings and the following description, well-known structures and techniques are not shown in order to avoid unnecessary obscuring of the present application.

[0030] The application provides a data encryption and decryption method, device and encrypted file, which can be applied to a scenario of encrypting data for secure transmission. FIG. 1 is a schematic diagram of an application scenario of the data encryption and decryption method provided by an embodiment of the application. As shown in FIG. 1, the data encryption and decryption method can be applied to an encryption device 10 and a decryption device 20. The encryption device 10 is configured to perform the data encryption method in the embodiment of the application. The decryption device 20 is configured to perform the data decryption method in the embodiment of the application.

[0031] In the application, the encryption device can perform four-layer protection processing of confusion, signing, encryption and re-signing on the data to be encrypted, i.e., plaintext, so that the data is difficult to be tampered with during transmission, or if the data is tampered with, the decryption device can accurately find the tampering problem in the decryption and verification process, thereby improving the security of the data.

[0032] FIG. 2 is a flowchart of an embodiment of the data encryption method provided by the first aspect of the application. The data encryption method can be applied to an encryption device. As shown in FIG. 2, the data encryption method can include steps S301 to S305.

[0033] In step S301, a first key is obtained, and confusion operation is performed on the first key and the data to be encrypted to obtain confusion operation result data.

[0034] The data to be encrypted can be data that is not intended to be disclosed and not intended to be tampered with, for example, sensitive data. The type, quantity and size of the data to be encrypted are not limited herein.

[0035] The confusion operation result data is the result data of the confusion operation of the first key and the data to be encrypted. The confusion algorithm involved in the confusion operation can be agreed upon by the encryption device and the decryption device in advance. The confusion algorithm can be a non-public confusion algorithm, i.e., only the encryption device and the decryption device know the confusion algorithm, and it is not publicly disclosed. In some examples, a confusion factor can be randomly generated for each confusion operation. The confusion factor will affect the local variables in the confusion algorithm, so that each confusion operation will be different. Attackers cannot accurately obtain the confusion algorithm of each confusion operation, so it is difficult to obtain the data to be encrypted or tamper with the data to be encrypted, thereby further improving the security of data protection. In other examples, the confusion factor in the confusion operation can include the first key, i.e., the first key can be used as a confusion factor to participate in the confusion operation, which is not limited herein.

[0036] In some examples, the first key can be a public key.

[0037] In step S302, a second key is obtained, and a first signature of the confusion operation result data is obtained according to the second key.

[0038] The obfuscated operation result data is signed according to the second key to obtain a first signature. In some examples, the first key is a public key, and the second key can be a private key corresponding to the first key, that is, the first key and the second key form a pair of public and private keys.

[0039] In step S303, a third key is obtained, and the first key, the data to be encrypted, and the first signature are encrypted by using the third key to obtain target ciphertext.

[0040] Here, one encryption is performed, and the first key, the data to be encrypted, and the first signature are encrypted as a whole by using the third key. The encrypted first key, the data to be encrypted, and the first signature are the target ciphertext. The third key can be a public key or a symmetric key, which is not limited here.

[0041] In step S304, a fourth key is obtained, and a second signature of the target ciphertext is obtained according to the fourth key.

[0042] The second signature is a signature of the target ciphertext. In some examples, the first key is a public key, and the fourth key can be a private key corresponding to the first key, that is, the first key and the fourth key form a pair of public and private keys. Further, the second key and the fourth key can be the same key.

[0043] In step S305, an encrypted file including the target ciphertext and the second signature is generated.

[0044] The encrypted file is generated by using the target ciphertext and the second signature, and the encrypted file includes the target ciphertext and the second signature. It should be noted that the encrypted file can also include public data that is not subjected to obfuscation, signature, and encryption, which is not limited here.

[0045] For example, FIG. 3 is a structural schematic diagram of an example of an encrypted file visible to a user according to an embodiment of the present application. As shown in FIG. 3, after the encrypted file is opened, the user can see, without decryption processing, public data such as public content description information, the target ciphertext, and the second signature. FIG. 4 is a schematic diagram of a plaintext structure corresponding to the encrypted file structure shown in FIG. 3 according to an embodiment of the present application. As shown in FIG. 4, assuming that the data to be encrypted includes sensitive data 1, sensitive data 2, and sensitive data 3, the plaintext structure corresponding to the encrypted file structure specifically includes public data such as public content description information, the first key, the sensitive data 1, the sensitive data 2, the sensitive data 3, the first signature, and the second signature.

[0046] To more intuitively illustrate the confusion, signature, encryption and re-signature four-layer protection processing in the above embodiments, FIG. 5 is a schematic diagram of an example of an encrypted file generation form provided by the embodiments of the present application. As shown in FIG. 5, the first key and the data to be encrypted are subjected to confusion operation; the first key and the data to be encrypted after the confusion operation are subjected to signature to obtain signature 1; the first key, the data to be encrypted and the signature 1 are subjected to encryption, and the encrypted first key, the data to be encrypted and the signature 1 are subjected to signature to obtain signature 2; and finally the encrypted file is obtained.

[0047] In the embodiments of the present application, the first key and the data to be encrypted are subjected to confusion operation, and the first key and the data to be encrypted after the confusion operation are subjected to signature to obtain the first signature. The first key, the data to be encrypted and the obtained first signature are subjected to encryption by using the third key, and the encrypted first key, the data to be encrypted and the first signature are subjected to signature to obtain the second signature, thereby obtaining the encrypted file including the second signature and the encrypted first key, the data to be encrypted and the first signature. Through the four-layer protection means of confusion, signature, encryption and re-signature, the data to be encrypted is processed, thereby improving the security of data protection.

[0048] For example, if the target ciphertext is replaced, decryption failure or incorrect data will occur in the subsequent decryption process, and in the case of decryption failure or incorrect data, the second signature verification will not be successful. Similarly, if the second signature is replaced, the second signature verification will not be successful. If the key is leaked during the transmission of the encrypted file, causing the data to be encrypted to be tampered with, since the first signature is obtained by signing the first key and the data to be encrypted after confusion, and the confusion algorithm is not disclosed to the outside, the tampered data to be encrypted and the first signature will not be verified successfully in the subsequent decryption process, thereby improving the security of the data.

[0049] In some examples, the above-mentioned data encryption method can further include receiving the third key generated and sent by the decryption device. That is, the third key is generated by the decryption device. The first key, the second key and the fourth key can all be generated by the encryption device. That is, the data encryption method in the embodiments of the present application can at least rely on only one key provided by the decryption device to realize the processes of confusion, signature, encryption and re-signature, thereby reducing the development workload that the decryption device needs to bear and improving the security of protection of the encryption device, the data to be encrypted and the decryption device. The second key and the fourth key can be the same key, and the first key and the second key can be a pair of public and private keys, so that the encryption device generates a pair of public and private keys to realize the first key, the second key and the fourth key in the above embodiments.

[0050] The embodiments of the present application can also provide an encrypted file, which includes the target ciphertext and the second signature.

[0051] The target ciphertext is ciphertext obtained by encrypting the first key, the data to be encrypted, and the first signature by using the third key. The first signature is a signature of obfuscated operation result data obtained according to the second key. The obfuscated operation result data is data obtained by obfuscating the first key and the data to be encrypted.

[0052] The second signature is a signature of the target ciphertext obtained according to the fourth key.

[0053] The structure and generation form of the encrypted file can refer to FIG. 3, FIG. 4, and FIG. 5 in the above embodiments. The specific content about the encrypted file, the target ciphertext, the second signature, and the like can refer to the related description in the above embodiments, which will not be repeated here.

[0054] In some examples, the first key is a public key.

[0055] In some examples, the third key is a public key or a symmetric key.

[0056] In some examples, the second key and the fourth key are private keys.

[0057] Further, the first key is a public key, and the second key and / or the fourth key are private keys corresponding to the first key.

[0058] In some examples, the second key and the fourth key are the same.

[0059] In some examples, the obfuscation factor in the obfuscation operation includes the first key.

[0060] FIG. 6 is a flowchart of an embodiment of a data decryption method provided by the second aspect of the present application. The data decryption method can be applied to a decryption device. As shown in FIG. 6, the data decryption method can include steps S401 to S404.

[0061] In step S401, an encrypted file including a target ciphertext and a second signature is received.

[0062] To facilitate correspondence with the data encryption method in the above embodiments, the names involved in the data decryption method in the embodiments of the present application correspond to the names involved in the above data encryption method.

[0063] The second signature is a signature of the target ciphertext obtained by the encryption device according to the fourth key. The target ciphertext is ciphertext obtained by encrypting the first key, the data to be encrypted, and the first signature by using the third key by the encryption device. It should be noted that the encrypted file in the embodiments of the present application has been transmitted, and the target ciphertext and the second signature can be tampered with in the transmission process.

[0064] In some examples, the encrypted file can further include other data, such as publicly available data, etc.

[0065] In step S402, the target ciphertext is decrypted by using a pre-stored fifth key paired with the third key, to obtain the first key, the data to be encrypted, and the first signature.

[0066] In some examples, the third key and the fifth key can be a symmetric key or a pair of public and private keys generated by the decryption device, and the third key is sent by the decryption device to the encryption device, so that the encryption device encrypts the first key, the data to be encrypted, and the first signature by using the third key. The target ciphertext can be decrypted by the decryption device by using the fifth key paired with the third key, and the decrypted target ciphertext includes the first key, the data to be encrypted, and the first signature.

[0067] In some examples, the first key is a public key. The third key can be a public key or a symmetric key. If the third key is a public key, the fifth key is a private key paired with the third key. If the third key is a symmetric key, the fifth key is the same key as the third key.

[0068] In step S403, the target ciphertext and the second signature are verified by using a sixth key paired with the fourth key.

[0069] The decryption device can verify the target ciphertext and the second signature. If the target ciphertext and the second signature are verified successfully, it indicates that the target ciphertext and the second signature have not been tampered with.

[0070] In some examples, the fourth key is a private key, and the sixth key is a public key paired with the fourth key. Further, in the case where the first key is a public key and the fourth key is a private key corresponding to the first key, the sixth key is the first key obtained after the target ciphertext is decrypted. The decryption device can obtain the sixth key, i.e., the first key, in the process of decrypting the target ciphertext, and does not need to store the sixth key itself, which on the one hand can avoid the leakage of the sixth key by the decryption device, and on the other hand is convenient for the management of the sixth key, i.e., the sixth key is updated with the target ciphertext, further improving the security of encryption and decryption.

[0071] In step S404, the first key obtained after decryption and the data to be encrypted are subjected to the same obfuscation operation as in the encryption device, to obtain obfuscated operation result data, and the obtained obfuscated operation result data and the first signature are verified by using a seventh key paired with the second key.

[0072] The first signature is a signature of the obfuscated operation result data obtained by the encryption device according to the second key. The decryption device can verify the obtained obfuscated operation result data and the first signature, and if the verification of the obtained obfuscated operation result data and the first signature is successful, it indicates that the data to be encrypted, the first key, and the first signature have not been tampered with.

[0073] In some examples, the second key is a private key, and the seventh key is a public key paired with the second key. Further, in the case that the first key is a public key and the second key is a private key corresponding to the first key, the seventh key is the first key obtained after decryption of the target ciphertext. The decryption device can obtain the seventh key, i.e., the first key, in the process of decrypting the target ciphertext, and does not need to store the seventh key itself, which on the one hand can avoid leakage of the seventh key by the decryption device, and on the other hand facilitates management of the seventh key, i.e., the seventh key is updated with the target ciphertext, further improving the security of encryption and decryption.

[0074] In some examples, the obfuscation factor in the obfuscation operation includes the first key.

[0075] In the embodiments of the present application, the encrypted file received by the decryption device includes the target ciphertext and the second signature, the target ciphertext is decrypted using the fifth key paired with the third key to obtain the first key, the data to be encrypted, and the first signature. The target ciphertext and the second signature are verified using the sixth key paired with the fourth key. The first key obtained after decryption and the data to be encrypted are subjected to the same obfuscation operation as in the encryption device to obtain obfuscated operation result data, and the obfuscated operation result data and the first signature are verified using the seventh key paired with the second key to complete the entire process of decryption and verification. If the content in the encrypted file is tampered with, it can be detected through verification, improving the security of data protection.

[0076] Specifically, in the above embodiments, if the verification of the target ciphertext and the second signature is successful, and the verification of the obfuscated operation result data and the first signature is successful, it is determined that the encrypted file has not been tampered with.

[0077] In some examples, the third key can be generated by the decryption device, and correspondingly, the decryption method of the data in the above embodiments can further include the steps of generating and sending the third key to the encryption device.

[0078] In some examples, the first key, the second key, and the fourth key in the above embodiments can be keys generated by the encryption device. That is, at least one key provided by the decryption device can be used to implement the processes of obfuscation, signature, encryption, and re-signature in the encryption method of the data performed by the encryption device, reducing the development workload that the decryption device needs to undertake, and improving the security of protection of the encryption device, the data to be encrypted, and the decryption device.

[0079] FIG. 7 is a structural schematic diagram of an embodiment of an encryption device provided by the third aspect of the present application. As shown in FIG. 7, the encryption device 10 can include an obfuscation operation module 101, a signature module 102, an encryption module 103, and an encrypted file generation module 104.

[0080] The obfuscation module 101 can be used to obtain a first key, perform an obfuscation operation on the first key and the data to be encrypted, and obtain an obfuscation result.

[0081] The signature module 102 can be used to obtain a second key and, based on the second key, obtain a first signature of the obfuscation operation result.

[0082] The encryption module 103 can be used to obtain a third key and use the third key to encrypt the first key, the data to be encrypted, and the first signature to obtain the target ciphertext.

[0083] The signature module 102 can also be used to obtain a fourth key, and based on the fourth key, to obtain a second signature of the target ciphertext.

[0084] The encrypted file generation module 104 can be used to generate an encrypted file that includes the target ciphertext and the second signature.

[0085] In this embodiment, a first key and the data to be encrypted are obfuscated, and the obfuscated first key and the data to be encrypted are then signed to obtain a first signature. Using a third key, the first key, the data to be encrypted, and the obtained first signature are encrypted, and the encrypted first key, the data to be encrypted, and the first signature are then signed to obtain a second signature. This results in an encrypted file containing the second signature, the encrypted first key, the data to be encrypted, and the first signature. Through these four layers of protection—obfuscation, signing, encryption, and re-signing—the data to be encrypted is processed, thereby improving data security.

[0086] Figure 8 is a schematic diagram of another embodiment of the encryption device provided in the third aspect of this application. The difference between Figure 8 and Figure 7 is that the encryption device 10 shown in Figure 8 further includes a receiving module 105 and a first key generation module 106.

[0087] The receiving module 105 can be used to receive a third key generated and sent by the decryption device.

[0088] In some examples, the third key is a public key or a symmetric key.

[0089] The first key generation module 106 can be used to generate a first key, a second key, and a fourth key.

[0090] In some examples, the first key is the public key.

[0091] In some examples, the second key and the fourth key are private keys.

[0092] Furthermore, the first key is a public key, and the second key and / or the fourth key is a private key corresponding to the first key.

[0093] In some examples, the second key is the same as the fourth key.

[0094] In some examples, the confusion factor in the confusion operation includes the first key.

[0095] FIG. 9 is a structural schematic diagram of an embodiment of a decryption device provided by the fourth aspect of the present application. As shown in FIG. 9, the decryption device 20 can include a receiving module 201, a decryption module 202, a first verification module 203, and a second verification module 204.

[0096] The receiving module 201 can be configured to receive an encrypted file including target ciphertext and a second signature, the second signature being a signature of the target ciphertext obtained by the encryption device according to the fourth key.

[0097] The decryption module 202 can be configured to decrypt the target ciphertext by using a fifth key pre-stored in the decryption device and paired with the third key, to obtain the first key, the data to be encrypted, and a first signature.

[0098] The first verification module 203 can be configured to verify the target ciphertext and the second signature by using a sixth key paired with the fourth key.

[0099] The second verification module 204 can be configured to perform the same confusion operation on the decrypted first key and the data to be encrypted as in the encryption device, to obtain confusion operation result data, and verify the confusion operation result data and the first signature by using a seventh key paired with the second key.

[0100] The first signature is a signature of the confusion operation result data obtained by the encryption device according to the second key.

[0101] In the embodiments of the present application, the encrypted file received by the decryption device includes target ciphertext and a second signature, the target ciphertext is decrypted by using a fifth key paired with the third key, to obtain the first key, the data to be encrypted, and a first signature. The target ciphertext and the second signature are verified by using a sixth key paired with the fourth key. The same confusion operation is performed on the decrypted first key and the data to be encrypted as in the encryption device, and the decrypted first key and the data to be encrypted after the confusion operation, and the first signature are verified by using a seventh key paired with the second key, to complete the whole process of decryption and verification. If the content in the encrypted file is tampered, it can be detected through verification, and the security of data protection is improved.

[0102] FIG. 10 is a structural schematic diagram of another embodiment of a decryption device provided by the fourth aspect of the present application. The difference between FIG. 10 and FIG. 9 is that the decryption device 20 shown in FIG. 10 can further include a security determination module 205 and a second key generation module 206.

[0103] The security determining module 205 can be configured to determine that the encrypted file is not tampered if the verification of the target ciphertext and the second signature is successful and the verification of the obfuscated operation result data and the first signature is successful.

[0104] The second key generating module 206 can be configured to generate and send a third key to the encryption device.

[0105] In some examples, the first key is a key generated by the encryption device. The first key is a public key.

[0106] In some examples, the third key is a public key or a symmetric key. If the third key is a public key, the fifth key is a private key corresponding to the third key. If the third key is a symmetric key, the third key and the fifth key are the same key.

[0107] In some examples, the second key and the fourth key are keys generated by the encryption device. The second key and the fourth key are private keys.

[0108] Further, in the case where the first key is a public key and the fourth key is a private key corresponding to the first key, the sixth key is the first key obtained by decrypting the target ciphertext. In the case where the first key is a public key and the second key is a private key corresponding to the first key, the seventh key is the first key obtained by decrypting the target ciphertext.

[0109] In some examples, the obfuscation factor in the obfuscated operation described above includes the first key.

[0110] FIG. 11 is a structural schematic diagram of an embodiment of the encryption device provided in the fifth aspect of the present application. As shown in FIG. 11, the encryption device 50 includes a memory 501, a processor 502, and a computer program stored in the memory 501 and executable on the processor 502.

[0111] In one example, the processor 502 can include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or can be configured to implement one or more integrated circuits that implement embodiments of the present application.

[0112] The memory 501 can include mass storage for data or instructions. By way of example, and not limitation, the memory 501 can include a hard disk drive (HDD), a floppy disk drive, flash memory, an optical disc, a magneto-optical disc, magnetic tape, or a Universal Serial Bus (USB) drive or a combination of two or more of these. The memory 501 can include removable or non-removable (or fixed) media, where appropriate. The memory 501 can be considered a computer-readable medium, where appropriate. Where appropriate, memory 501 can be internal or external to terminal hotspot opening encryption device 50. In particular embodiments, the memory 501 is non-volatile, solid-state memory. In particular embodiments, the memory 501 includes read-only memory (ROM). Where appropriate, this ROM can be mask-programmed ROM, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), electrically alterable ROM (EAROM), or flash memory or a combination of two or more of these. The processor 502 executes instructions for the computer program being executed to implement any embodiment of the data encryption method of the first aspect of the application described above by reading the instructions stored in the memory 501.

[0113] The processor 502 runs a computer program corresponding to the executable program code stored in the memory 501 by reading the executable program code, for implementing any embodiment of the data encryption method of the first aspect of the application described above.

[0114] In one example, the encryption device 50 can also include a communication interface 503 and a bus 504. As shown in FIG. 11, the memory 501, the processor 502, and the communication interface 503 are connected through the bus 504 and complete communication with each other.

[0115] The communication interface 503 is mainly used to realize the communication between the modules, devices, units and / or equipment in the embodiments of the application. The input device and / or the output device can also be accessed through the communication interface 503.

[0116] Bus 504 includes hardware, software, or both, to couple components of encryption device 50 to each other in communication. While Figure 4 provides an example of a bus, it is to be understood that other bus architectures can be used in conjunction with or instead of bus 504. For example, bus 504 can be an Accelerated Graphics Port (AGP) bus or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand® interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or another suitable bus or a combination of two or more of these. Where appropriate, bus 504 can include one or more buses. Although this application describes and shows a particular bus, this application contemplates any suitable bus or interconnect.

[0117] The encryption device can also be provided by the embodiments of the present application, and the specific structure of the encryption device can refer to the encryption device 50 shown in Figure 11. It should be noted that the processor in the decryption device runs the computer program corresponding to the executable program code stored in the memory by reading the executable program code, so as to realize any embodiment of the data decryption method of the second aspect of the present application. The remaining contents can refer to the related description in the above embodiments, and will not be repeated here.

[0118] The embodiments of the present application also provide a computer readable storage medium, and the computer readable storage medium stores a computer program. When the computer program is executed by the processor, any embodiment of the data encryption method of the first aspect of the present application or any embodiment of the data decryption method of the second aspect of the present application can be realized. Examples of the computer readable medium can be non-transitory computer readable medium, including ROM, RAM, magnetic disk or optical disk, etc.

[0119] It should be noted that each of the embodiments described in this specification has been described as if specific implementations thereof are only possible in the particular context of that embodiment. However, under the doctrine of equivalents, each of the elements including within the scope of the embodiments are applicable in any

[0120] Those of skill in the art would understand that information and signals can be represented using any of a variety of technologies and techniques. For example, data, instructions, commands, information, signals, bits, symbols, and chips that can be referenced throughout the above description can be represented by voltages, currents, electromagnetic waves, magnetic fields or particles, optical fields or particles, or any combination thereof.

[0121] Those of skill in the art would understand that information and signals can be represented using any of a variety of technologies and techniques. For example, data, instructions, commands, information, signals, bits, symbols, and chips that can be referenced throughout the above description can be represented by voltages, currents, electromagnetic waves, magnetic fields or particles, optical fields or particles, or any combination thereof. It should be noted that the above-mentioned embodiments illustrate rather than limit the application, that since some of the components have not been described in detail in the embodiments, the components are not limited to the embodiments described, and that the components can be implemented in various forms. The embodiments described above are merely used to illustrate the principles of the present application, and the scope of the present application is not limited to the embodiments described above.

Claims

1. A data encryption method, comprising: Obtain the first key, and perform an obfuscation operation on the first key and the data to be encrypted to obtain the obfuscation result data; Obtain the second key, and based on the second key, obtain the first signature of the obfuscation result data; Obtain a third key, and use the third key to encrypt the first key, the data to be encrypted, and the first signature to obtain the target ciphertext; Obtain the fourth key, and based on the fourth key, obtain the second signature of the target ciphertext; Generate an encrypted file that includes the target ciphertext and the second signature.

2. The method according to claim 1, further comprising: Receive the third key generated and sent by the decryption device.

3. The method according to claim 1, wherein, The first key is a key generated by the encryption device, and the first key is a public key.

4. The method according to claim 1, wherein, The third key is either a public key or a symmetric key.

5. The method according to claim 1, wherein, The second key and the fourth key are keys generated by the encryption device; The second key and the fourth key are private keys; The first key is a public key, and the second key and / or the fourth key is a private key corresponding to the first key.

6. The method according to claim 1 or 5, wherein, The second key is the same as the fourth key.

7. The method according to claim 1, wherein, The confusion factor in the confusion operation includes the first key.

8. A data decryption method, comprising: Receive an encrypted file including target ciphertext and a second signature, wherein the second signature is a signature of the target ciphertext obtained by the encryption device based on a fourth key; Using a pre-stored fifth key that is paired with the third key, the target ciphertext is decrypted to obtain the first key, the data to be encrypted, and the first signature; The target ciphertext and the second signature are verified using a sixth key that is paired with the fourth key; The first key obtained from decryption is used to perform the same obfuscation operation as in the encryption device on the data to be encrypted to obtain obfuscation result data. The obfuscation result data and the first signature are verified using a seventh key that is paired with the second key. The first signature is the signature of the obfuscation result data obtained by the encryption device based on the second key.

9. The method according to claim 8, further comprising: If the verification of the target ciphertext and the second signature is successful, and the verification of the obtained obfuscation result data and the first signature is successful, it is determined that the encrypted file has not been tampered with.

10. The method according to claim 8, wherein, Before receiving the encrypted file including the target ciphertext and the second signature, the method further includes: Generate and send the third key to the encryption device.

11. The method according to claim 8, wherein, The first key is a key generated by the encryption device, and the first key is a public key.

12. The method according to claim 8, wherein, The third key is either a public key or a symmetric key.

13. The method according to claim 8, wherein, The second key and the fourth key are keys generated by the encryption device; The second key and the fourth key are private keys.

14. The method according to claim 8, wherein, When the first key is a public key and the fourth key is a private key corresponding to the first key, the sixth key is the first key obtained by decrypting the target ciphertext; When the first key is a public key and the second key is a private key corresponding to the first key, the seventh key is the first key obtained by decrypting the target ciphertext.

15. The method according to claim 8, wherein, The confusion factor in the confusion operation includes the first key mentioned above.

16. An encryption device, comprising: The obfuscation module is used to obtain a first key, perform an obfuscation operation on the first key and the data to be encrypted, and obtain the obfuscation result. The signature module is used to obtain a second key and, based on the second key, obtain a first signature of the obfuscation operation result; An encryption module is used to obtain a third key and use the third key to encrypt the first key, the data to be encrypted, and the first signature to obtain the target ciphertext. The signature module is also used to obtain a fourth key and, based on the fourth key, to obtain a second signature of the target ciphertext; An encrypted file generation module is used to generate an encrypted file that includes the target ciphertext and the second signature.

17. A decryption device, comprising: A receiving module is used to receive an encrypted file including target ciphertext and a second signature, wherein the second signature is a signature of the target ciphertext obtained by the encryption device based on a fourth key; The decryption module is used to decrypt the target ciphertext using a pre-stored fifth key that is paired with the third key, to obtain the first key, the data to be encrypted, and the first signature; The first verification module is used to verify the target ciphertext and the second signature using a sixth key that is paired with the fourth key; The second verification module is used to perform the same obfuscation operation as in the encryption device on the first key obtained by decryption and the data to be encrypted to obtain obfuscation result data, and to verify the obfuscation result data and the first signature using a seventh key that is paired with the second key. The first signature is the signature of the obfuscation result data obtained by the encryption device based on the second key.

18. An encryption device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the data encryption method as described in any one of claims 1 to 7.

19. A decryption apparatus comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the data decryption method as described in any one of claims 8 to 15.

20. A computer-readable storage medium storing a computer program thereon, the computer program, when executed by a processor, implementing a data encryption method as claimed in any one of claims 1 to 7 or a data decryption method as claimed in any one of claims 8 to 15.

21. An encrypted file, characterized in that, include The target ciphertext is the ciphertext obtained by encrypting the first key, the data to be encrypted, and the first signature using the third key. The first signature is the signature of the obfuscation result data obtained based on the second key. The obfuscation result data is the data obtained by performing an obfuscation operation on the first key and the data to be encrypted. The second signature is the signature of the target ciphertext obtained based on the fourth key.

22. The encrypted file according to claim 21, wherein, The first key is a public key.

23. The encrypted file according to claim 21, wherein, The third key is either a public key or a symmetric key.

24. The encrypted file according to claim 21, wherein, The first key is a public key, and the second key and / or the fourth key is a private key corresponding to the first key.

25. The encrypted file according to claim 21, wherein, The second key is the same as the fourth key.

26. The encrypted file according to claim 21, wherein, The confusion factor in the confusion operation includes the first key mentioned above.