Summary of the invention
The invention provides a kind of file concealed-enciphering storage means and system to solve the problem.
The invention provides a kind of file concealed-enciphering storage means, comprise the following steps.File handler receives the file that client sends, and according to the 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 is according to the second strategy, obtains file allocation table and described encrypt file and described file allocation table are sent to file allocation device.Described file allocation device according to receive described file allocation table and described encrypt file, described encrypt file is stored in 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, file handler described in described client's side link, described file handler connection control device, described controller is threaded file divider and storer respectively, described file allocation device connected storage.Described file handler, for receiving the file that client sends, according to the first strategy, generating encrypt file and described encrypt file is sent to controller.Described controller, for obtaining storer residual memory space size and bunch number, if be also more than or equal to described encrypt file size for storer residual memory space size, according to the second strategy, obtain file allocation table and described encrypt file and described file allocation table are sent to file allocation device.Described file allocation device, for according to receive described file allocation table and described encrypt file, described encrypt file is stored in storer residual memory space bunch in.Described storer, for providing residual memory space size and bunch number to described controller; Also for storage encryption 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 the first strategy, generates encrypt file and encrypt file is sent to controller.By file encryption process, improve data security.Controller obtains storer residual memory space size and bunch number.If storer residual memory space size is greater than encrypt file size, then controller is according to the second strategy, obtains file allocation table and encrypt file and file allocation table are sent to file allocation device.File allocation device according to the file allocation table received and encrypt file, encrypt file is stored in storer residual memory space bunch in, thus achieve data security.
Embodiment
Hereinafter also describe the present invention in detail with reference to accompanying drawing in conjunction with the embodiments.It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine 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 preferred embodiment of the present invention provides comprises step 101 ~ 104.
Step 101: file handler receives the file that client sends, according to the first strategy, generates encrypt file and described encrypt file is sent to controller.
Specifically, file handler is according to the first strategy, and the process generating encrypt file is: file handler, according to default block number, by block algorithm, after carrying out piecemeal, combines described file; The head and the tail of blocks of files after combining add check code (being defined as: the first data); MD5 algorithm is utilized to calculate the file signature (being defined as: the second data) of the first data; Main first data of combination, standby first data and the 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 to piecemeal is: get [v/i] remainder, carry out piecemeal to described file, and wherein, the data bit sequence in v representation file, i is for presetting block number.
For example, the file to be stored that file handler receives is " method and system that a kind of file concealed-enciphering stores ", if presetting block number is 3, described 3 partition data blocks be respectively remainder be 0 blocks of files 1, remainder be 1 blocks of files 2 and remainder be 2 blocks of files 3.File handler is got [v/i] remainder, such as: " one " data bit sequence is hereof 1, then the remainder getting [1/3] is 1, then " one " is put into the blocks of files 2 that remainder is 1; " kind " data bit sequence is hereof 2, then the remainder getting [2/3] is 2, then " kind " is put into the blocks of files 3 that remainder is 2; " literary composition " data bit sequence is hereof 3, then the remainder getting [3/3] is 0, then " literary composition " is put into the blocks of files 1 that remainder is 0, by that analogy, obtains following blocks of files:
Remainder is the blocks of files 1 of 0 |
Wen-shaped deposit system |
Remainder is the blocks of files 2 of 1 |
A storage method system |
Remainder is the blocks of files 3 of 2 |
Kind hidden close and |
Combine above-mentioned three blocks of files and obtain following blocks of files: Wen-shaped deposit system storage method system kind hidden close and.The head and the tail of the blocks of files after described combination add check code, are defined as the first data: BEGIN Wen-shaped deposit system storage method system kind of hidden close and END.Utilize MD5 algorithm to calculate the file signature of the first data, and be defined as the second data, as follows: 57219DFEB567EE470DDA2824F0270A5E.Combine master's the first data, for the first data and the second data, obtaining encrypt file is: BEGIN Wen-shaped deposit system storage method system is planted hidden close uniting with END BEGIN Wen-shaped deposit system storage method and planted a hidden close and END57219DFEB567EE470DDA2824F0270A5E.
Step 102: described controller obtains storer residual memory space size and bunch number.
Specifically, after described controller receives the encrypt file of file handler transmission, send inquiry request to storer; Described storer responds to described controller feedback query, wherein, carries storer residual memory space size and bunch number in described inquiry response.In this, described storer according to preset the storage size of single bunch and residual memory space size, obtain bunch number.Computing formula is, bunch the storage size of number=storer residual memory space size/single bunch.
For example, if the storage size of single bunch is 4K, storer residual memory space size 4M, then number=4M/4K=1024 bunch.
Step 103: if storer residual memory space size is more than or equal to described encrypt file size, then described controller is according to the second strategy, obtains file allocation table and described encrypt file and described file allocation table are sent to file allocation device.
Specifically, controller more described storer residual memory space size and encrypt file size, if storer residual memory space size is less than described encrypt file size, described controller sends error information to described file handler, returns miscue by file handler to client.
When controller compare storer residual memory space size be more than or equal to described encrypt file size time, controller is according to the second strategy, and obtaining the process of file allocation table is: described controller according to
obtain file allocation table, wherein, x>=1 and x is positive integer; Y=ax
2+ bx+c(a<0), which individual bunch x represent, and y represents value corresponding to x.
For example, suppose that encrypt file size is 2M, the residual memory space size of storer is 4M, if the storage size of single bunch is 4K, then the residual memory space of storer has 1024 bunches.Function y=ax
2+ bx+c(a<0) para-curve and the area of common factor of x-axis be encrypt file size, i.e. 2M.In this, the intersecting point coordinate of described para-curve and x-axis is (0,0) and (1024,0), and can obtain described para-curve expression formula is thus y=a (x-0) (x-1024), i.e. y=ax
2-1024ax.
in the present embodiment, namely
calculate and obtain a=-3/512
2, then described functional expression y=-3/512
2x
2+ 3/256x.
Figure 2 shows that the para-curve schematic diagram of functional expression.As shown in Figure 2, described functional expression is y=-3/512
2x
2+ 3/256x.In the present embodiment,
then 1st bunch of upper encrypt file size to be stored is
2nd bunch of upper encrypt file size to be stored is
the like, the 1024th bunch of upper encrypt file size to be stored is
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 according to receive described file allocation table and described encrypt file, described encrypt file is stored in storer residual memory space bunch in.
Specifically, described file allocation device is according to the described file allocation table received and described encrypt file, described encrypt file is stored in storer residual memory space bunch in process be: each bunch of corresponding encrypt file size to be stored in described file allocation device inquiry file allocation table, the encrypt file obtaining corresponding size is stored in the correspondence bunch of described storer successively.
Figure 3 shows that the schematic diagram of the file concealed-enciphering storage system that preferred embodiment according to the present invention provides.As shown in Figure 3, 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 connection control device 203, described controller 203 is threaded file divider 204 and storer 205 respectively, described file allocation device 204 connected storage 205.Described file handler 202, for receiving the file that client 201 sends, according to the first strategy, generating encrypt file and described encrypt file is sent to controller 203.Described controller 203, for obtaining storer 205 residual memory space size and bunch number, if be also more than or equal to described encrypt file size for storer 205 residual memory space size, according to the 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, for according to receive described file allocation table and described encrypt file, described encrypt file is stored in storer 205 residual memory space bunch in.Described storer 205, for providing residual memory space size and bunch number to described controller; Also for storage encryption file.About the operating process of said system with described in said method, therefore repeat no more in this.
In sum, the file concealed-enciphering storage means provided according to present pre-ferred embodiments and system, file handler receives the file that client sends, and according to the first strategy, generates encrypt file and encrypt file is sent to controller.By file encryption process, improve data security.Controller obtains storer residual memory space size and bunch number.If storer residual memory space size is greater than encrypt file size, then controller is according to the second strategy, obtains file allocation table and encrypt file and file allocation table are sent to file allocation device.File allocation device according to the file allocation table received and encrypt file, encrypt file is stored in storer residual memory space bunch in, thus achieve data security.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.