CN104318461B - Anti-counterfeiting code generation and verification method based on cipher machine and USBKey - Google Patents

Anti-counterfeiting code generation and verification method based on cipher machine and USBKey Download PDF

Info

Publication number
CN104318461B
CN104318461B CN201410564708.XA CN201410564708A CN104318461B CN 104318461 B CN104318461 B CN 104318461B CN 201410564708 A CN201410564708 A CN 201410564708A CN 104318461 B CN104318461 B CN 104318461B
Authority
CN
China
Prior art keywords
invoice
key
usbkey
cipher machine
code
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
CN201410564708.XA
Other languages
Chinese (zh)
Other versions
CN104318461A (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.)
Inspur Software Technology Co Ltd
Original Assignee
Inspur Software Group Co Ltd
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 Inspur Software Group Co Ltd filed Critical Inspur Software Group Co Ltd
Priority to CN201410564708.XA priority Critical patent/CN104318461B/en
Publication of CN104318461A publication Critical patent/CN104318461A/en
Application granted granted Critical
Publication of CN104318461B publication Critical patent/CN104318461B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention provides an anti-counterfeiting code generation and verification method based on a cipher machine and a USBKey, which is used for generating a specific anti-counterfeiting code according to the calculation of parameters such as tax number, amount, code, invoice number, invoicing date and the like of an invoice and supporting the verification method. The USBKey data verification is synchronously provided, the problem of low timeliness of the USBKey is solved, one ticket and one code are more effectively, more safely and more timely achieved, a cipher machine is used, an algorithm supporting SM1/SM2/SM3/SM4/3DES/SSF33 encryption is provided, anti-counterfeiting codes with national standard rules are generated according to identification numbers of taxpayers of invoicing parties, invoicing amount, invoice codes, invoice numbers and invoice information of invoicing dates, hidden dangers of network safety are guaranteed, and the timeliness problem cannot be solved under the condition that keys infused by the USBKey are different from any group of keys of the encryption machine.

Description

A kind of security code generation and verification method based on cipher machine and USBKey
Technical field
The present invention relates to Computer Applied Technology field, the security code generation specifically based on cipher machine and USBKey With verification method, effective invoice identification and true or false checking are provided for existing network invoice, electronic invoice field.
Background technology
Managing bill system reaches its maturity, and the theory of controlling taxation by bills obtains extensive common recognition.Thus true from false of bills is verified It is more important, more it is necessary Strengthens network safety and checking means.
Internet is relied in the use of invoice and electronic invoice, network has very unstable peace in practical application Full problem, once leakage occur in data, consequence is hardly imaginable.
USBKey is tried out mainly as checking identity, data storage two ways at present, in invoice and electronic invoice Using when, exist ageing not high, there are certain intervals, it is impossible to situations such as meeting actually used in time.
Security code generation and verification method based on cipher machine and USBKey, the cipher machine that integration guarantees network security are conciliate Certainly USBKey stores the timeliness problem of data, there is provided a kind of more effective, more standard, the management method and means for more using.
The content of the invention
It is an object of the invention to provide a kind of security code generation based on cipher machine and USBKey and verification method.
The purpose of the present invention is realized in the following manner, ageing in existing for USBKey offline storage invoice datas Problem not high, fixes under the premise of a group key identical using in the filling USBKey keys of guarantee and encryption equipment, and identical is false proof Code generating algorithm and rule, then relies on cipher machine checking, effectively solves the problems, such as ageing not high, specifically includes following step Suddenly:
1)Cipher machine initially inculcates 200 keys, and each key is one group, is sequentially successively:(1)Transmission key,(2)Plus Key,(3)Message authentication code(MAC)Key,(4)Tax-control code(TAX)Key,(5)Spare key,(6)Spare key, every group The term of validity of key determines by application system, and to enable next group key automatically effective for application system after the term of validity;
2)It is as follows that AES support implements algorithm configuration:
0—3des;1—SM1;2—SM2;3—SSF33;4—SM4;
3)Data form treatment:
(1)Online invoicing time:Retain Hour Minute Second, be converted into 14 bit digital forms;
(2)Taxpayer Identification Number:The not enough above zero padding of 20 bit digitals, such as digit;
(3)Invoice codes:The not enough above zero padding of 12 bit digitals, such as digit;
(4)Invoice number:The not enough above zero padding of 8 bit digitals, such as digit;
(5)Invoice amount:Invoice amount is got point, removes decimal point, " 0 " is then mended before the amount of money to 20, then convert The amount of money to the byte of hexadecimal 10 ASCII character;
(6)Code data item treatment:4 ASCII character+0x80 of byte+byte of amount of money hexadecimal 10 before MAC value;
4)By step 3)Taxpayer Identification Number after middle treatment, Taxpayer Identification Number is converted to the storage array of 16 systems, Taxpayer Identification Number array to 16 bytes is processed by rule, obtains encryption factor;
5)According to step 4)The encryption factor and AES for obtaining, call cipher machine, generate interim handle close with interim Key;
6)According to step 3)Data, permanent order splicing data:Invoice codes+invoice number+make out an invoice the date, are converted into 16 System ASCII character;
7)According to step 5)The interim handle and temporary key, step 6 for obtaining)The ASCII character and step 2 for obtaining)In A kind of AES calls cipher machine, generates MAC value, nullifies temporary key;
8)The treatment amount of money, by step 3)The amount of money for obtaining and 7)The MAC value treatment for obtaining, obtains a yard data item:Before MAC value 4 ASCII character+0x80 of byte+byte of amount of money hexadecimal 10;
9)According to step 4)The encryption factor and step 7 for obtaining)In AES, call cipher machine, generate interim sentence Handle and temporary key;
10)According to step 8)Code data item, step 9)Interim handle and temporary key and step 7)In AES life Into 16 bytecodes, nullify temporary key, close cipher machine;
11)By step 10)16 bytecodes for obtaining are converted into 20 digital forms code, finally by 20 digit numeric codes last two Position is substituted for used cipher machine key group group number, finally gives security code.
The false proof code verification method of this programme, specifically includes following steps:
1)According to invoice data and security code, the key group group number in security code is called to generate new code from cipher machine, so Compare with security code afterwards, it is identical, illustrate to be verified, difference explanation checking does not pass through;
2)USBKey data verifications, precondition USBKey implantation keys and a certain group key of encryption equipment fixation are identical, institute Checking in encryption equipment is met with the security code for generating, similarly 11);
3)The security code generation of cipher machine and USBKey is as follows with verification method result:
(1)Ticket counterfoil is changed into Electronic Coding information and preserves from material object retention, and data are safer, retention cycle is longer, look into Ask in hgher efficiency;
(2)More added with safety guarantee, the emergent off-line datas of USBKey obtain verification examination, effective guarantee hair to network more in time The true or false of ticket.
Beneficial effects of the present invention are as follows:
1)Suitable for invoice and electronic invoice, printed on invoice in 20 bit digital forms;
2)Support that online enquiries mode distinguishes its true or false.
3)Need to provide the storage of USBKey mobile devices the offline invoice information issued;
4)Security code is needed constantly to support that true or false is verified, in the absence of ageing situation not high;
5)According to invoice data invoice information:The side's of making out an invoice Taxpayer Identification Number, the amount of money of making out an invoice, invoice codes, invoice number, Make out an invoice the date, security code of the generation with GB rule.
Use cipher machine, there is provided the algorithm of SM1/SM2/SM3/SM4/3DES/SSF33 encryptions is supported, according to the Fang Na that makes out an invoice The identifier of tax people, the amount of money of making out an invoice, invoice codes, invoice number, the invoice information on date of making out an invoice, generation is with GB rule Security code, the hidden danger of the presence that guarantees network security exists close different from encryption equipment any group of for the key that USBKey is inculcated The situation of key, then can't resolve timeliness sex chromosome mosaicism.
Brief description of the drawings
Fig. 1 is working-flow figure;
Fig. 2 is checking flow chart;
Fig. 3 is that off-line system is made out an invoice flow;
Fig. 4 is that net ticket issues flow;
Fig. 5 key management flows.
Specific embodiment
The method of the present invention is described in detail below with reference to Figure of description.
A kind of security code generation and verification method based on cipher machine and USBKey, use cipher machine, there is provided support SM1/ The algorithm of SM2/SM3/SM4/3DES/SSF33 encryptions, according to invoice information:The side's of making out an invoice Taxpayer Identification Number, the amount of money of making out an invoice, hair Ticket code, invoice number, make out an invoice the date, security code of the generation with GB rule, the hidden danger of the presence that guarantees network security.
There are problems that for USBKey offline storage invoice datas it is ageing not high, using ensureing filling USBKey keys Fixed under the premise of a group key identical with encryption equipment, identical security code generating algorithm and rule, then rely on cipher machine to test Card, efficiently solves the problems, such as ageing not high.
When the key of USBKey implantations is present different from encryption equipment any group of key, then timeliness is can't resolve Sex chromosome mosaicism.
The false proof code generating method of this programme, specifically includes following steps:(As shown in Figure 1)
1) cipher machine initially inculcates 200 keys, and existing each key is one group, is sequentially successively:1st, transmit key 2, add Key 3, message authentication code(MAC)Key, 4, tax-control code(TAX)Key 5, spare key 6, spare key, per group key The term of validity is typically set to 4 years(Determined by application system), to enable next group key automatically effective for application system after the term of validity;
2) AES supports that the concrete configuration for implementing algorithm is as follows:
0—3des;1—SM1;2—SM2;3—SSF33;4—SM4;
3)Data form treatment:
1st, online invoicing time:Retain Hour Minute Second, be converted into 14 bit digital forms;
2nd, Taxpayer Identification Number:The not enough above zero padding of 20 bit digitals, such as digit;
3rd, invoice codes:The not enough above zero padding of 12 bit digitals, such as digit;
4th, invoice number:The not enough above zero padding of 8 bit digitals, such as digit;
5th, invoice amount:Invoice amount is got point, removes decimal point, " 0 " is then mended before the amount of money to 20, then convert gold Volume is to hexadecimal ASCII character(10 bytes);
6th, code data item treatment:4 byte+amount of money hexadecimal ASCII characters before MAC value(10 bytes)+0x80;
4)By step 3)Taxpayer Identification Number after middle treatment, Taxpayer Identification Number is converted to the storage array of 16 systems, Taxpayer Identification Number array to 16 bytes is processed by rule, obtains encryption factor;
5)According to step 4)The encryption factor and AES for obtaining(Such as SM4), call cipher machine, generate interim handle and Temporary key;
6)According to step 3)Data, permanent order splicing data:Invoice codes+invoice number+make out an invoice the date, are converted into 16 System ASCII character;
7)According to step 5)The interim handle and temporary key, step 6 for obtaining)The ASCII character and step 2 for obtaining)In A kind of AES calls cipher machine, generates MAC value, nullifies temporary key;
8)The treatment amount of money, by step 3)The amount of money and step 7 for obtaining)The MAC value treatment for obtaining, obtains a yard data item:MAC The preceding 4 bytes+amount of money hexadecimal ASCII character of value(10 bytes)+0x80;
9)According to step 4)The encryption factor and step 7 for obtaining)In AES, call cipher machine, generate interim sentence Handle and temporary key;
10)According to step 8)Code data item, step 9)Interim handle and temporary key and step 7)In AES life Into 16 bytecodes, nullify temporary key, close cipher machine;
11)By step 10)16 bytecodes for obtaining are converted into 20 digital forms code, finally by 20 digit numeric codes last two Position is substituted for used cipher machine key group group number, finally gives security code;
12)The false proof code verification method of this programme, specifically includes following steps:(As shown in Figure 2)
(1)According to invoice data and security code, the key group group number in security code is called to generate new code from cipher machine, so Compare with security code afterwards, it is identical, illustrate to be verified, difference explanation checking does not pass through;
(2)USBKey data verifications, precondition USBKey implantation keys and a certain group key of encryption equipment fixation are identical, institute Checking in encryption equipment is met with the security code for generating, similarly 11);
13)The security code generation of cipher machine and USBKey is as follows with verification method result:
1st, ticket counterfoil is changed into the preservation of Electronic Coding information from material object retention, and data are safer, retention cycle is longer, inquiry It is in hgher efficiency;
2nd, more added with safety guarantee, the emergent off-line datas of USBKey obtain verification examination, effective guarantee hair to network more in time The true or false of ticket.
In addition to the technical characteristic described in specification, the known technology of those skilled in the art is.

Claims (1)

1. a kind of security code generation and verification method based on cipher machine and USBKey, it is characterised in that offline for USBKey Storage invoice data there are problems that it is ageing not high, using ensureing that filling USBKey keys and encryption equipment fix a group key phase On the premise of, then identical security code generating algorithm and rule rely on cipher machine checking, effectively solves ageing not high Problem, specifically includes following steps:
A, cipher machine initially inculcate 200 keys, and each key is one group, is sequentially successively:(1)Transmission key,(2)Encryption is close Key,(3)Message authentication code MAC keys,(4)Tax-control code TAX keys(5)Spare key,(6)Spare key, having per group key The effect phase determines by application system, and to enable next group key automatically effective for application system after the term of validity;
B, AES support that to implement algorithm configuration as follows:
0—3des;1—SM1;2—SM2;3—SSF33;4—SM4;
C, data form treatment:
(1)Online invoicing time:Retain Hour Minute Second, be converted into 14 bit digital forms;
(2)Taxpayer Identification Number:The not enough above zero padding of 20 bit digitals, such as digit;
(3)Invoice codes:The not enough above zero padding of 12 bit digitals, such as digit;
(4)Invoice number:The not enough above zero padding of 8 bit digitals, such as digit;
(5)Invoice amount:Invoice amount is got point, removes decimal point, " 0 " is then mended before the amount of money to 20, then convert the amount of money To the ASCII character of the byte of hexadecimal 10;
(6)Code data item treatment:4 ASCII character+0x80 of byte+byte of amount of money hexadecimal 10 before MAC value;
D, Taxpayer Identification Number that will be in step C after treatment, Taxpayer Identification Number is converted to the storage array of 16 systems, to 16 words The Taxpayer Identification Number array of section is processed by rule, obtains encryption factor;
E, the encryption factor obtained according to step D and AES, call cipher machine, generate interim handle and temporary key;
F, according to step C data, permanent order splicing data:Invoice codes+invoice number+make out an invoice the date, are converted into 16 systems ASCII character;
A kind of encryption in ASCII character and step B that G, the interim handle obtained according to step E and temporary key, step F are obtained Algorithm calls cipher machine, generates MAC value, nullifies temporary key;
H, the treatment amount of money, the MAC value treatment that the amount of money and G that step C is obtained are obtained, obtain a yard data item:4 words before MAC value ASCII character+the 0x80 of the byte of section+amount of money hexadecimal 10;
AES in I, the encryption factor obtained according to step D and step G, calls cipher machine, generates interim handle and faces When key;
J, the AES in step H yards of data item, the interim handles of step I and temporary key and step G generate 16 words Section code, nullifies temporary key, closes cipher machine;
K, 16 bytecodes that step J is obtained are converted into 20 digital forms code, finally by 20 digit numeric codes it is last two replacement Into the cipher machine key group group number for being used, security code is finally given;
Security code checking is comprised the following steps:
A, according to invoice data and security code, call the key group group number in security code to generate new code, Ran Houhe from cipher machine Security code compares, identical, illustrates to be verified, and difference explanation checking does not pass through;
B, USBKey data verification, precondition USBKey implantation keys and a certain group key of encryption equipment fixation are identical, so raw Into security code meet the checking in encryption equipment, it is identical with step K;
The security code generation of c, cipher machine and USBKey is as follows with verification method result:
(1)Ticket counterfoil is changed into Electronic Coding information and preserves from material object retention, and data are safer, retention cycle is longer, inquiry effect Rate is higher;
(2)More added with safety guarantee, the emergent off-line datas of USBKey obtain verification examination to network more in time, effective guarantee invoice True or false.
CN201410564708.XA 2014-10-22 2014-10-22 Anti-counterfeiting code generation and verification method based on cipher machine and USBKey Active CN104318461B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410564708.XA CN104318461B (en) 2014-10-22 2014-10-22 Anti-counterfeiting code generation and verification method based on cipher machine and USBKey

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410564708.XA CN104318461B (en) 2014-10-22 2014-10-22 Anti-counterfeiting code generation and verification method based on cipher machine and USBKey

