CN110738740B - Ticket checking system and method based on HMAC-SM3 message authentication code - Google Patents

Ticket checking system and method based on HMAC-SM3 message authentication code Download PDF

Info

Publication number
CN110738740B
CN110738740B CN201910916999.7A CN201910916999A CN110738740B CN 110738740 B CN110738740 B CN 110738740B CN 201910916999 A CN201910916999 A CN 201910916999A CN 110738740 B CN110738740 B CN 110738740B
Authority
CN
China
Prior art keywords
ticket
message authentication
seller
authentication code
data
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
CN201910916999.7A
Other languages
Chinese (zh)
Other versions
CN110738740A (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.)
Hangzhou Kuaiying Information Technology Co ltd
Original Assignee
Hangzhou Kuaiying Information Technology 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 Hangzhou Kuaiying Information Technology Co ltd filed Critical Hangzhou Kuaiying Information Technology Co ltd
Priority to CN201910916999.7A priority Critical patent/CN110738740B/en
Publication of CN110738740A publication Critical patent/CN110738740A/en
Application granted granted Critical
Publication of CN110738740B publication Critical patent/CN110738740B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07BTICKET-ISSUING APPARATUS; FARE-REGISTERING APPARATUS; FRANKING APPARATUS
    • G07B11/00Apparatus for validating or cancelling issued tickets
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/10544Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum
    • G06K7/10821Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum further details of bar or optical code scanning devices
    • G06K7/10861Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum further details of bar or optical code scanning devices sensing of data fields affixed to objects or articles, e.g. coded labels
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3242Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving keyed hash functions, e.g. message authentication codes [MACs], CBC-MAC or HMAC

Abstract

The invention discloses a ticket checking system based on an HMAC-SM3 message authentication code, which is characterized by comprising a ticket seller and a ticket system; the ticket seller calculates ticket data and ticket seller Key through HMAC-SM3 algorithm to obtain message authentication code 1, and combines and codes the message authentication code 1 and the ticket data to obtain a ticket two-dimensional code; the ticketing system scans the ticket two-dimension code to obtain ticket data and a message authentication code 1, extracts ticket seller information from the ticket data, and obtains a ticket seller Key according to the extracted ticket seller information; calculating to obtain a message authentication code 2 through an HMAC-SM3 algorithm according to ticket data obtained by scanning the ticket two-dimensional code and a ticket seller Key; and the ticket business system compares the message authentication code 1 with the message authentication code 2, if the message authentication codes are consistent, the ticket data can be confirmed to come from a ticket seller, the ticket checking is successful, and otherwise, the ticket checking is failed. The invention makes ticket checking convenient and fast, and the application of the message authentication code ensures the integrity and source of the ticket data.

Description

