CN104504322B - To USB Key checkings, the method for reading, encrypting, decrypting - Google Patents

To USB Key checkings, the method for reading, encrypting, decrypting Download PDF

Info

Publication number
CN104504322B
CN104504322B CN201410738670.3A CN201410738670A CN104504322B CN 104504322 B CN104504322 B CN 104504322B CN 201410738670 A CN201410738670 A CN 201410738670A CN 104504322 B CN104504322 B CN 104504322B
Authority
CN
China
Prior art keywords
key
data
field
trivium
algorithms
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410738670.3A
Other languages
Chinese (zh)
Other versions
CN104504322A (en
Inventor
王思叶
张诗永
朱大立
陈恭亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Information Engineering of CAS
Original Assignee
Institute of Information Engineering of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Information Engineering of CAS filed Critical Institute of Information Engineering of CAS
Priority to CN201410738670.3A priority Critical patent/CN104504322B/en
Publication of CN104504322A publication Critical patent/CN104504322A/en
Application granted granted Critical
Publication of CN104504322B publication Critical patent/CN104504322B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • G06F21/34User authentication involving the use of external additional devices, e.g. dongles or smart cards

Abstract

The invention provides a kind of to USB Key checkings, the method for reading, encrypting, decrypting, wherein, the method for USB Key checkings is included:Obtain the preset instructions information that user is inputted in the command information and USB Key of computer;Compare command information and preset instructions information, when command information is identical with preset instructions information, read the data of identity field and USB Key sequence number in the USB Key being connected with computer;According to the data and sequence number of identity field, the first key of construction Trivium algorithms, using the data of the output field in the first key acquisition Trivium algorithms;Compare the data of output field and the data of identity field, in the data of output field and the identical data of identity field, then authentication passes through.By provided by the invention a kind of to USB Key checkings, the method for reading, encrypting, decrypting, USB Key security can effectively be ensured, while can ensure that the content inside USB Key is not tampered with not being forged with the content inside USB Key by Trivium algorithms.

Description

To USB Key checkings, the method for reading, encrypting, decrypting
Technical field
The present invention relates to the technical field of the encryption of data and decryption, more particularly to it is a kind of to USB Key checkings, read, Encryption, the method for decryption.
Background technology
Trivium algorithms are the algorithms of hardware based synchronous stream cipher, are a kind of high security, high efficiency and changeability Stream cipher encrypting algorithm, simple and quick can be realized on hardware.
U-shield (Universal Serial Bus Key, abbreviation USB Key) is one kind of USB interface hardware device, USB It has built-in single-chip microcomputer and intelligent card chip, has certain memory space, and the private key and numeral that can store user are demonstrate,proved Book, the checking of identity is carried out to user using the public key algorithm built in USB Key, because the private key of user is stored in coded lock In, therefore can not be read, the security of subscriber authentication is ensured with this.
It can only import the public and private key pair of certificate and internal generation in most USB Key products in the market, but In the environment of reality, need to import some specific contents in USB Key, such as the session key of oneself, now, to USB The security of content in Key can only can not be protected by hardware mechanisms, while also need to software to protect in USB Key Content can not tamper and unforgeable.
The content of the invention
For in the prior art the defects of, the present invention provide it is a kind of to USB Key checking, read, encryption, decryption side It method, can effectively ensure USB Key security, while the content inside USB Key can be ensured by Trivium algorithms It is not tampered with not being forged with the content inside USB Key.
In a first aspect, the present invention provides a kind of USB Key verification methods, including:
Obtain the preset instructions information that user is inputted in the command information and USB Key of computer;
Compare the command information and the preset instructions information, in the command information and the preset instructions information phase Meanwhile read the data of identity field and the sequence number of the USB Key in the USB Key being connected with the computer;
According to the data of the identity field and the sequence number, the first key of construction Trivium algorithms, using described First key obtains the data of the output field in the Trivium algorithms;
Compare the data of the output field and the data of the identity field, the output field data with it is described When the data of identity field are identical, then authentication passes through.
Further, the data length of the identity field is 20, and the length of the USB Key sequence numbers is 16;
The data according to the identity field and the sequence number, the first key of Trivium algorithms is constructed, used The first key obtains the data of the output field in the Trivium algorithms, including:
Preceding 4 data and 16 bit sequence number in the data of the identity field, using the first formula, construction The first key of 20 of Trivium algorithms, 16 in the Trivium algorithms are obtained using the first keys of described 20 Output field data;
First formula is:
Wherein, uuidiFor preceding 4 data of the data of the identity field, serialNumberi-4For the USB Key The sequence number of 16, key1 is the first key of described 20.
Further, methods described also includes:
Compare the data of 16 of the data and the identity field for removing first 4 of the output field of 16, if 16 The data of output field are with described except the data of 16 of the identity field of first 4 are identical, then authentication is successful, otherwise identity Authentication failed.
Second aspect, the present invention provide a kind of USB Key read methods, including:
Obtain the preset instructions information that user is inputted in the command information and the USB Key of computer;
Compare the command information and the preset instructions information, in the command information and the preset instructions information phase Meanwhile read the first field in the data and the USB Key of the identity field in the USB Key being connected with the computer Data;
According to the data of the identity field and the data of first field, the second key of Trivium algorithms is constructed, The data of first field are decrypted using second key, to obtain the reality of the data of first field Value.
Further, the data length of the identity field is 20, and the data length of first field is more than 4;
It is described according to the data of the identity field and the data of first field, the second of construction Trivium algorithms Key, the data of first field are decrypted using second key, to obtain the data of first field Actual value, including:
According to preceding 4 data of the data of 16 and the data of first field of the identity field except first 4, Using the second formula, second key of 20 of Trivium algorithms is constructed, using second key of described 20, is removed to described The data of first field of first 4 are decrypted, to obtain the actual value of the data of first field for removing first 4;
Second formula is:
Wherein, uuidi-4For the data of 16 of the identity field except first 4, dataiFor the data of first field Preceding 4 data, key2 is second key of described 20.
The third aspect, the present invention provide a kind of USB Key encryption methods, including:
Obtain the preset instructions information that user is inputted in the command information and USB Key of computer;
Compare the command information and the preset instructions information, in the command information and the preset instructions information phase Meanwhile obtain the 3rd key of the computer random generation and read default 4th key in the USB Key;
According to the 3rd key and the 4th key, the 5th key of construction Trivium algorithms, using the described 5th Input data is encrypted key, obtains encryption data.
Further, the length of the 3rd key is 20, and the length of the 4th key is 20;
It is described according to the 3rd key and the 4th key, the 5th key of Trivium algorithms is constructed, using described Input data is encrypted 5th key, and obtaining encryption data includes:
According to the 3rd key and the 4th key of described 20 of described 20, using the XOR of the 3rd formula, structure The 5th key of 20 of Trivium algorithms is made, the input data is encrypted using the 5th key of described 20, with Obtain encryption data;
3rd formula is:
Key5=key3 ⊕ key4
Wherein, key3 is the 3rd key of described 20, and key4 is 20 the 4th keys, and key5 is described 20 5th key.
Further, methods described also includes:
Output array is created, for the 5th key for depositing described 20 and the encryption data;
Wherein, random number of the storage order of the output array for 1 calculating, the 5th key of described 20 and described Encryption data.
Fourth aspect, the present invention provide a kind of USB Key decryption methods, including:
Obtain the preset instructions information that user is inputted in the command information and USB Key of computer;
Compare the command information and the preset instructions information, in the command information and the preset instructions information phase Meanwhile read the 7th key in the USB Key in default 6th key and data to be decrypted;
According to the 6th key and the 7th key, the 8th key of construction Trivium algorithms, using the described 8th The data to be decrypted are decrypted key, obtain ciphertext data.
Further, the length of the 6th key is 20, and the length of the 7th key is 20;
It is described according to the 6th key and the 7th key, the 8th key of Trivium algorithms is constructed, using described The data to be decrypted are decrypted 8th key, obtain ciphertext data, including:
According to the 6th key and the 7th key of described 20 of described 20, using the XOR of the 4th formula, structure The 8th key of 20 of Trivium algorithms is made, the data to be decrypted are decrypted using the 8th key of described 20, Obtain ciphertext data;
4th formula is:
Key8=key6 ⊕ key7
Wherein, key6 is the 6th key of described 20, and key7 is 20 the 7th keys, and key8 is described 20 8th key.
As shown from the above technical solution, by it is provided by the invention it is a kind of to USB Key checking, read, encryption, decryption Method, wherein, the method for USB Key checkings is included:Obtain pre- in the command information and USB Key of user's input computer If command information;Compare the command information and the preset instructions information, believe in the command information and the preset instructions Manner of breathing simultaneously, reads the data of identity field and the sequence of the USB Key in the USB Key being connected with the computer Number;According to the data of the identity field and the sequence number, the first key of construction Trivium algorithms, using described first Key obtains the data of the output field in the Trivium algorithms;Compare the data of the output field and the identity word The data of section, when the data of the output field are identical with the data of the identity field, then authentication passes through.Pass through this A kind of method for being verified to USB Key, reading, encrypt, decrypting provided is provided, can effectively ensure USB Key safety Property, while can ensure that the content inside USB Key is not tampered with the content inside USB Key not by Trivium algorithms It is forged.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below to embodiment or existing The required accompanying drawing used is briefly described in technology description, it should be apparent that, drawings in the following description are only this hair Some bright embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can be with root Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is a kind of method flow schematic diagram to USB Key checkings provided in an embodiment of the present invention;
Fig. 2 is a kind of method flow schematic diagram read to USB Key provided in an embodiment of the present invention;
Fig. 3 is a kind of method flow schematic diagram to USB Key encryptions provided in an embodiment of the present invention;
Fig. 4 is a kind of method flow schematic diagram to USB Key decryption provided in an embodiment of the present invention.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, clear, complete description is carried out to the technical scheme in the embodiment of the present invention, it is clear that described embodiment is only Only it is part of the embodiment of the present invention, rather than whole embodiments.Based on embodiments of the invention, ordinary skill people The every other embodiment that member is obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
" first ", " second " and " the 3rd " etc. is not the order that use to key has priority in the present embodiment Regulation is made, difference simply is made simultaneously to the title of key, while to the first formula, second formula etc., simply to formula Title makes difference, in the present embodiment, does not make any restriction.
Fig. 1 is a kind of method flow schematic diagram to USB Key checkings provided in an embodiment of the present invention, as shown in figure 1, this The method to USB Key checkings of embodiment is as described below.
101st, the preset instructions information that user is inputted in the command information and USB Key of computer is obtained.
It should be understood that when equipment such as USB Key insertion computers, computer can prompt user input instruction information, Now user can input the command information of user to computer, while calculate the default finger for also obtaining and being stored in USB Key Information is made, usual default command information refers to the password of user's input.
102nd, the command information and the preset instructions information, believe in the command information and the preset instructions Manner of breathing simultaneously, reads the data of identity field and the sequence of the USB Key in the USB Key being connected with the computer Number.
It should be understood that the default command information in the command information and USB Key that computer gets user's input When, computer compares command information and default command information, if both differ, directly returns to authentication failed, if both Information it is identical, then perform following operation.
Read with calculating the data of identity field and the sequence number of the USB Key in the USB Key connected, wherein, The data length of identity field is 20, and the length of USB Key sequence number is 16, if the data length of the identity field read Degree is not 20, then authentication failed.
It should be noted that USB Key sequence number is unique, each USB Key sequence number differs, one As in the case of USB Key sequence number be by 16 numeral and letter form.
The data of identity field in USB Key are generally also to be made up of the numeral and letter of 20, and each USB Key In the data of identity field in USB Key be also unique.
103rd, according to the data of the identity field and the sequence number, the first key of Trivium algorithms is constructed, is used The first key obtains the data of the output field in the Trivium algorithms.
It should be understood that by the data of identity field and USB Key sequence number, the first of Trivium algorithms is constructed Key, the composition of first key are made up of this two parts, indispensable between both, while obtain institute using first key State the data of the output field in Trivium algorithms.
It is understood that preceding 4 data and 16 bit sequence numbers in the data of identity field, public using first Formula, construct the first key of 20 of Trivium algorithms.
First formula is:
Wherein, uuidiFor preceding 4 data of the data of identity field, serialNumberi-4For 16 of USB Key Sequence number, key1 are the first key of described 20.
The data of the output field of 16 in Trivium algorithms are obtained using the first keys of 20.
104th, the data of the data of the output field and the identity field, the output field data with When the data of the identity field are identical, then authentication passes through.
It should be understood that compare the data of output field and the data of identity field, in the data and identity of output field When the data of field are identical, then authentication by, if when the data of output field and the data of identity field differ, Authentication fails.
It is understood that the output field of 16 in Trivium algorithms is obtained by using the first key of 20 Data, compare the data of 16 of the data and the identity field except first 4 of the output field of 16, if 16 defeated Go out the data of field with described except the data of 16 of the identity field of first 4 are identical, then authentication success, otherwise identity is tested Card failure.
It can ensure that USB Key are not misused by the method to USB Key checkings of the present embodiment, can ensure The security of data inside USB Key.
Fig. 2 is a kind of method flow schematic diagram read to USB Key provided in an embodiment of the present invention, as shown in Fig. 2 this The method that the USB Key of embodiment are read is as described below.
201st, the preset instructions information that user is inputted in the command information and the USB Key of computer is obtained.
It should be understood that when equipment such as USB Key insertion computers, computer can prompt user input instruction information, Now user can input the command information of user to computer, while calculate the default finger for also obtaining and being stored in USB Key Information is made, usual default command information refers to the password of user's input.
202nd, the command information and the preset instructions information, believe in the command information and the preset instructions Manner of breathing simultaneously, reads first in the data and the USB Key of the identity field in the USB Key being connected with the computer The data of field.
It should be understood that the default command information in the command information and USB Key that computer gets user's input When, computer compares command information and default command information, if both differ, directly returns to authentication failed, if both Information it is identical, then perform following operation.
Identity field in the USB Key that reading is connected with computer, the identity information of identity field label user, It, is made up of the numeral and letter of 20, while reads the data of the first field in USB Key, the data of the first field Length is the data composition more than 4, if the length of the data of the identity field obtained is not 20, authentication failed, is read simultaneously When the length of the data of the first field taken is less than 4, then verifies and also fail.
The data of first field are for specific information in USB Key, are masked as different information compositions, show user Characteristic information, such as the ID card No. of user, contact method etc..
203rd, according to the data of the identity field and the data of first field, the second of Trivium algorithms is constructed Key, the data of first field are decrypted using second key, to obtain the data of first field Actual value.
It is it should be understood that close according to the data of identity field and the data of the first field, the second of construction Trivium algorithms Key, the data of the first field are decrypted using the second key, to obtain the actual value of the data of the first field.
Simultaneously it is understood that the number of the data and first field according to 16 of the identity field except first 4 According to preceding 4 data, using the second formula, construct second key of 20 of Trivium algorithms, using described 20 second Key, the data of the first field except first 4 are decrypted, to obtain the actual value of the data of the first field except first 4;
Second formula is:
Wherein, uuidi-4For the data of 16 of the identity field except first 4, dataiFor before the data of the first field 4 Position data, key2 are second key of 20.
By it is provided by the invention to USB KEY read method, can ensure the data in USB KEY be not tampered with and Forge, ensure the security of data.
Fig. 3 is a kind of method flow schematic diagram to USB Key encryptions provided in an embodiment of the present invention, as shown in figure 3, this The method of the USB Key encryptions of embodiment is as described below.
301st, the preset instructions information that user is inputted in the command information and USB Key of computer is obtained.
It should be understood that when equipment such as USB Key insertion computers, computer can prompt user input instruction information, Now user can input the command information of user to computer, while calculate the default finger for also obtaining and being stored in USB Key Information is made, usual default command information refers to the password of user's input.
302nd, the command information and the preset instructions information, believe in the command information and the preset instructions Manner of breathing simultaneously, obtains the 3rd key of the computer random generation and reads default 4th key in the USB Key.
It should be understood that the default command information in the command information and USB Key that computer gets user's input When, computer compares command information and default command information, if both differ, directly returns to authentication failed, if both Information it is identical, then perform following operation.
The 3rd key of computer random generation is obtained, the 3rd key is generated by computer random, while the 3rd is close The length of key is 20, i.e., the 3rd key of 20 is generated by computer random.
Default 4th key in USB Key is read, the 4th key pre-sets the intelligent core being stored in USB Key In piece card, the length of the 4th key is 20.
If the length of the 3rd key generated at random is not the failed encryption for 20, meanwhile, if reading in USB Key Smart chip card in the 4th key length be 20 when, then encrypt and also fail.
303rd, according to the 3rd key and the 4th key, the 5th key of construction Trivium algorithms, using described Input data is encrypted 5th key, obtains encryption data.
It should be understood that according to the 3rd key and the 4th key, the 5th key of construction Trivium algorithms, using the 5th Input data is encrypted key, obtains encryption data.
It is understood that according to the 3rd key and the 4th key of 20 of 20, transported using the XOR of the 3rd formula Calculate, construct the 5th key of 20 of Trivium algorithms, input data is encrypted using the 5th key of 20, to obtain Obtain encryption data;
3rd formula is:
Key5=key3 ⊕ key4
Wherein, key3 is the 3rd key of 20, and key4 is 20 the 4th keys, and key5 is the 5th key of 20.
After the data of encryption are obtained, output array is created, for depositing the 5th key and the encryption data of 20;
Wherein, the storage order for exporting array is random number, the 5th key of 20 and the encryption data of 1 calculating.
By the method to USB Key encryptions of the present embodiment, it can effectively ensure the security of data transfer, ensure Data are not tampered with and forged.
Fig. 4 is a kind of method flow schematic diagram to USB Key decryption provided in an embodiment of the present invention, as shown in figure 4, this The method of the USB Key decryption of embodiment is as described below.
401st, the preset instructions information that user is inputted in the command information and USB Key of computer is obtained.
It should be understood that when equipment such as USB Key insertion computers, computer can prompt user input instruction information, Now user can input the command information of user to computer, while calculate the default finger for also obtaining and being stored in USB Key Information is made, usual default command information refers to the password of user's input.
402nd, the command information and the preset instructions information, believe in the command information and the preset instructions Manner of breathing simultaneously, reads the 7th key in default 6th key and data to be decrypted in the USB Key.
It should be understood that the default command information in the command information and USB Key that computer gets user's input When, computer compares command information and default command information, if both differ, directly returns to authentication failed, if both Information it is identical, then perform following operation.
Default 6th key in USB Key is read, the 6th key pre-sets the intelligent core being stored in USB Key In piece card, the length of the 6th key is 20.
The 7th key in data to be decrypted is obtained, the 7th key is stored in data to be decrypted in advance, wherein, the 7th The length of key is 20.
If the length for reading the 6th key in the smart chip card in USB Key is not 20, decryption failure;Together When the length of the 7th key that is read in data to be decrypted when not being 20, then decrypt and also fail.
403rd, according to the 6th key and the 7th key, the 8th key of construction Trivium algorithms, using described The data to be decrypted are decrypted 8th key, obtain ciphertext data.
It should be understood that according to the 6th key and the 7th key, the 8th key of construction Trivium algorithms, using the 8th Key is treated ciphertext data and is decrypted, and obtains ciphertext data.
It is understood that according to the 6th key and the 7th key of 20 of 20, transported using the XOR of the 4th formula Calculate, construct the 8th key of 20 of Trivium algorithms, ciphertext data is treated using the 8th key of 20 and is decrypted, is obtained Obtain ciphertext data;
4th formula is:
Key8=key6 ⊕ key7
Wherein, key6 states the 6th key of 20, and key7 is 20 the 7th keys, and key8 is the 8th key of 20.
For example, the length of data to be decrypted is more than 21, then the data of the 22nd is started to decrypt, above 21 data are 1 random number and the 7th key of 20, and its data is decrypted by the 8th key, obtains the number of decryption According to.
The method to USB Key decryption provided by this implementation can effectively ensure that the security and data of data Integrality.
One of ordinary skill in the art will appreciate that:Realizing all or part of step of above method embodiment can lead to The related hardware of programmed instruction is crossed to complete, foregoing program can be stored in computer-readable storage medium, the journey Sequence upon execution, execution the step of including above method embodiment;And foregoing storage medium includes:ROM, RAM, magnetic disc or CD etc. is various can be with the medium of store program codes.
The foregoing is only a specific embodiment of the invention, and still, protection scope of the present invention is not limited to this, appoints What those familiar with the art the invention discloses technical scope in, the change that can be readily occurred in or replacement, all It should be included within the scope of the present invention.Therefore, protection scope of the present invention should be with the scope of the claims It is defined.

Claims (5)

  1. A kind of 1. USB Key verification methods, it is characterised in that including:
    Obtain the preset instructions information that user is inputted in the command information and USB Key of computer;
    Compare the command information and the preset instructions information, it is identical with the preset instructions information in the command information When, read the data of identity field and the sequence number of the USB Key in the USB Key being connected with the computer;
    According to the data of the identity field and the sequence number, the first key of construction Trivium algorithms, using described first Key obtains the data of the output field in the Trivium algorithms;
    Compare the data of the output field and the data of the identity field, in data and the identity of the output field When the data of field are identical, then authentication passes through;
    The data length of the identity field is 20, and the length of the USB Key sequence numbers is 16;
    The data according to the identity field and the sequence number, the first key of Trivium algorithms is constructed, using described First key obtains the data of the output field in the Trivium algorithms, including:
    Preceding 4 data and 16 bit sequence number in the data of the identity field, using the first formula, construction The first key of 20 of Trivium algorithms, 16 in the Trivium algorithms are obtained using the first keys of described 20 Output field data;
    First formula is:
    <mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <mi>k</mi> <mi>e</mi> <mi>y</mi> <msub> <mn>1</mn> <mi>i</mi> </msub> <mo>=</mo> <mi>u</mi> <mi>u</mi> <mi>i</mi> <msub> <mi>d</mi> <mi>i</mi> </msub> <mo>,</mo> <mn>0</mn> <mo>&amp;le;</mo> <mi>i</mi> <mo>&lt;</mo> <mn>4</mn> </mtd> </mtr> <mtr> <mtd> <mi>k</mi> <mi>e</mi> <mi>y</mi> <msub> <mn>1</mn> <mi>i</mi> </msub> <mo>=</mo> <mi>s</mi> <mi>e</mi> <mi>r</mi> <mi>i</mi> <mi>a</mi> <mi>l</mi> <mi>N</mi> <mi>u</mi> <mi>m</mi> <mi>b</mi> <mi>e</mi> <msub> <mi>r</mi> <mrow> <mi>r</mi> <mo>-</mo> <mn>4</mn> </mrow> </msub> <mo>,</mo> <mn>20</mn> <mo>&gt;</mo> <mi>i</mi> <mo>&amp;GreaterEqual;</mo> <mn>4</mn> </mtd> </mtr> </mtable> </mfenced>
    Wherein, uuidiFor preceding 4 data of the data of the identity field, serialNumberi-4For the 16 of the USB Key The sequence number of position, key1 are the first key of described 20;
    Compare the data of 16 of the data and the identity field for removing first 4 of the output field of 16, if the output of 16 The data of field are with described except the data of 16 of the identity field of first 4 are identical, then authentication is successful, otherwise authentication Failure.
  2. A kind of 2. USB Key read methods, it is characterised in that including:
    Obtain the preset instructions information that user is inputted in the command information and the USB Key of computer;
    Compare the command information and the preset instructions information, it is identical with the preset instructions information in the command information When, read the data of identity field in the USB Key that are connected with the computer and the first field in the USB Key Data;
    According to the data of the identity field and the data of first field, the second key of Trivium algorithms is constructed, is used The data of first field are decrypted second key, to obtain the actual value of the data of first field;
    The data length of the identity field is 20, and the data length of first field is more than 4;
    It is described to construct the second key of Trivium algorithms according to the data of the identity field and the data of first field, The data of first field are decrypted using second key, to obtain the reality of the data of first field Value, including:
    According to preceding 4 data of the data of 16 and the data of first field of the identity field for removing first 4, use Second formula, second key of 20 of Trivium algorithms is constructed, using second key of described 20, first 4 are removed to described The data of the first field be decrypted, to obtain the actual value of the data of first field except first 4;
    Second formula is:
    <mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <mi>k</mi> <mi>e</mi> <mi>y</mi> <msub> <mn>2</mn> <mi>i</mi> </msub> <mo>=</mo> <mi>d</mi> <mi>a</mi> <mi>t</mi> <msub> <mi>a</mi> <mi>i</mi> </msub> <mo>,</mo> <mn>0</mn> <mo>&amp;le;</mo> <mi>i</mi> <mo>&lt;</mo> <mn>4</mn> </mtd> </mtr> <mtr> <mtd> <mi>k</mi> <mi>e</mi> <mi>y</mi> <msub> <mn>2</mn> <mi>i</mi> </msub> <mo>=</mo> <mi>u</mi> <mi>u</mi> <mi>i</mi> <msub> <mi>d</mi> <mrow> <mi>i</mi> <mo>-</mo> <mn>4</mn> </mrow> </msub> <mo>,</mo> <mn>20</mn> <mo>&gt;</mo> <mi>i</mi> <mo>&amp;GreaterEqual;</mo> <mn>4</mn> </mtd> </mtr> </mtable> </mfenced>
    Wherein, uuidi-4For the data of 16 of the identity field except first 4, dataiFor before the data of first field 4 Position data, key2 are second key of described 20.
  3. A kind of 3. USB Key encryption methods, it is characterised in that including:
    Obtain the preset instructions information that user is inputted in the command information and USB Key of computer;
    Compare the command information and the preset instructions information, it is identical with the preset instructions information in the command information When, obtain the 3rd key of the computer random generation and read default 4th key in the USB Key;
    According to the 3rd key and the 4th key, the 5th key of construction Trivium algorithms, using the 5th key Input data is encrypted, obtains encryption data;
    The length of 3rd key is 20, and the length of the 4th key is 20;
    It is described according to the 3rd key and the 4th key, the 5th key of Trivium algorithms is constructed, using the described 5th Input data is encrypted key, obtains encryption data, including:
    According to the 3rd key and the 4th key of described 20 of described 20, using the XOR of the 3rd formula, construction 5th key of 20 of Trivium algorithms, the input data is encrypted using the 5th key of described 20, to obtain Obtain encryption data;
    3rd formula is:
    <mrow> <mi>k</mi> <mi>e</mi> <mi>y</mi> <mn>5</mn> <mo>=</mo> <mi>k</mi> <mi>e</mi> <mi>y</mi> <mn>3</mn> <mo>&amp;CirclePlus;</mo> <mi>k</mi> <mi>e</mi> <mi>y</mi> <mn>4</mn> </mrow>
    Wherein, key3 is the 3rd key of described 20, and key4 is 20 the 4th keys, and key5 is the 5 of described 20 Key.
  4. 4. USB Key encryption methods according to claim 3, it is characterised in that methods described also includes:
    Output array is created, for the 5th key for depositing described 20 and the encryption data;
    Wherein, the storage order of the output array is random number, the 5th key of described 20 and the encryption of 1 calculating Data.
  5. A kind of 5. USB Key decryption methods, it is characterised in that including:
    Obtain the preset instructions information that user is inputted in the command information and USB Key of computer;
    Compare the command information and the preset instructions information, it is identical with the preset instructions information in the command information When, read the 7th key in default 6th key and data to be decrypted in the USB Key;
    According to the 6th key and the 7th key, the 8th key of construction Trivium algorithms, using the 8th key The data to be decrypted are decrypted, obtain ciphertext data;
    The length of 6th key is 20, and the length of the 7th key is 20;
    It is described according to the 6th key and the 7th key, the 8th key of Trivium algorithms is constructed, using the described 8th The data to be decrypted are decrypted key, obtain ciphertext data, including:
    According to the 6th key and the 7th key of described 20 of described 20, using the XOR of the 4th formula, construction The data to be decrypted are decrypted, obtained by the 8th key of 20 of Trivium algorithms using the 8th key of described 20 Obtain ciphertext data;
    4th formula is:
    <mrow> <mi>k</mi> <mi>e</mi> <mi>y</mi> <mn>8</mn> <mo>=</mo> <mi>k</mi> <mi>e</mi> <mi>y</mi> <mn>6</mn> <mo>&amp;CirclePlus;</mo> <mi>k</mi> <mi>e</mi> <mi>y</mi> <mn>7</mn> </mrow> 2
    Wherein, key6 is the 6th key of described 20, and key7 is 20 the 7th keys, and key8 is the 8 of described 20 Key.
CN201410738670.3A 2014-12-05 2014-12-05 To USB Key checkings, the method for reading, encrypting, decrypting Active CN104504322B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410738670.3A CN104504322B (en) 2014-12-05 2014-12-05 To USB Key checkings, the method for reading, encrypting, decrypting

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410738670.3A CN104504322B (en) 2014-12-05 2014-12-05 To USB Key checkings, the method for reading, encrypting, decrypting

Publications (2)

Publication Number Publication Date
CN104504322A CN104504322A (en) 2015-04-08
CN104504322B true CN104504322B (en) 2017-12-08

Family

ID=52945718

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410738670.3A Active CN104504322B (en) 2014-12-05 2014-12-05 To USB Key checkings, the method for reading, encrypting, decrypting

Country Status (1)

Country Link
CN (1) CN104504322B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1993922A (en) * 2004-07-30 2007-07-04 英特尔公司 Stream cipher combining system and method
CN101304316A (en) * 2008-06-30 2008-11-12 北京飞天诚信科技有限公司 Method for improving identification authentication security based on password card
CN101677399A (en) * 2008-09-18 2010-03-24 香港科技大学 Method and system for encoding multimedia content based on secure coding schemes using stream cipher
CN103546289A (en) * 2013-09-29 2014-01-29 北京握奇智能科技有限公司 USB (universal serial bus) Key based secure data transmission method and system
CN103685277A (en) * 2013-12-17 2014-03-26 南京大学 Safety protection system and method for webpage access through browser

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7236592B2 (en) * 2002-02-01 2007-06-26 International Business Machines Corporation Efficient stream cipher system and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1993922A (en) * 2004-07-30 2007-07-04 英特尔公司 Stream cipher combining system and method
CN101304316A (en) * 2008-06-30 2008-11-12 北京飞天诚信科技有限公司 Method for improving identification authentication security based on password card
CN101677399A (en) * 2008-09-18 2010-03-24 香港科技大学 Method and system for encoding multimedia content based on secure coding schemes using stream cipher
CN103546289A (en) * 2013-09-29 2014-01-29 北京握奇智能科技有限公司 USB (universal serial bus) Key based secure data transmission method and system
CN103685277A (en) * 2013-12-17 2014-03-26 南京大学 Safety protection system and method for webpage access through browser

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
《Trivium 流密码的基于自动推导的差分分析》;丁林,关杰;《电子学报》;20140831;全文 *
security exp-golomb coding using stream ciopher;Jiantao Zhou et al;《ICASSP 2009》;20090424;全文 *
USB安全钥模型的构建与实现;孙万忠等;《计算机工程与设计》;20070930;全文 *
流密码典型分析方法及实例;陈一阳,陈恭亮;《信息安全与通信保密》;20100630;全文 *

Also Published As

Publication number Publication date
CN104504322A (en) 2015-04-08

Similar Documents

Publication Publication Date Title
US20200106600A1 (en) Progressive key encryption algorithm
CN101483654A (en) Method and system for implementing authentication and data safe transmission
CN103067170B (en) encrypting method based on EXT2 file system
CN104408356B (en) A kind of fingerprint verification method and system, fingerprint template encryption device
CN103618705A (en) Personal code managing tool and method under open cloud platform
JP2003134110A (en) Cryptographic communication equipment
CN106533663B (en) Data ciphering method, encryption method, apparatus and data decryption method, decryption method, apparatus
CN103326864A (en) Electronic tag anti-fake authentication method
CN112615824B (en) Anti-leakage one-time pad communication method and device
CN106100851B (en) Password management system, intelligent wristwatch and its cipher management method
CN108199847A (en) Security processing method, computer equipment and storage medium
CN109903052A (en) A kind of block chain endorsement method and mobile device
JPH10224345A (en) Cipher key authentication method for chip card and certificate
CN201590091U (en) Encryption type memory card read/write device based on password authentication
CN104333452A (en) Multi-account encryption method for file data
CN200993803Y (en) Internet banking system safety terminal
CN105516182B (en) A kind of mutual authentication method and its system between smart card and reader
CN110532791A (en) A kind of encryption and decryption method and system for movable storage medium
CN104504322B (en) To USB Key checkings, the method for reading, encrypting, decrypting
KR101327193B1 (en) A user-access trackable security method for removable storage media
CN115455497A (en) Computer hard disk data encryption system and method
CN111815821B (en) IC card security algorithm applied to intelligent door lock
CN104580255B (en) Authentication method and system of the identification equipment based on recognizable code stream to terminal device
CN114244509A (en) Method for carrying out SM2 one-time pad bidirectional authentication unlocking by using mobile terminal
CN209149308U (en) Key based on hardware device generates and verifying system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant