Summary of the invention
The invention provides a kind of real-time encrypted U disk and high-speed encryption and decryption method, purpose is intended to solve technological deficiencies such as existing USB flash disk device data encryption/decryption speed is slow, the data encryption mode is simple, cryptographic means is limited.
For achieving the above object, the technical scheme that real-time encrypted U disk of the present invention adopts is: a kind of real-time encrypted U disk comprises:
USB interface, this interface are the USB interface that is used to connect main frame, realize writing data from the main frame sense data or to main frame;
Flash memory is used to store data;
Flash controller is used to control the interface signal of flash memory, realizes writing data from the flash memory sense data or to flash memory;
Internal storage, the firmware or the start boot (BootLoader) that are used to store described real-time encrypted U disk;
CPU is used to carry out the instruction of the firmware input that is stored on the internal storage, finishes control and management to described real-time encrypted U disk;
Enciphering algorithm module is used to encrypt the encrypt data that the original text data of reading from main frame and deciphering are read from flash memory, realizes the high-speed encryption and decryption of data stream;
The FIFO buffer, this buffer has a FIFO buffer area, the 2nd FIFO buffer area and the 3rd FIFO buffer area, when described real-time encrypted U disk initialization, the logical address of USB interface is distributed to a FIFO buffer area, the logical address of enciphering algorithm module is distributed to the 2nd FIFO buffer area, and the logical address of flash controller is distributed to the 3rd FIFO buffer area;
Fifo controller, constitute by register, this register is provided with three control bits, wherein, after enabling, first control bit make the logical address of USB interface and the logical address of flash controller exchange, make the logical address of USB interface and the logical address of enciphering algorithm module exchange after second control bit enables, make the logical address of flash controller and the logical address of enciphering algorithm module exchange after the 3rd control bit enables;
CPU is connected by bus with flash controller with enciphering algorithm module, fifo controller, internal storage, FIFO buffer, USB interface respectively.
For achieving the above object, the technical scheme that high-speed encryption and decryption method of the present invention adopts is: a kind of high-speed encryption and decryption method of real-time encrypted U disk, carry out in write operation or the read operation process to flash memory at main frame, that utilizes second control bit and the 3rd control bit in the fifo controller alternately enables to switch USB interface, the logical address of enciphering algorithm module and flash controller, with a FIFO buffer area, mapping relations between the physical address of the 2nd FIFO buffer area and the 3rd FIFO buffer area, make a FIFO buffer area, the 2nd FIFO buffer area and the 3rd FIFO buffer area are followed USB interface in turn, enciphering algorithm module and flash controller concurrent working, Data transmission batch between main frame and flash memory, wherein, alternately the enabling since second control bit of described second control bit and the 3rd control bit during write operation, described second control bit and the 3rd control bit alternately enables since the 3rd control bit during read operation.
Related content in the technique scheme is explained as follows:
1, in the such scheme, described " USB interface " is USB interface.The full name of USB is UniversalSerial Bus, and USB supports hot plug, and the advantage of plug and play is so USB interface has become a kind of interface mode of standard.USB has two standards, i.e. USB1.1 and USB2.0.USB 1.1 is present comparatively general USB standards, and the USB2.0 standard is developed by the USB1.1 standard.Its transfer rate has reached 480Mbps, converts to MB is 60MB/s, is enough to satisfy the rate requirement of most of peripheral hardwares.In the present invention, USB interface is used to connect main frame, and USB interface selects USB1.1 or USB2.0 all can use, and wherein USB2.0 is better.
2, in the such scheme, described " a kind of real-time encrypted U disk " can also be provided with communication I/O module, and communication I/O module is connected with described CPU is two-way by bus, and external communications equipment can be connected with real-time encrypted U disk is two-way by communication I/O module.The real-time encryption and decryption process fully can be according to requirement of actual application, by being kept at the information in the internal storage or controlling by communication I/O module by external communications equipment, information in the internal storage can be upgraded by communication I/O module by external communications equipment, has realized multiple and cryptographic means flexibly.
3, in the such scheme, described " FIFO buffer " is a kind of data-carrier store, is used to store data.FIFO is the abbreviation of English First In First Out, it is a kind of data buffer of first in first out, the difference of it and normal memory is not have the exterior read-write address wire, use very simple like this, but shortcoming can only write data exactly in proper order, the sense data of order, its data address add 1 automatically by inside read-write pointer to be finished, can not that works reads or write the address of certain appointment by the address wire decision as normal memory.
4, in the such scheme, described " firmware " is exactly to write E (Firmware)
2ROM or E
2Program among the PROM (programmable read only memory), popular understanding are exactly " software of curing ".Different fully with common software, it is the program code that is solidificated in IC interior, is responsible for the function of control and coordination integrated circuit.
5, in the such scheme, described " fifo controller " is to be used to manage the pairing FIFO buffer of USB interface, cryptographic algorithm tube module and flash controller, be a FIFO buffer area, the 2nd FIFO buffer area and the 3rd FIFO buffer area in the FIFO buffer, finish the transfer of data.Be provided with three control bits in the fifo controller, first control bit is used for transparent operation between main frame and the flash memory, promptly enable data flow operations between this control bit aft engine and the flash memory without encrypting or deciphering, but directly the data in the main frame are write flash memory, or direct sense data from flash memory.This control bit generally uses under the situation that data are encrypted not needing.When encrypting or decipher, the data of transmitting to use second control bit and the 3rd control bit between need be to main frame and flash memory.
6, in the such scheme, described " enciphering algorithm module " is the module that is used to encrypt original text data or decrypting ciphertext data.The algorithm that enciphering algorithm module adopts can comprise RSA, DES, 3DES, SHA etc. or self-defining code encoding/decoding mode.Cryptographic algorithm can also be replenished from the outside by communication I/O module.
In a word, real-time encrypted U disk of the present invention adopts the hardware encipher algoritic module that data stream is encrypted, and the space that has guaranteed secret key and storage data isolates and to the encryption fully of data in the flash memory; Adopt fifo controller to switch the logical address of USB interface, enciphering algorithm module and flash controller simultaneously, and the mapping relations between the physical address of a FIFO buffer area, the 2nd FIFO buffer area and the 3rd FIFO buffer area reach the parallel processing of USB interface, enciphering algorithm module, flash controller data stream.Need be when main frame be write flash memory when data, carry out real-time encryptedly, and data encrypted is write in the memory block of flash memory; When data need be read or use, will call corresponding decipherment algorithm module according to configuration the data that needs read will be carried out real time decrypting, send host side then to and use.
Because the technique scheme utilization, the present invention compared with prior art has following advantage and effect:
1, the present invention has overcome technological deficiencies such as data encrypting and deciphering speed is slow between existing main frame and the USB flash disk, the data encryption mode is simple, cryptographic means is limited.What particularly the present invention utilized second control bit and the 3rd control bit in the fifo controller in real-time encrypted U disk alternately enables to switch USB interface, the logical address of enciphering algorithm module and flash controller, with a FIFO buffer area, mapping relations between the physical address of the 2nd FIFO buffer area and the 3rd FIFO buffer area, make a FIFO buffer area, the 2nd FIFO buffer area and the 3rd FIFO buffer area are followed USB interface in turn, enciphering algorithm module and flash controller concurrent working, Data transmission batch between main frame and flash memory, thus the encryption/decryption speed of data improved.
2, the present invention can also set up the twice safety curtain when guaranteeing data encrypting and deciphering speed, and one is because the operating system of flash memory is also encrypted, and the person can think that USB flash disk is a blank panel by mistake to obtain the real-time encrypted U disk, and the information of depositing in can be hidden; Its two, even illegally obtain real-time encrypted U disk, if there is not key also can't read clear data in the USB flash disk.
3, can carry out communication with external unit owing to real-time encrypted U disk of the present invention has increased communication I/O module, and then, strengthen the confidentiality of data message for the safe handling mode of real-time encrypted U disk provides multiple possibility.
Embodiment
Below in conjunction with drawings and Examples the present invention is further described:
Embodiment: a kind of real-time encrypted U disk
When main frame 20 writes data to real-time encrypted U disk 10 are ciphering process, are decrypting processes from real-time encrypted U disk 10 sense datas.Concrete encryption and decryption process fully can be according to requirement of actual application, by being kept at the firmware in the internal storage 103 or being controlled by external communications equipment 30.
Fig. 1 is the system principle block scheme of real-time encrypted U disk of the present invention.As can be seen from Figure 1, real-time encrypted U disk of the present invention is made up of usb 1 06, flash controller 107, enciphering algorithm module 102, internal storage 103, CPU 104, FIFO buffer, fifo controller 101 and communication I/O module 105, and CPU 104 is connected by bus with enciphering algorithm module 102, fifo controller 101, internal storage 103, FIFO buffer, usb 1 06, flash controller 107 and communication I/O module 105 respectively.Wherein:
Usb 1 06 is used to connect main frame 20, realizes writing data from main frame 20 sense datas or to main frame 20.Usb 1 06 relative main frame 20 can be selected USB1.1 interface or USB2.0 interface for from establishing, but adopts the USB2.0 interface better in order to adapt to high-speed encryption and decryption.
Flash controller 107 is used to control the interface signal of flash memory 108, realizes writing data from flash memory 108 sense datas or to flash memory 108.
Enciphering algorithm module 102 is used to encrypt the encrypt data that the original text data of reading from main frame 20 and deciphering are read from flash memory 108.This part content can adopt prior art, and in present embodiment, enciphering algorithm module 102 comprises:
1) algoritic module group.This algoritic module group is made up of at least a algoritic module, and each algoritic module is used for data are carried out the encryption and decryption computing of algorithms of different, and wherein algorithm can comprise RSA, DES, 3DES, SHA etc. or self-defining code encoding/decoding mode.
2) control/status register group.This control/status register group is made up of control register and status register, and status register is used to reflect the status information of enciphering algorithm module 102; Control register is used to define following content:
Which kind of algoritic module A, definition select carry out the encryption and decryption computing;
B, definition encryption and decryption data amount;
C, interrupt configuration is set;
D, definition starting algorithm module are encrypted and are separated enabling of computing.
3) algoritic module controller.This algoritic module controller is used to control the encryption and decryption process and the control data read-write operation of selected algoritic module, after finishing data encrypting and deciphering, sends look-at-me to interruptable controller.Described algoritic module controller is connected with control/the status register group is two-way with the algoritic module group respectively, and control/status register group is with system bus or peripheral bus is two-way is connected.
Internal storage 103 is used to store the firmware or the start boot (BootLoader) of described real-time encrypted U disk 10.
CPU 105 is used to carry out the firmware that is stored on the internal storage 103 as embedded central processing unit or carries out from the instruction of communication I/O module 105 inputs, finishes control and management to real-time encrypted U disk 10.
The FIFO buffer is that corresponding usb 1 06, flash controller 107 and enciphering algorithm module 102 set data-carrier stores are used to store data, and FIFO is the data-carrier store from a fixed address read-write.The FIFO buffer has a FIFO buffer area 109, the 2nd FIFO buffer area 110 and the 3rd FIFO buffer area 111 among the present invention.When real-time encrypted U disk 10 initialization, the logical address of usb 1 06 is distributed to a FIFO buffer area 109, the logical address of enciphering algorithm module 102 is distributed to the 2nd FIFO buffer area 110, and the logical address of flash controller 107 is distributed to the 3rd FIFO buffer area 111.
Fifo controller 101 is used to manage usb 1 06, flash controller 107 and enciphering algorithm module 102 pairing FIFO buffers, be a FIFO buffer area 109, the 2nd FIFO buffer area 110 and the 3rd FIFO buffer area 111 in the FIFO buffer, finish the transfer of data.Fifo controller 101 is made of register, referring to shown in Figure 2, this register is provided with three control bits, wherein, after enabling, first control bit 201 make the logical address of usb 1 06 and the logical address of flash controller 107 exchange, make the logical address of usb 1 06 and the logical address of enciphering algorithm module 102 exchange after second control bit 202 enables, make the logical address of flash controller 107 and the logical address of enciphering algorithm module 102 exchange after the 3rd control bit 203 enables.First control bit 201 is used for transparent operation between main frame 20 and the flash memory 108, promptly enable data flow operations between first control bit, 201 aft engines 20 and the flash memory 108 without encrypting or deciphering, the but directly data in the main frame 20 are write flash memory 108, or direct sense data from flash memory 108.This control bit generally uses under the situation that data are encrypted not needing.Need use second control bit 202 and the 3rd control bit 203 when the data of transmission are encrypted or deciphered between need be to main frame 20 and flash memory 108.
Communication I/O module 107 is used for the communication with external communications equipment 30, realizes obtaining instruction or data download from external communications equipment 30.
The high-speed encryption and decryption method of present embodiment real-time encrypted U disk is: carry out in write operation or the read operation process to flash memory 108 at main frame 20, that utilizes second control bit 202 and the 3rd control bit 203 in the fifo controller 101 alternately enables to switch usb 1 06, the logical address of enciphering algorithm module 102 and flash controller 107, with a FIFO buffer area 109, mapping relations between the physical address of the 2nd FIFO buffer area 110 and the 3rd FIFO buffer area 111, make a FIFO buffer area 109, the 2nd FIFO buffer area 110 and the 3rd FIFO buffer area 111 are followed usb 1 06 in turn, enciphering algorithm module 102 and flash controller 107 concurrent workings, Data transmission batch between main frame 20 and flash memory 108, wherein, alternately the enabling since second control bit 202 of described second control bit 202 and the 3rd control bit 203 during write operation, described second control bit 202 and the 3rd control bit 203 alternately enables since the 3rd control bit 203 during read operation.
A FIFO buffer area 109, the 2nd FIFO buffer area 110 and the 3rd FIFO buffer area 111 were followed usb 1 06, enciphering algorithm module 102 and flash controller 107 concurrent working synoptic diagram in turn when Fig. 3 and Fig. 4 provided data stream respectively and write and read.To be described respectively Fig. 3 and Fig. 4 below:
As shown in Figure 3, when real-time encrypted U disk 10 initialization, the one FIFO buffer area 109 points to the logical address of usb 1 06, and the 2nd FIFO buffer area 110 points to the logical address of enciphering algorithm module 102, and the 3rd FIFO buffer area 111 points to the logical address of flash controller 107.The one FIFO buffer area 109, the 2nd FIFO buffer area 110 and the 3rd FIFO buffer area 111 all are empty (using " blank " expression among the figure respectively).
When main frame 20 carries out work according to the following steps when real-time encrypted U disk 10 carries out write operation:
Step 1: main frame 20 is imported first original text data (a FIFO buffer area 109 is become " filling oblique line " among the figure by " blank ") by usb 1 06 to a FIFO buffer area 109; Enciphering algorithm module 102 inoperation, the 2nd FIFO buffer area 110 are empty (representing with " blank " among the figure); Flash controller 107 inoperation, the 3rd FIFO buffer area 111 are empty (representing with " blank " among the figure).
Step 2: second control bit 202 enables, make the logical address of usb 1 06 and the logical address of enciphering algorithm module 102 exchange, at this moment, the one FIFO buffer area 109 points to enciphering algorithm module 102, the 2nd FIFO buffer area 110 points to usb 1 06, to the 2nd FIFO buffer area 110 input second batch of original text data (the 2nd FIFO buffer area 110 is become " filling oblique line " among the figure by " blank "), encrypt and obtain first encrypt data (a FIFO buffer area 109 becomes " filling black " by " filling oblique line " among the figure) simultaneously by first original text data in 102 pairs the one FIFO buffer areas 109 of enciphering algorithm module by usb 1 06 for main frame 20 then.Flash controller 107 inoperation, the 3rd FIFO buffer area 111 are empty (representing with " blank " among the figure).
Step 3: the 3rd control bit 203 enables earlier, make the logical address of flash controller 107 and the logical address of enciphering algorithm module 102 exchange, then second control bit 202 enables again, make the logical address of usb 1 06 and the logical address of enciphering algorithm module 102 exchange, at this moment, the one FIFO buffer area 109 points to flash controller 107, the 2nd FIFO buffer area 110 points to enciphering algorithm module 102, the 3rd FIFO buffer area 111 points to usb 1 06, main frame 20 is imported the 3rd batch of original text data (the 3rd FIFO buffer area 111 is become " filling oblique line " among the figure by " blank ") by usb 1 06 to the 3rd FIFO buffer area 111 then, second batch of original text data in 102 pairs the 2nd FIFO buffer areas 110 of enciphering algorithm module are encrypted and are obtained second batch of encrypt data (the 2nd FIFO buffer area 110 becomes " filling black " by " filling oblique line " among the figure), and a FIFO buffer area 109 is exported first encrypt datas (a FIFO buffer area 109 becomes " blank " by " filling black " among the figure) by flash controller 107 to flash memory 108 simultaneously.
Step 4: the 3rd control bit 203 enables earlier, make the logical address of flash controller 107 and the logical address of enciphering algorithm module 102 exchange, then second control bit 202 enables again, make the logical address of usb 1 06 and the logical address of enciphering algorithm module 102 exchange, at this moment, the one FIFO buffer area 109 points to usb 1 06, the 2nd FIFO buffer area 110 points to flash controller 107, the 3rd FIFO buffer area 111 points to enciphering algorithm module 102, main frame 20 is imported the 4th batch of original text data (a FIFO buffer area 109 is become " filling oblique line " among the figure by " blank ") by usb 1 06 to a FIFO buffer area 109 then, the 3rd batch of original text data in 102 pairs the 3rd FIFO buffer areas 111 of enciphering algorithm module are encrypted and are obtained the 3rd batch of encrypt data (the 3rd FIFO buffer area 111 becomes " filling black " by " filling oblique line " among the figure), and the 2nd FIFO buffer area 110 is exported second batch of encrypt data (the 2nd FIFO buffer area 110 becomes " blank " by " filling black " among the figure) by flash controller 107 to flash memory 108 simultaneously.
Step 5: the 3rd control bit 203 enables earlier, make the logical address of flash controller 107 and the logical address of enciphering algorithm module 102 exchange, then second control bit 202 enables again, make the logical address of usb 1 06 and the logical address of enciphering algorithm module 102 exchange, at this moment, the one FIFO buffer area 109 points to enciphering algorithm module 102, the 2nd FIFO buffer area 110 points to usb 1 06, the 3rd FIFO buffer area 111 points to flash controller 107, main frame 20 is imported the 5th batch of original text data (the 2nd FIFO buffer area 110 is become " filling oblique line " among the figure by " blank ") by usb 1 06 to the 2nd FIFO buffer area 110 then, the 4th batch of original text data in 102 pairs the one FIFO buffer areas 109 of enciphering algorithm module are encrypted and are obtained the 4th batch of encrypt data (a FIFO buffer area 109 becomes " filling black " by " filling oblique line " among the figure), and the 3rd FIFO buffer area 111 is exported the 3rd batch of encrypt datas (the 3rd FIFO buffer area 111 becomes " blank " by " filling black " among the figure) by flash controller 107 to flash memory 108 simultaneously; Turn back to step 3 then, constitute circulation, till the to the last a collection of encrypt data output with this.
As shown in Figure 4, when real-time encrypted U disk 10 initialization, the one FIFO buffer area 109 points to the logical address of usb 1 06, and the 2nd FIFO buffer area 110 points to the logical address of enciphering algorithm module 102, and the 3rd FIFO buffer area 111 points to the logical address of flash controller 107.The one FIFO buffer area 109, the 2nd FIFO buffer area 110 and the 3rd FIFO buffer area 111 all are empty (using " blank " expression among the figure respectively).
When main frame 20 carries out work according to the following steps when real-time encrypted U disk 10 carries out read operation:
Step 1: flash memory 108 is imported first encrypt datas (the 3rd FIFO buffer area 111 is become " filling black " among the figure by " blank ") by flash controller 107 to the 3rd FIFO buffer area 111; Enciphering algorithm module 102 inoperation, the 2nd FIFO buffer area 110 are empty (representing with " blank " among the figure); Usb 1 06 inoperation, a FIFO buffer area 109 are empty (representing with " blank " among the figure).
Step 2: the 3rd control bit 203 enables, make the logical address of flash controller 107 and the logical address of enciphering algorithm module 102 exchange, at this moment, the 2nd FIFO buffer area 110 points to flash controller 107, the 3rd FIFO buffer area 111 points to enciphering algorithm module 102, to the 2nd FIFO buffer area 110 input second batch of encrypt data (the 2nd FIFO buffer area 110 is become " filling black " among the figure by " blank "), first encrypt data in 102 pairs the 3rd FIFO buffer areas 111 of enciphering algorithm module is decrypted and obtains first original text data (the 3rd FIFO buffer area 111 becomes " filling oblique line " by " filling black " among the figure) flash memory 108 simultaneously by flash controller 107 then.Usb 1 06 inoperation, a FIFO buffer area 109 are empty (representing with " blank " among the figure).
Step 3: second control bit 202 enables earlier, make the logical address of usb 1 06 and the logical address of enciphering algorithm module 102 exchange, then the 3rd control bit 203 enables again, make the logical address of flash controller 107 and the logical address of enciphering algorithm module 102 exchange, at this moment, the one FIFO buffer area 109 points to flash controller 107, the 2nd FIFO buffer area 110 points to enciphering algorithm module 102, the 3rd FIFO buffer area 111 points to usb 1 06, flash memory 108 is imported the 3rd batch of encrypt datas (a FIFO buffer area 109 is become " filling black " among the figure by " blank ") by flash controller 107 to a FIFO buffer area 109 then, second batch of encrypt data in 102 pairs the 2nd FIFO buffer areas 110 of enciphering algorithm module is decrypted and obtains second batch of original text data (the 2nd FIFO buffer area 110 becomes " filling oblique line " by " filling black " among the figure), and the 3rd FIFO buffer area 111 is exported first original text data (the 3rd FIFO buffer area 111 becomes " blank " by " filling oblique line " among the figure) by usb 1 06 to main frame 20 simultaneously.
Step 4: second control bit 202 enables earlier, make the logical address of usb 1 06 and the logical address of enciphering algorithm module 102 exchange, then the 3rd control bit 203 enables again, make the logical address of flash controller 107 and the logical address of enciphering algorithm module 102 exchange, the one FIFO buffer area 109 points to enciphering algorithm module 102, the 2nd FIFO buffer area 110 points to usb 1 06, the 3rd FIFO buffer area 111 points to flash controller 107, flash memory 108 is imported the 4th batch of encrypt datas (the 3rd FIFO buffer area 111 is become " filling black " among the figure by " blank ") by flash controller 107 to the 3rd FIFO buffer area 111 then, the 3rd batch of encrypt data in 102 pairs the one FIFO buffer areas 109 of enciphering algorithm module is decrypted and obtains the 3rd batch of original text data (a FIFO buffer area 109 becomes " filling oblique line " by " filling black " among the figure), and the 2nd FIFO buffer area 110 is exported second batch of original text data (the 2nd FIFO buffer area 110 becomes " blank " by " filling oblique line " among the figure) by usb 1 06 to main frame 20 simultaneously.
Step 5: second control bit 202 enables earlier, make the logical address of usb 1 06 and the logical address of enciphering algorithm module 102 exchange, then the 3rd control bit 203 enables again, make the logical address of flash controller 107 and the logical address of enciphering algorithm module 102 exchange, at this moment, the one FIFO buffer area 109 points to usb 1 06, the 2nd FIFO buffer area 110 points to flash controller 107, the 3rd FIFO buffer area 111 points to enciphering algorithm module 102, flash memory 108 is imported the 5th batch of encrypt datas (the 2nd FIFO buffer area 110 is become " filling black " among the figure by " blank ") by flash controller 107 to the 2nd FIFO buffer area 110 then, the 4th batch of encrypt data in 102 pairs the 3rd FIFO buffer areas 111 of enciphering algorithm module is decrypted and obtains the 4th batch of original text data (the 3rd FIFO buffer area 111 becomes " filling oblique line " by " filling black " among the figure), and a FIFO buffer area 109 is exported the 3rd batch of original text data (a FIFO buffer area 109 becomes " blank " by " filling oblique line " among the figure) by usb 1 06 to main frame 20 simultaneously; Turn back to step 3 then, constitute circulation, till the to the last a collection of original text data output with this.
The foregoing description only is explanation technical conceive of the present invention and characteristics, and its purpose is to allow the personage who is familiar with this technology can understand content of the present invention and enforcement according to this, can not limit protection scope of the present invention with this.All equivalences that spirit is done according to the present invention change or modify, and all should be encompassed within protection scope of the present invention.