Ticket checking system and method based on HMAC-SM3 message authentication code
Technical Field
The invention relates to the technical field of two-dimensional code ticket checking, in particular to a ticket checking system and method based on an HMAC-SM3 message authentication code.
Background
In 2016, the cryptographic hash algorithm of GB/T32905 and 2016 information security technology SM3 was published. The method is suitable for digital signature and verification, message authentication code generation and verification and random number generation in commercial password application, and can meet the safety requirements of various password applications.
HMAC (Keyed-Hashing for Message Authentication) operations utilize a hash algorithm to take a key and a Message as inputs and generate a Message digest as an output.
The scale of the mobile phone net citizens in China in 2018 reaches 7.88 hundred million. Tickets with two-dimensional codes and a mode of checking tickets by scanning the two-dimensional codes are widely used. The method comprises a paper ticket and a two-dimensional code ticket displayed by mobile equipment (mainly a mobile phone).
It becomes important to verify the integrity and source of the two-dimensional ticket information.
Disclosure of Invention
The invention aims to provide a ticket checking system and a ticket checking method based on an HMAC-SM3 message authentication code aiming at the defects of the prior art.
The purpose of the invention is realized by the following technical scheme: a ticket checking system based on HMAC-SM3 message authentication code comprises a ticket seller and a ticket service system;
the ticket seller calculates ticket data and a ticket seller Key generated randomly through an HMAC-SM3 algorithm to obtain a message authentication code 1, and performs combined coding on the message authentication code 1 and the ticket data to obtain a ticket two-dimensional code;
the ticketing system scans the ticket two-dimension code to obtain ticket data and a message authentication code 1, extracts ticket seller information from the ticket data, and obtains a ticket seller Key according to the extracted ticket seller information; calculating to obtain a message authentication code 2 through an HMAC-SM3 algorithm according to ticket data obtained by scanning the ticket two-dimensional code and a ticket seller Key; and the ticket business system compares the message authentication code 1 with the message authentication code 2, if the message authentication codes are consistent, the ticket data can be confirmed to come from a ticket seller, the ticket checking is successful, and otherwise, the ticket checking is failed.
Further, the ticket seller Key is shared by the ticket seller and the ticketing system.
Further, the ticket data includes a ticket seller, a ticket name, a ticket code, a ticket quantity, a ticket use date, a ticket order, and a random number.
Furthermore, the ticket data and the message authentication code are in a one-to-one correspondence and are irreversible, that is, the ticket data cannot be calculated from the message authentication code.
Furthermore, the ticket selling mode of the ticket seller comprises field ticket selling, network ticket selling or third party ticket selling.
Furthermore, the ticketing system has the functions of ticket drawing, ticket checking, ticket management and the like, and comprises a ticket checking device for scanning the two-dimensional code of the ticket and a ticket drawing device for printing the two-dimensional code of the ticket.
A two-dimensional code ticket checking method based on an HMAC-SM3 message authentication code comprises the following steps:
(1) the ticket seller calculates ticket data and a ticket seller Key through an HMAC-SM3 algorithm to obtain a message authentication code 1;
(2) the ticket seller codes the message authentication code 1 and ticket data in a combined manner to obtain a ticket two-dimensional code;
(3) scanning the ticket two-dimensional code in the step 2 through ticket checking equipment of a ticketing system to obtain ticket data and a message authentication code 1;
(4) the ticketing system extracts the information of the ticket seller from the ticket data obtained in the step 3, so that a Key of the ticket seller is obtained;
(5) the ticketing system calculates the ticket data obtained in the step 3 and the ticket seller Key obtained in the step 4 through an HMAC-SM3 algorithm to obtain a message authentication code 2;
(6) and comparing the message authentication code 1 with the message authentication code 2, and if the two message authentication codes are consistent, the ticket data corresponding to the two message authentication codes are the same and the ticket seller Key is the same, so that the ticket data can be confirmed to come from the ticket seller and be complete and not tampered.
The invention has the beneficial effects that:
(1) calculating an HMAC-SM3 message authentication code by using a ticket seller Key and ticket data as input; the Key of other people without ticket seller can not be calculated, the source of ticket data can be confirmed and guaranteed, and the safety of two-dimensional code data is enhanced.
(2) The ticket data contains a random number, and when the message authentication code is calculated, the random number can participate in calculation of the HMAC-SM3 algorithm, so that the randomness of the calculation result is improved, and the method is safer and more reliable.
(3) When ticket checking and verifying, the original ticket data can only be calculated under the condition that the original ticket data is not tampered, and the same HMAC-SM3 message authentication code can be calculated, so that the integrity of the ticket data is confirmed. Meanwhile, even if the failure is caused by no network, the ticket checking equipment scans the ticket two-dimensional code to acquire the ticket data, and the source and the integrity of the ticket data are confirmed, namely, the validity of the ticket data is verified, so that the ticket can be checked normally; the ticket checking result can be synchronized to the scenic spot ticketing system after the network is recovered.
Drawings
FIG. 1 is a schematic diagram of a two-dimensional code generation method during ticket drawing;
FIG. 2 is a schematic diagram of a two-dimensional code verification method during ticket checking;
FIG. 3 is a flow chart of an embodiment of the present invention.
Detailed Description
The following describes embodiments of the present invention in further detail with reference to the accompanying drawings.
As shown in fig. 1-2, the invention provides a ticket checking system based on HMAC-SM3 message authentication code, which comprises a ticket seller and a ticketing system;
the ticket seller calculates ticket data and a ticket seller Key generated randomly through an HMAC-SM3 algorithm to obtain a message authentication code 1, and performs combined coding on the message authentication code 1 and the ticket data to obtain a ticket two-dimensional code; the ticket seller Key is shared by the ticket seller and the ticketing system, and the ticket data comprises the ticket seller, the name of the ticket, the code of the ticket, the number of the tickets, the date of the ticket, the order of the ticket and a random number. The ticket data and the message authentication code are in one-to-one correspondence and are irreversible, namely, the ticket data cannot be calculated from the message authentication code.
The ticket selling mode of the ticket seller comprises on-site ticket selling, network ticket selling or third party ticket selling.
The ticketing system scans the ticket two-dimension code to obtain ticket data and a message authentication code 1, extracts ticket seller information from the ticket data, and obtains a ticket seller Key according to the extracted ticket seller information; calculating to obtain a message authentication code 2 through an HMAC-SM3 algorithm according to ticket data obtained by scanning the ticket two-dimensional code and a ticket seller Key; and the ticket business system compares the message authentication code 1 with the message authentication code 2, if the message authentication codes are consistent, the ticket data can be confirmed to come from a ticket seller, the ticket checking is successful, and otherwise, the ticket checking is failed. The ticketing system has the functions of ticketing, ticket checking, ticket management and the like, and comprises a ticket checking device for scanning the two-dimensional code of the ticket and a ticketing device for printing the two-dimensional code of the ticket.
A two-dimensional code ticket checking method based on an HMAC-SM3 message authentication code comprises the following steps:
(1) the ticket seller calculates ticket data and a ticket seller Key through an HMAC-SM3 algorithm to obtain a message authentication code 1;
(2) the ticket seller codes the message authentication code 1 and ticket data in a combined manner to obtain a ticket two-dimensional code;
(3) scanning the ticket two-dimensional code in the step 2 through ticket checking equipment of a ticketing system to obtain ticket data and a message authentication code 1;
(4) the ticketing system extracts the information of the ticket seller from the ticket data obtained in the step 3, so that a Key of the ticket seller is obtained;
(5) the ticketing system calculates the ticket data obtained in the step 3 and the ticket seller Key obtained in the step 4 through an HMAC-SM3 algorithm to obtain a message authentication code 2;
(6) and comparing the message authentication code 1 with the message authentication code 2, if the two message authentication codes are consistent, the ticket data corresponding to the two message authentication codes are the same, and the ticket data is the same as the ticket data corresponding to the two message authentication codes and the ticket seller Key, so that the ticket data can be confirmed to be from the ticket seller, the ticket data is complete and not tampered, and if the two message authentication codes are inconsistent, the ticket data is confirmed to be a fake ticket.
As shown in fig. 3, one embodiment of scenic spot ticketing is given as follows:
a. when a ticket seller issues a ticket, calculating by using ticket data and a ticket seller Key through an HMAC-SM3 algorithm to obtain a message authentication code 1;
b. and after the coded ticket data and the message authentication code 1 are combined, a ticket two-dimensional code is generated and displayed on a paper ticket or a network ticket.
c. And (3) selling tickets to mobile phone users through the network by the scenic spot or third party ticket seller, or purchasing tickets in a window of the scenic spot by the users, so as to obtain network tickets or paper tickets with two-dimensional codes.
d. A user uses a paper ticket or a network ticket to scan a code on a gate with a ticketing system for ticket checking.
e. When the gate scans the code to check the ticket, ticket data and a message authentication code 1 are obtained from the ticket two-dimensional code, and a message authentication code 2 is obtained by calculation through an HMAC-SM3 algorithm by using the ticket data and a shared ticket seller Key associated with the ticket seller in the ticket data.
f. And comparing the message authentication code 1 with the message authentication code 2, and if the message authentication codes are consistent, passing the pass.
The above-described embodiments are intended to illustrate rather than to limit the invention, and any modifications and variations of the present invention are within the spirit of the invention and the scope of the appended claims.