Publications (2)

Publication Number Publication Date
CN104318461A CN104318461A (en) 2015-01-28
CN104318461B true CN104318461B (en) 2017-06-27

Family

ID=52373688

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410564708.XA Active CN104318461B (en) 2014-10-22 2014-10-22 Anti-counterfeiting code generation and verification method based on cipher machine and USBKey

Country Status (1)

Country Link
CN (1) CN104318461B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104851206A (en) * 2015-05-25 2015-08-19 华北电力大学 USBKEY (universal serial bus key)-based online electric charge payment system
CN107977870A (en) * 2017-11-21 2018-05-01 桂林爱家购股份有限公司 A kind of electronic invoice generates system and method
CN109525389A (en) * 2018-10-16 2019-03-26 航天信息股份有限公司 A kind of production method and system of tax controlling equipment code key

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588843A (en) * 2004-09-15 2005-03-02 华南理工大学 Forming and verifying system and method for bill anti-fake code
CN101038634A (en) * 2007-04-23 2007-09-19 中国振华(集团)科技股份有限公司 Production RFID false proof method with logic control unit
CN101132276A (en) * 2007-09-27 2008-02-27 中兴通讯股份有限公司 Method and system for symmetrical encryption of terminal data by SAM card
CN102739397A (en) * 2011-03-31 2012-10-17 汉王科技股份有限公司 Method and device for encrypting and checking electronic worksheet
CN202815938U (en) * 2012-06-14 2013-03-20 深圳市金溢科技有限公司 Electronic toll collection system (ETC), free flow system and monitor center, and DSRC device
CN103544439A (en) * 2012-07-11 2014-01-29 北京旋极信息技术股份有限公司 Embedded software for tax-control disk and tax-declaration disk

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100484209B1 (en) * 1998-09-24 2005-09-30 삼성전자주식회사 Digital Content Encryption / Decryption Device and Method
FR2926382B1 (en) * 2008-01-11 2010-02-26 Proton World Internat Nv HIERARCHIZATION OF CRYPTOGRAPHIC KEYS IN AN ELECTRONIC CIRCUIT

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588843A (en) * 2004-09-15 2005-03-02 华南理工大学 Forming and verifying system and method for bill anti-fake code
CN101038634A (en) * 2007-04-23 2007-09-19 中国振华(集团)科技股份有限公司 Production RFID false proof method with logic control unit
CN101132276A (en) * 2007-09-27 2008-02-27 中兴通讯股份有限公司 Method and system for symmetrical encryption of terminal data by SAM card
CN102739397A (en) * 2011-03-31 2012-10-17 汉王科技股份有限公司 Method and device for encrypting and checking electronic worksheet
CN202815938U (en) * 2012-06-14 2013-03-20 深圳市金溢科技有限公司 Electronic toll collection system (ETC), free flow system and monitor center, and DSRC device
CN103544439A (en) * 2012-07-11 2014-01-29 北京旋极信息技术股份有限公司 Embedded software for tax-control disk and tax-declaration disk

