Disclosure of Invention
The invention aims to protect private files uploaded by a user and improve use experience, and designs an application method for compositely encrypting and storing private contents of the user. The invention not only can store the content, but also can protect the security of the content uploaded by the user from being stolen through secondary encryption.
The implementation framework of the invention comprises a client, a third party and a server, and mainly carries out encryption operation between the client and the third party and between the third party and the server.
Aiming at the process of uploading and finally retrieving contents by a user, the design method mainly comprises the following steps:
step 1, a client encrypts content to be uploaded by a public key to form a ciphertext through generating an asymmetric encrypted public and private key, the private key is reserved by the client, meanwhile, a Hash function algorithm is used for generating a message digest I of the ciphertext, the message digest can be backed up at the client, and then the message digest I of the ciphertext and the asymmetrically encrypted ciphertext I are sent to a third party.
And 2, the third party uses the key stream generator to generate another pair of keys for the received encrypted ciphertext, encrypts the ciphertext and the message digest by using the symmetric encryption key again and sends the encrypted ciphertext and the message digest to the server, and simultaneously returns a decryption key of the symmetric key to the client.
And 3, when the client needs to retrieve the stored content, sending a decryption key returned by the third party to the server, after the server decrypts the content by using the decryption key, sending a ciphertext encrypted by the user private key and the message digest I back to the client, and decrypting the ciphertext by using the asymmetric encryption private key stored by the client. And while obtaining the content, the client performs the same Hash function operation processing (such as MD5 and SHA algorithm) on the message digest I, compares the decrypted message digest with the message digest of the local backup, if the decrypted message digest is consistent with the message digest of the local backup, the content stored in the server is complete, and if the decrypted message digest is different from the local backup, the content is replaced or modified.
Further, the client uses an algorithm of asymmetric encryption of a public key and a private key, which includes one of RSA, Elgamal, knapsack algorithm, Rabin, and the like.
Further, step 2, when the third party sends the information to the server, symmetric encryption is performed in a form of a key stream generator, a linear feedback shift register is used as a core, and a symmetric key with a corresponding bit number is generated by setting the number of registers. And each time the third party sends the encrypted ciphertext and the message digest I to the server, a new key is generated from the key stream generator to symmetrically encrypt the ciphertext and the message digest I. The encryption method used includes one of the main white-box encryption algorithms such as DES, AES, SM4, etc.
It should be understood that the principles of the present invention relating to white-box cryptography and asymmetric encryption will be understood by those skilled in the relevant arts that only the implementation of storing user private content applications based on composite encryption will be described in detail.
The invention has the following beneficial effects:
different from the traditional cryptographic algorithm, the invention can resist the attack under the white-box attack environment, and is a new algorithm, not the design for realizing the white-box security on the existing algorithm. The method and the device can ensure that even if the private content uploaded by the user is successfully acquired, the content can be successfully acquired only by decrypting through the private key stored by the user. Any algorithm of white-box ciphers AES, DES and SM4 can be used in symmetric encryption
The invention designs an application with symmetric encryption and asymmetric encryption for storing private contents of a user, the stored contents of the existing storage server are generally operated only by using a decryption key through a client and verifying and retrieving the decryption key on a platform, and once the decryption key of the user is leaked in the process, the content of the user can possibly cause the leakage influence. The invention can store the user content, and the transmission process between the third party and the server adopts symmetric encryption, thereby playing the advantages of high encryption/decryption speed and simple key management. And the client side adopts the asymmetric key to encrypt and decrypt the content, so that the content cannot be generated in a third party and a server, and the security of the content is greatly improved. Even if an attacker obtains the decryption key symmetrically encrypted in the process, the attacker cannot unlock the private content without the private key of the user. Another advantage of the present invention is: encryption/decryption keys used for uploading different contents can be different, and the security is further improved.
Detailed Description
In order to make the principle, functional purpose and technical solution of the present invention more apparent, the following detailed description is given in conjunction with specific embodiments. It should be understood that this embodiment is used for illustration and does not limit the scope of the invention.
Fig. 1 is a schematic flow chart of the implementation of storing the private content of the user according to the present invention, and a specific flow chart is described below with reference to fig. 1.
Step 110: the client side generates an asymmetric encrypted public and private key, encrypts the content to be uploaded by using the public key to form a ciphertext, the private key is reserved by the client side, meanwhile, a Hash function algorithm is used for generating a message digest I of the ciphertext, the message digest can be backed up at the client side, and then the message digest I of the ciphertext and the ciphertext after asymmetric encryption are sent to a third party.
Step 120: and the third party generates another pair of keys for the received encrypted ciphertext by using the key stream generator, encrypts the ciphertext and the message digest by using the symmetric encryption key again and sends the encrypted ciphertext and the message digest to the server. The server is used for storing the encrypted content and sending the encrypted content and the decryption key of the symmetric key back to the client.
Step 130: when the user needs to retrieve the stored content, the decryption key returned by the third party is sent to the server through the client, and the server uses the decryption key for decryption.
Step 140: and if the server is successfully decrypted, the content encrypted by the private key of the user is sent back to the client, and the user decrypts the content by using the stored asymmetric encryption private key to obtain the previously stored content.
Step 150: the client carries out the same Hash function operation processing on the message digest I, compares the decrypted message digest with the message digest of the local backup, if the decrypted message digest is consistent with the message digest of the local backup, the content stored in the server is complete, and if the decrypted message digest is different from the local backup, the content is replaced or modified.
The above-mentioned Hash function operation processing procedure for the data cipher text can adopt one of MD5 and SHA algorithm.
The invention adopts specific embodiments to clearly explain the design principle and the application method of the invention in detail. It should be understood, however, that the form of the server according to the present invention is not limited to a specific form, and the above-described embodiments are intended to help understand the implementation process of the present invention, and do not limit the application scope of the present invention to the embodiments described in the specification. Modifications, improvements and the like of the present invention with respect to the relevant researchers are also intended to be included within the scope of the present invention.