Claims (2)

1. A ticket checking system based on HMAC-SM3 message authentication code is characterized in that the system comprises a ticket seller and a ticket service system;
the ticket seller calculates ticket data and ticket seller Key through HMAC-SM3 algorithm to obtain message authentication code 1, and combines and codes the message authentication code 1 and the ticket data to obtain a ticket two-dimensional code; the ticket seller Key is randomly generated and shared by the ticket seller and the ticket system; the ticket data comprises a ticket seller, a ticket name, a ticket code, a ticket quantity, a ticket using date, a ticket order and a random number; the ticket selling mode of the ticket seller comprises on-site ticket selling, network ticket selling or third party ticket selling;
the ticketing system scans the ticket two-dimension code to obtain ticket data and a message authentication code 1, extracts ticket seller information from the ticket data, and obtains a ticket seller Key according to the extracted ticket seller information; calculating to obtain a message authentication code 2 through an HMAC-SM3 algorithm according to ticket data obtained by scanning the ticket two-dimensional code and a ticket seller Key; and the ticketing system compares the message authentication code 1 with the message authentication code 2, if the message authentication codes are consistent, the ticketing data comes from a ticket seller, the ticket checking is successful, otherwise, the ticket checking fails, and the ticketing system has the functions of ticket drawing, ticket checking and ticket management, and comprises ticket checking equipment for scanning a two-dimensional code of the ticket and ticket drawing equipment for printing the two-dimensional code of the ticket.
2. A ticket checking method based on the ticket checking system of claim 1, characterized in that the method comprises the following steps:
(1) the ticket seller calculates ticket data and a ticket seller Key through an HMAC-SM3 algorithm to obtain a message authentication code 1;
(2) the ticket seller codes the message authentication code 1 and ticket data in a combined manner to obtain a ticket two-dimensional code;
(3) scanning the ticket two-dimensional code in the step 2 through ticket checking equipment of a ticketing system to obtain ticket data and a message authentication code 1;
(4) the ticketing system extracts the information of the ticket seller from the ticket data obtained in the step 3, so that a Key of the ticket seller is obtained;
(5) the ticketing system calculates the ticket data obtained in the step 3 and the ticket seller Key obtained in the step 4 through an HMAC-SM3 algorithm to obtain a message authentication code 2;
(6) and comparing the message authentication code 1 with the message authentication code 2, and if the two message authentication codes are consistent, the ticket data corresponding to the two message authentication codes are the same and the ticket seller Key is the same, so that the ticket data can be confirmed to come from the ticket seller and be complete and not tampered.
CN201910916999.7A 2019-09-26 2019-09-26 Ticket checking system and method based on HMAC-SM3 message authentication code Active CN110738740B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910916999.7A CN110738740B (en) 2019-09-26 2019-09-26 Ticket checking system and method based on HMAC-SM3 message authentication code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910916999.7A CN110738740B (en) 2019-09-26 2019-09-26 Ticket checking system and method based on HMAC-SM3 message authentication code

