Summary of the invention
The object of the present invention is to provide a kind of encryption of virtual machine image file, decryption method and system, thus solve the foregoing problems existed in prior art.
To achieve these goals, the technical solution used in the present invention is as follows:
An encryption method for virtual machine image file, comprises the steps:
S1, to virtual machine image file, sets up the one-to-one relationship between the system time of each data and cryptographic algorithm, forms cryptographic algorithm combination;
S2, receives each be-encrypted data, and obtains corresponding system time;
S3, in described cryptographic algorithm combination, the system time according to getting in step S2 is retrieved, and obtains the cryptographic algorithm that each described be-encrypted data is corresponding;
S4, utilizes be-encrypted data described in described cryptographic algorithm and double secret key to be encrypted, obtains enciphered data;
S5, adds to the system time got in step S2 after described enciphered data, and all described enciphered datas is all write in virtual machine image file.
Preferably, the described system time in step S1 and S2 is all accurate to delicate.
Particularly, in step S1, the described one-to-one relationship set up between the system time of each data and cryptographic algorithm, is specially, by the kind of the system time of described each data divided by described cryptographic algorithm, between the remainder obtained and described cryptographic algorithm, set up one-to-one relationship; In step S3, described in described cryptographic algorithm combination, system time according to getting in step S2 is retrieved, be specially, the system time got in described rapid S2 is divided by the kind of described cryptographic algorithm, obtain remainder, utilize the described remainder obtained as key, retrieval in described cryptographic algorithm combination.
Preferably, in step S4, described key adopts MD5 value.
An encryption system for virtual machine image file, comprising:
Decision-making module: for virtual machine image file, set up the one-to-one relationship between the system time of each data and cryptographic algorithm, forms cryptographic algorithm combination; Also in described cryptographic algorithm combination, the system time got when receiving each be-encrypted data according to encrypting module is retrieved, and obtains the cryptographic algorithm that each described be-encrypted data is corresponding;
Encrypting module: for receiving each be-encrypted data, and obtain corresponding system time; Also for utilizing be-encrypted data described in described cryptographic algorithm and double secret key to be encrypted, obtain enciphered data; Also for the system time got when receiving each be-encrypted data is added to after described enciphered data, and all described enciphered datas are all write in virtual machine image file.
A decryption method for virtual machine image file, comprises the steps:
S1, to virtual machine image file, sets up the one-to-one relationship between the system time of each data and cryptographic algorithm, forms cryptographic algorithm combination;
S2, receives each enciphered data, and system time when obtaining the encryption of described enciphered data;
S3, in described cryptographic algorithm combination, retrieves according to system time during described enciphered data encryption, obtains the cryptographic algorithm that each described enciphered data is corresponding;
S4, obtains the decipherment algorithm that described cryptographic algorithm is corresponding;
S5, utilizes enciphered data described in described decipherment algorithm and double secret key to be decrypted, obtains data decryption.
Preferably, the described system time in step S1 and S2 is all accurate to delicate.
Particularly, in step S1, the described one-to-one relationship set up between the system time of each data and cryptographic algorithm, is specially, by the kind of the system time of described each data divided by described cryptographic algorithm, between the remainder obtained and described cryptographic algorithm, set up one-to-one relationship; In step S3, described in described cryptographic algorithm combination, system time according to getting in step 2 is retrieved, be specially, system time during described enciphered data encryption is divided by the kind of described cryptographic algorithm, obtain remainder, utilize the described remainder obtained as key, retrieval in described cryptographic algorithm combination.
Preferably, in step S5, described key adopts MD5 value.
A decryption system for virtual machine image file, comprising:
Decision-making module: for virtual machine image file, set up the one-to-one relationship between the system time of each enciphered data and cryptographic algorithm, forms cryptographic algorithm combination; Also in described cryptographic algorithm combination, retrieve according to system time during described enciphered data encryption, obtain the cryptographic algorithm that each described enciphered data is corresponding;
Deciphering module: for receiving each enciphered data, and system time when obtaining the encryption of described enciphered data; Also for obtaining decipherment algorithm corresponding to described cryptographic algorithm; Also for utilizing enciphered data described in described decipherment algorithm and double secret key to be decrypted, obtain data decryption.
The invention has the beneficial effects as follows: by setting up one-to-one relationship by between cryptographic algorithm and the system time of each data in the present invention, form complicated cryptographic algorithm combination, and use the combination of the cryptographic algorithm of this complexity to encrypt and decrypt virtual machine image file.Even if thus hacker is got image file and key, if the cryptographic algorithm combination of this complexity cannot be obtained, also cannot be decrypted virtual machine image file, thus ensure that the safety of image file.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearly understand, below in conjunction with accompanying drawing, the present invention is further elaborated.Should be appreciated that embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
As shown in Figure 1, embodiments provide a kind of encryption method of virtual machine image file, comprise the steps:
S1, to virtual machine image file, sets up the one-to-one relationship between the system time of each data and cryptographic algorithm, forms cryptographic algorithm combination;
S2, receives each be-encrypted data, and obtains corresponding system time;
S3, in described cryptographic algorithm combination, the system time according to getting in step 2 is retrieved, and obtains the cryptographic algorithm that each described be-encrypted data is corresponding;
S4, utilizes be-encrypted data described in described cryptographic algorithm and double secret key to be encrypted, obtains enciphered data;
S5, adds to the system time got in step 2 after described enciphered data, and all described enciphered datas is all write in virtual machine image file.
In the prior art, when all data in virtual machine image file are encrypted, general multiple data can adopt identical algorithm, because the cryptographic algorithm of data is very limited, after hacker obtains the key of enciphered data, be easy to the image file deciphering of will be encrypted by identical algorithms, thus get the data in image file, like this, the potential safety hazard of virtual machine image file is just caused.In the embodiment of the present invention, in order to solve the easily decrypted of the single algorithm for encryption of multiple data acquisition in virtual machine image file, cause the unsafe problem of image file, provide a kind of encryption method, one-to-one relationship is set up by between cryptographic algorithm and the system time of each data, formation cryptographic algorithm combines, in the combination of this cryptographic algorithm, the corresponding cryptographic algorithm of system time of data, owing to there are multiple data in each image file, each data have corresponding system time, the corresponding cryptographic algorithm of each system time, so in same image file, just employ multiple cryptographic algorithm to be encrypted it, and cryptographic algorithm combination can be flexible and changeable, regularly change.So each image file corresponding cryptographic algorithm combination may be not identical yet, thus encryption image file being carried out to multiple encryption algorithms can be realized, and just do not adopt single algorithm, so, after hacker obtains image file and key, with regard to being not easy, the image file by cryptographic algorithm combined ciphering is decrypted, thus gets the data in image file, like this, just ensure that the safety of image file.
Wherein, the described system time in step S1 and S2 is all accurate to delicate.Like this, the quantity of system time can be more, and the cryptographic algorithm combination of formation can be more complicated, and the enciphered data obtained can be difficult to deciphering more.
In the embodiment of the present invention, in step S1, the described one-to-one relationship set up between the system time of each data and cryptographic algorithm, is specially, by the kind of the system time of described each data divided by described cryptographic algorithm, between the remainder obtained and described cryptographic algorithm, set up one-to-one relationship; In step S3, described in described cryptographic algorithm combination, system time according to getting in step 2 is retrieved, be specially, the system time got in described rapid 2 is divided by the kind of described cryptographic algorithm, obtain remainder, utilize the described remainder obtained as key, retrieval in described cryptographic algorithm combination.Utilize according to the system time after certain rule treatments as retrieval key, the cryptographic algorithm that the data that can find this system time fast use, thus the encryption realized fast data, when system time constantly changes, determine to use the speed of which kind of cryptographic algorithm will play important effect to the processing speed of data encryption, and then the operational efficiency of influential system.As will be understood by the skilled person in the art, other rule can also be adopted to process system time, utilize the system time after process as retrieval key.
In the embodiment of the present invention, described key adopts MD5 value.Key is made to be not easy to be cracked.
As shown in Figure 2, another embodiment of the present invention provides a kind of encryption system of virtual machine image file, comprising:
Decision-making module: for virtual machine image file, set up the one-to-one relationship between the system time of each data and cryptographic algorithm, forms cryptographic algorithm combination; Also in described cryptographic algorithm combination, the system time got when receiving each be-encrypted data according to encrypting module is retrieved, and obtains the cryptographic algorithm that each described be-encrypted data is corresponding;
Encrypting module: for receiving each be-encrypted data, and obtain corresponding system time; Also for utilizing be-encrypted data described in described cryptographic algorithm and double secret key to be encrypted, obtain enciphered data; Also for the system time got when receiving each be-encrypted data is added to after described enciphered data, and all described enciphered datas are all write in virtual machine image file.
The encryption system of the virtual machine image file provided in the embodiment of the present invention, for realizing the encryption method of the virtual machine image file that the above embodiment of the present invention provides.
Its specific implementation process is: encrypting module receives the data from virtual machine image file, and obtains system time corresponding to each data; System time is utilized to use which kind of cryptographic algorithm as key data query encryption in decision-making module; Cryptographic algorithm corresponding for key is fed back to encrypting module by decision-making module, after encrypting module gets cryptographic algorithm, utilize these data of double secret key to be encrypted, obtain enciphered data, system time when receiving be-encrypted data is added to after enciphered data, and writes in virtual machine image file.After all data in virtual image file are all encrypted, just complete the encryption to image file.
As shown in Figure 3, embodiments provide a kind of decryption method of virtual machine image file, comprise the steps:
S1, to virtual machine image file, sets up the one-to-one relationship between the system time of each data and cryptographic algorithm, forms cryptographic algorithm combination;
S2, receives each enciphered data, and system time when obtaining enciphered data encryption;
S3, in described cryptographic algorithm combination, retrieves according to system time during described enciphered data encryption, obtains the cryptographic algorithm that each described enciphered data is corresponding;
S4, obtains the decipherment algorithm that described cryptographic algorithm is corresponding;
S5, utilizes enciphered data described in described decipherment algorithm and double secret key to be decrypted, obtains data decryption.
The decryption method of the virtual machine image file that the embodiment of the present invention provides corresponds to the encryption method of the virtual machine image file provided in above-described embodiment, realizes deciphering to the enciphered data that the encryption method adopted in above-described embodiment obtains.
Wherein, the described system time in step S1 and S2 is all accurate to delicate.
In step S1, the described one-to-one relationship set up between the system time of each data and cryptographic algorithm, be specially, by the kind of the system time of described each data divided by described cryptographic algorithm, between the remainder obtained and described cryptographic algorithm, set up one-to-one relationship; In step S3, described in described cryptographic algorithm combination, system time according to getting in step 2 is retrieved, be specially, system time during described enciphered data encryption is divided by the kind of described cryptographic algorithm, obtain remainder, utilize the described remainder obtained as key, retrieval in described cryptographic algorithm combination.
In step S5, described key adopts MD5 value.
As shown in Figure 4, in one embodiment of the invention, provide a kind of decryption system of virtual machine image file, comprising:
Decision-making module: for virtual machine image file, set up the one-to-one relationship between the system time of each data and cryptographic algorithm, forms cryptographic algorithm combination; Also in described cryptographic algorithm combination, retrieve according to system time during described enciphered data encryption, obtain the cryptographic algorithm that each described enciphered data is corresponding;
Deciphering module: for receiving each enciphered data, and system time when obtaining enciphered data encryption; Also for obtaining decipherment algorithm corresponding to described cryptographic algorithm; Also for utilizing enciphered data described in described decipherment algorithm and double secret key to be decrypted, obtain data decryption.
The decryption system of the virtual machine image file provided in the embodiment of the present invention, for realizing the decryption method of the virtual machine image file that the above embodiment of the present invention provides.
Its specific implementation process is: deciphering module receives the enciphered data from virtual machine image file, and obtains system time corresponding to each enciphered data; The cryptographic algorithm used when utilizing system time to inquire about enciphered data encryption as key in decision-making module; Cryptographic algorithm corresponding for key is fed back to deciphering module by decision-making module, after deciphering module gets cryptographic algorithm, utilizes key and decipherment algorithm corresponding to cryptographic algorithm to be decrypted enciphered data, obtains data decryption.After all enciphered datas in virtual image file are all deciphered, just complete the deciphering to image file.
By adopting technique scheme disclosed by the invention, obtain effect useful as follows: in the embodiment of the present invention, one-to-one relationship is set up by between cryptographic algorithm and the system time of each data, formation cryptographic algorithm combines, in the combination of this cryptographic algorithm, the corresponding cryptographic algorithm of system time of data, owing to there are multiple data in each image file, each data have corresponding system time, the corresponding cryptographic algorithm of each system time, so in same image file, just employ multiple cryptographic algorithm to be encrypted it, and cryptographic algorithm combination can be flexible and changeable, regularly change.So each image file corresponding cryptographic algorithm combination may be not identical yet, thus encryption image file being carried out to multiple encryption algorithms can be realized, and just do not adopt single algorithm, so, after hacker obtains image file and key, with regard to being not easy, the image file by encrypting in algorithm combination is decrypted, thus gets the data in image file, like this, just ensure that the safety of image file.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.
Those skilled in the art it should be understood that the sequential of the method step that above-described embodiment provides can carry out accommodation according to actual conditions, also can carry out according to actual conditions are concurrent.
The hardware that all or part of step in the method that above-described embodiment relates to can carry out instruction relevant by program has come, described program can be stored in the storage medium that computer equipment can read, for performing all or part of step described in the various embodiments described above method.Described computer equipment, such as: personal computer, server, the network equipment, intelligent mobile terminal, intelligent home device, wearable intelligent equipment, vehicle intelligent equipment etc.; Described storage medium, such as: the storage of RAM, ROM, magnetic disc, tape, CD, flash memory, USB flash disk, portable hard drive, storage card, memory stick, the webserver, network cloud storage etc.
Finally, also it should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operational zone, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, commodity or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, commodity or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, commodity or the equipment comprising described key element and also there is other identical element.
The above is only the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications also should look protection scope of the present invention.