Summary of the invention
The invention provides a kind of file concealed-enciphering storage means and system to address the above problem.
The invention provides a kind of file concealed-enciphering storage means, may further comprise the steps.File handler receives the file that client sends, and according to first strategy, generates encrypt file and described encrypt file is sent to controller.Described controller obtains storer residual memory space size and bunch number.If storer residual memory space size is more than or equal to described encrypt file size, then described controller obtains file allocation table and described encrypt file and described file allocation table is sent to the file allocation device according to second strategy.Described file allocation device is according to the described file allocation table and the described encrypt file that receive, with described encrypt file be stored in the storer residual memory space bunch in.
The invention provides a kind of file concealed-enciphering storage system, comprise client, file handler, file allocation device, controller and storer, described client connects described file handler, described file handler connects controller, described controller is threaded file divider and storer respectively, described file allocation device connected storage.Described file handler is used for receiving the file that client sends, and according to first strategy, generates encrypt file and described encrypt file is sent to controller.Described controller, be used for obtaining storer residual memory space size and bunch number, also be used for as if storer residual memory space size more than or equal to described encrypt file size, according to second strategy, obtain file allocation table and described encrypt file and described file allocation table are sent to the file allocation device.Described file allocation device is used for according to the described file allocation table and the described encrypt file that receive, with described encrypt file be stored in the storer residual memory space bunch in.Described storer is used for providing residual memory space size and bunch number to described controller; Also be used for encrypted file.
Compared to prior art, according to file concealed-enciphering storage means provided by the invention and system, file handler receives the file that client sends, and according to first strategy, generates encrypt file and encrypt file is sent to controller.File encryption is handled, improved data security.Controller obtains storer residual memory space size and bunch number.If storer residual memory space size is greater than the encrypt file size, then controller obtains file allocation table and encrypt file and file allocation table is sent to the file allocation device according to second strategy.The file allocation device is according to the file allocation table and the encrypt file that receive, with encrypt file be stored in the storer residual memory space bunch in, thereby realized data security.
Embodiment
Hereinafter will describe the present invention with reference to the accompanying drawings and in conjunction with the embodiments in detail.Need to prove that under the situation of not conflicting, embodiment and the feature among the embodiment among the application can make up mutually.
Figure 1 shows that the process flow diagram of the file concealed-enciphering storage means that preferred embodiment according to the present invention provides.As shown in Figure 1, the file concealed-enciphering storage means that provides of preferred embodiment of the present invention comprises step 101~104.
Step 101: file handler receives the file that client sends, and according to first strategy, generates encrypt file and described encrypt file is sent to controller.
Particularly, file handler is according to first strategy, and the process that generates encrypt file is: file handler is according to default block number, by block algorithm, described file carried out piecemeal after, make up; The head and the tail of the blocks of files after combination add that check code (is defined as: first data); The file signature that utilizes the MD5 algorithm to calculate first data (is defined as: second data); Make up main first data, be equipped with first data and second data, obtain encrypt file.Wherein, file handler is according to default block number, and by block algorithm, the mode of described file being carried out piecemeal is: get [v/i] remainder, described file is carried out piecemeal, wherein, and the data bit order in the v representation file, i is default block number.
For example, the file to be stored that file handler receives is " a kind of method and system of file concealed-enciphering storage ", if default block number is 3, it is that 0 blocks of files 1, remainder are that 1 blocks of files 2 and remainder are 2 blocks of files 3 that described 3 partition data pieces are respectively remainder.File handler is got [v/i] remainder, and for example: " one " data bit order hereof is 1, and the remainder of then getting [1/3] is 1, then " one " is put into remainder and be 1 blocks of files 2; " kind " data bit order hereof is 2, and the remainder of then getting [2/3] is 2, then " kind " is put into remainder and be 2 blocks of files 3; " literary composition " data bit order hereof is 3, and the remainder of then getting [3/3] is 0, then " literary composition " is put into remainder and be 0 blocks of files 1, by that analogy, obtains following blocks of files:
Remainder is 0 blocks of files 1 |
The literary composition shape side of depositing system |
Remainder is 1 blocks of files 2 |
One adds storage legally constituted authority |
Remainder is 2 blocks of files 3 |
Kind latent close and |
Make up above-mentioned three blocks of files and obtain following blocks of files: the civilian shape side of depositing be one add storage legally constituted authority kind latent close and.The head and the tail of the blocks of files after described combination add check code, are defined as first data: the BEGIN literary composition shape side of depositing and are one and add storage legally constituted authority kind and conceal close and END.Utilize the MD5 algorithm to calculate the file signature of first data, and be defined as second data, as follows: 57219DFEB567EE470DDA2824F0270A5E.Main first data of combination, be equipped with first data and second data, obtain encrypt file and be: the BEGIN literary composition shape side of depositing is one and adds storage legally constituted authority kind latent close and the END BEGIN literary composition shape side of depositing and be one and add and store up the legally constituted authority kind and conceal close and END57219DFEB567EE470DDA2824F0270A5E.
Step 102: described controller obtains storer residual memory space size and bunch number.
Particularly, after described controller receives the encrypt file of file handler transmission, send query requests to storer; Described storer responds to described controller feedback query, wherein, has carried storer residual memory space size and bunch number in the described inquiry response.In this, described storer is according to default single bunch storage size and residual memory space size, the number that obtains bunch.Computing formula is, bunch the storage size of number=storer residual memory space size/single bunch.
For example, if single bunch storage size is 4K, storer residual memory space size 4M, then bunch number=4M/4K=1024.
Step 103: more than or equal to described encrypt file size, then described controller obtains file allocation table and described encrypt file and described file allocation table is sent to the file allocation device according to second strategy as if storer residual memory space size.
Particularly, the more described storer residual memory space size of controller and encrypt file size, if storer residual memory space size is less than described encrypt file size, described controller sends the information of reporting an error to described file handler, returns miscue by file handler to client.
When controller comparison storer residual memory space size was big or small more than or equal to described encrypt file, controller was according to second strategy, and the process that obtains file allocation table is: described controller basis
Obtain file allocation table, wherein, x 〉=1 and x are positive integer; Y=ax
2+ bx+c(a<0), which individual bunch x represent, and y represents the value of x correspondence.
For example, suppose that the encrypt file size is 2M, the residual memory space size of storer is 4M, if single bunch storage size is 4K, then the residual memory space of storer has 1024 bunches.Function y=ax
2The area of the common factor of para-curve+bx+c(a<0) and x axle is encrypt file size, i.e. 2M.In this, the intersecting point coordinate of described para-curve and x axle is (0,0) and (1024,0), can get described para-curve expression formula thus and be y=a (x-0) (x-1024), i.e. y=ax
2-1024ax.
In present embodiment, namely
Calculate and obtain a=-3/512
2, described functional expression y=-3/512 then
2x
2+ 3/256x.
Figure 2 shows that the para-curve synoptic diagram of functional expression.As shown in Figure 2, described functional expression is y=-3/512
2x
2+ 3/256x.In present embodiment,
Then 1st bunch of last encrypt file size to be stored is
Going up encrypt file size to be stored for 2nd bunch is
And the like, the 1024th bunch of last encrypt file size to be stored is
The acquisition file allocation table is as follows:
Bunch |
Encrypt file size to be stored |
1 |
0.00585556KB |
2 |
0.017551422KB |
… |
… |
512 |
2.999996185KB |
… |
… |
1024 |
0.00585556KB |
Step 104: described file allocation device is according to the described file allocation table and the described encrypt file that receive, with described encrypt file be stored in the storer residual memory space bunch in.
Particularly, described file allocation device is according to the described file allocation table and the described encrypt file that receive, with described encrypt file be stored in the storer residual memory space bunch in process be: the encrypt file size to be stored of each bunch correspondence in the described file allocation device inquiry file allocation table, the encrypt file that obtains corresponding size store in the correspondence bunch of described storer successively.
Figure 2 shows that the synoptic diagram of the file concealed-enciphering storage system that preferred embodiment according to the present invention provides.As shown in Figure 2, the file concealed-enciphering storage system that preferred embodiment of the present invention provides comprises client 201, file handler 202, controller 203, file allocation device 204 and storer 205, described client 201 connects described file handler 202, described file handler 202 connects controller 203, described controller 203 is threaded file divider 204 and storer 205 respectively, described file allocation device 204 connected storages 205.Described file handler 202 is used for receiving the file that client 201 sends, and according to first strategy, generates encrypt file and described encrypt file is sent to controller 203.Described controller 203, be used for obtaining storer 205 residual memory spaces size and bunch number, also be used for as if storer 205 residual memory space sizes more than or equal to described encrypt file size, according to second strategy, obtain file allocation table and described encrypt file and described file allocation table are sent to file allocation device 204.Described file allocation device 204 is used for according to the described file allocation table and the described encrypt file that receive, with described encrypt file be stored in storer 205 residual memory spaces bunch in.Described storer 205 is used for providing residual memory space size and bunch number to described controller; Also be used for encrypted file.Operating process about said system is described with above-mentioned method, so repeat no more in this.
In sum, preferred embodiment provides according to the present invention file concealed-enciphering storage means and system, file handler receives the file that client sends, and according to first strategy, generates encrypt file and encrypt file is sent to controller.File encryption is handled, improved data security.Controller obtains storer residual memory space size and bunch number.If storer residual memory space size is greater than the encrypt file size, then controller obtains file allocation table and encrypt file and file allocation table is sent to the file allocation device according to second strategy.The file allocation device is according to the file allocation table and the encrypt file that receive, with encrypt file be stored in the storer residual memory space bunch in, thereby realized data security.
The above is the preferred embodiments of the present invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of doing, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.