Publications (2)

Publication Number Publication Date
CN110738740A CN110738740A (en) 2020-01-31
CN110738740B true CN110738740B (en) 2021-12-21

Family

ID=69269660

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910916999.7A Active CN110738740B (en) 2019-09-26 2019-09-26 Ticket checking system and method based on HMAC-SM3 message authentication code

Country Status (1)

Country Link
CN (1) CN110738740B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101866498A (en) * 2009-09-30 2010-10-20 深圳市安捷信联科技有限公司 Electronic ticket implementation method and system based on intelligent card
CN103400418A (en) * 2013-07-26 2013-11-20 电子科技大学 Electronic ticket sale and check method based on NFC (Near Field Communication) mobile terminal
CN104282091A (en) * 2013-07-02 2015-01-14 郁晓东 Bill data generating/transmitting/storing/authenticating method
CN105678365A (en) * 2014-11-18 2016-06-15 航天信息股份有限公司 Two-dimensional code e-ticket generation method and system, two-dimensional code e-ticket verification method and verification terminal
CN107230257A (en) * 2017-05-26 2017-10-03 深圳市萌爱动漫文化发展有限公司 A kind of verification method for electronic two-dimensional code ticket
CN107967605A (en) * 2017-11-20 2018-04-27 南京熊猫电子股份有限公司 A kind of rail traffic ticket automatic selling and checking Quick Response Code credit payment encryption method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101739625A (en) * 2008-11-19 2010-06-16 中国移动通信集团广西有限公司 E-ticketing method and system
CN101872494A (en) * 2009-04-22 2010-10-27 上海易悠通信息科技有限公司 Two-dimensional code railway ticket and ticketing, examining and checking management system thereof
WO2012004838A1 (en) * 2010-07-09 2012-01-12 Takeshi Mizunuma Service provision method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101866498A (en) * 2009-09-30 2010-10-20 深圳市安捷信联科技有限公司 Electronic ticket implementation method and system based on intelligent card
CN104282091A (en) * 2013-07-02 2015-01-14 郁晓东 Bill data generating/transmitting/storing/authenticating method
CN103400418A (en) * 2013-07-26 2013-11-20 电子科技大学 Electronic ticket sale and check method based on NFC (Near Field Communication) mobile terminal
CN105678365A (en) * 2014-11-18 2016-06-15 航天信息股份有限公司 Two-dimensional code e-ticket generation method and system, two-dimensional code e-ticket verification method and verification terminal
CN107230257A (en) * 2017-05-26 2017-10-03 深圳市萌爱动漫文化发展有限公司 A kind of verification method for electronic two-dimensional code ticket
CN107967605A (en) * 2017-11-20 2018-04-27 南京熊猫电子股份有限公司 A kind of rail traffic ticket automatic selling and checking Quick Response Code credit payment encryption method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于可信密码模块的SoC可信启动框架模型;王希冀,张功萱,郭子恒;《计算机工程与科学》;20190430;正文第608页右栏 *
基于商用密码算法的二维码验票系统;刘思雨,耿子华;《数码世界》;20170531;正文第32-33页 *