Also Published As

Publication number Publication date
CN104318461A (en) 2015-01-28

Similar Documents

Publication Publication Date Title
CN106548353B (en) Commodity anti-counterfeiting code generation and verification method
CN102801530B (en) A kind of authentication method based on transfer voice
CN107181797A (en) The block compression method and system of a kind of block chain
CN108964905A (en) A kind of safe and efficient block chain implementation method
CN104935429A (en) Data processing method and system employing multi-encryption technology
CN104637185A (en) Offline box opening method of intelligent storage cabinet
CN110601815B (en) Block chain data processing method and equipment
CN102571357A (en) Signature realization method and signature realization device
CN104318461B (en) Anti-counterfeiting code generation and verification method based on cipher machine and USBKey
CN104992119A (en) Sensitive information anti-interception safety transmission method and system
KR101862279B1 (en) System architecture and method for ensuring network information security
CN104468096A (en) Method for protecting network electronic identity identifier information based on secret key scattering calculation
CN102752110A (en) Dynamic password generating method and system
CN110381055A (en) RFID system privacy-protection certification protocol method in healthcare supply chain
CN104868999A (en) Challenging dynamic password authentication method based on brain wave waveform characteristic
CN107257349A (en) Cipher encrypting method and system based on unidirectional and public key encryption algorithm
CN102761557A (en) Terminal device authentication method and device
CN103685149B (en) The method and apparatus for handling the password of game server
CN110210270A (en) Two-dimensional barcode information safety encryption and system and image in 2 D code analytic method and system
CN105184590A (en) Laser on-line efficient etching and product anti-fake traceability system applied to steels
CN104301288B (en) Online identity certification, online transaction checking, the method and system of online verification protection
CN102842053B (en) A kind of false proof figure code label and manufacture method thereof
CN104579686B (en) A kind of seed matching process for handset token
CN108038979A (en) Continuously operating method based on STS payment systems
CN110247878A (en) A kind of data transfer encryption method

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
TR01 Transfer of patent right

Effective date of registration: 20200616

Address after: 250100 Inspur Science Park, No. 1036, Inspur Road, high tech Zone, Jinan City, Shandong Province

Patentee after: Inspur Software Technology Co.,Ltd.

Address before: 250100 Ji'nan science and Technology Development Zone, Shandong Branch Road No. 2877

Patentee before: INSPUR GROUP Co.,Ltd.

TR01 Transfer of patent right