Also Published As

Publication number Publication date
CN110738740A (en) 2020-01-31

Similar Documents

Publication Publication Date Title
KR102560512B1 (en) data check
CN110276588B (en) Electronic signature authentication method and device and computer readable storage medium
CN103617531B (en) Safe payment method based on credible two-dimension code and device
CN103167491B (en) A kind of mobile terminal uniqueness authentication method based on software digital certificate
CN101999132B (en) The strong authentication token of one-time password and signature is generated when credential server is verified
CN111211909B (en) Distributed authentication method based on zero-knowledge proof
WO2016169423A1 (en) Data authenticity identification method for safety check of two-dimensional code
CN103107996A (en) On-line download method and system of digital certificate and digital certificate issuing platform
CN106936790A (en) The method that client and server end carries out two-way authentication is realized based on digital certificate
CN102868702B (en) System login device and system login method
CN107277059A (en) A kind of one-time password identity identifying method and system based on Quick Response Code
CN104253689A (en) User identity module card generated dynamic password authentication method and system based on QR (quick response) code
KR101202245B1 (en) System and Method For Transferring Money Using OTP Generated From Account Number
WO2015154482A1 (en) One-time certificate anti-counterfeiting tracing system based on mobile terminal and rfid
US8601270B2 (en) Method for the preparation of a chip card for electronic signature services
CN106101140B (en) A kind of method and server of authentification of message
CN104657860A (en) Mobile banking security authentication method
CN103532979A (en) Method for generating and verifying multi-conversation verification codes under CGI (common gateway interface) for web
CN109726578A (en) A kind of anti-fake solution of novel dynamic two-dimension code
CN110738740B (en) Ticket checking system and method based on HMAC-SM3 message authentication code
CN115438320B (en) Hidden data right determining method based on blockchain and digital fingerprint
CN107124399A (en) A kind of member system and method logged in based on cell-phone number identifying code
CN115310141A (en) Document authentication method based on notarization and signing of notarization system
CN105429986B (en) A kind of system of genuine cyber identification verifying and secret protection
CN103905205A (en) Cross-equipment and cross-application digital signature and verification method based on data image coding

Legal Events

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