CN110796443B - Method and terminal for constructing track data - Google Patents

Method and terminal for constructing track data Download PDF

Info

Publication number
CN110796443B
CN110796443B CN201911030916.0A CN201911030916A CN110796443B CN 110796443 B CN110796443 B CN 110796443B CN 201911030916 A CN201911030916 A CN 201911030916A CN 110796443 B CN110796443 B CN 110796443B
Authority
CN
China
Prior art keywords
random number
card
information
terminal
module
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
CN201911030916.0A
Other languages
Chinese (zh)
Other versions
CN110796443A (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.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies 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 Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201911030916.0A priority Critical patent/CN110796443B/en
Publication of CN110796443A publication Critical patent/CN110796443A/en
Application granted granted Critical
Publication of CN110796443B publication Critical patent/CN110796443B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/34Payment architectures, schemes or protocols characterised by the use of specific devices or networks using cards, e.g. integrated circuit [IC] cards or magnetic cards
    • G06Q20/341Active cards, i.e. cards including their own processing means, e.g. including an IC or chip
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/34Payment architectures, schemes or protocols characterised by the use of specific devices or networks using cards, e.g. integrated circuit [IC] cards or magnetic cards
    • G06Q20/356Aspects of software for card payments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3823Payment protocols; Details thereof insuring higher security of transaction combining multiple encryption tools for a transaction

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Microelectronics & Electronic Packaging (AREA)
  • Computer Security & Cryptography (AREA)
  • Finance (AREA)
  • Storage Device Security (AREA)

Abstract

The invention provides a method of constructing track data, comprising: the terminal acquires card information, acquires a random number range and a first random number set by the terminal, generates a second random number, acquires an application ciphertext generation instruction according to the second random number, receives an application ciphertext generation response returned by the card, acquires an application ciphertext, and constructs track information according to the card information, the second random number and the application ciphertext. By means of the scheme, when the application ciphertext in the constructed track information is sent to the server, the server can verify the application ciphertext, and the risk that track data is tampered in the transmission process is avoided.

Description

Method and terminal for constructing track data
Technical Field
The invention belongs to the field of information security, and particularly relates to a method and a terminal for constructing track data.
Background
At present, a bank card consumption mode is very popular in life of people, and a terminal can construct magnetic track information by acquiring card data and then send the magnetic track information to a payee; thus, track information is data where interaction is important.
In the prior art, when the intelligent IC card and the terminal perform non-contact interaction, the terminal simulates the magnetic stripe card to perform non-contact interaction, and the terminal only needs to report the magnetic track information acquired from the intelligent IC card to the payee, so that the interaction can be completed, but the magnetic track information can be possibly tampered when the magnetic track information is acquired or reported to the payee, so that the technical problem to be solved by the invention is how to prevent the magnetic track data reported to the payee from being tampered.
Disclosure of Invention
According to the present invention, there is provided a method of constructing track data, comprising:
step s1: the terminal acquires card information, and acquires a random number range and a first random number set by the terminal; generating a first variable according to the first random number and the random number range; generating a second random number according to the first variable, the first random number and the card information;
step s2: the terminal obtains an application ciphertext generating instruction according to the second random number and sends the application ciphertext generating instruction to the card;
step s3: the terminal waits for receiving the generated application ciphertext response returned by the card, judges whether the generated application ciphertext response returned by the card is received or not, and if yes, executes step s4; otherwise, reporting errors, and failing to construct track data;
step s4: the terminal acquires an interaction counter and an application ciphertext from the generated application ciphertext response;
step s5: the terminal acquires service code information, year and month information of application expiration date and an effective main account number in the card information; filling track information according to the effective main account number, the year and month information of the application expiration date, the service code information, the second random number, the application ciphertext and the interaction counter;
step s6: the terminal uses the filled track information as the acquired track data and ends.
Optionally, step s1 further includes, before:
the terminal sends a reading and recording instruction to the card, judges whether a reading and recording response returned by the card is received, and if yes, executes step s1; otherwise, judging whether the preset time is exceeded, if yes, reporting errors, and constructing track data fails; if not, continuing to wait for receiving the read record response returned by the card.
Optionally, step s1 specifically includes:
the terminal acquires card information, key information in the card information and a random number range and a first random number set by the terminal; and performing modular operation on the random number range by using the first random number to obtain a modular result, and setting the modular result as a first variable.
Optionally, the key information in the card information includes: application validation date, application expiration date, primary account information, and two-track equivalent data.
Optionally, step s2 specifically includes:
the terminal calculates and obtains a first result according to the application effective date and a first variable; and saving the first result into the first random number to generate a second random number.
Optionally, step s2 specifically includes:
the terminal stores the second random number in a data field of the first generation application ciphertext instruction to obtain a generation application ciphertext instruction, and sends the generation application ciphertext instruction to the card;
optionally, in step s3, before the terminal does not receive the response of the card to generate the application ciphertext, the method further includes: judging whether the preset time is exceeded by the terminal, if yes, reporting errors, and failing to construct the track data; if not, the step s3 is continued.
Optionally, after the step s3 is determined to be yes, before executing the step s4, the method further includes:
the terminal judges whether the received generated application ciphertext response contains an interaction counter and an application ciphertext, if so, the step s4 is executed; otherwise, reporting error, and constructing track data fails.
Optionally, step s5 specifically includes:
step s5-1: the terminal acquires service code information from the two-track equivalent data, acquires year and month information from the application failure date, and acquires a valid primary account number from the primary account number information;
step s5-2: the terminal fills track information according to the valid primary account number, the year and month information of the application expiration date, the service code information, the second random number, the application ciphertext and the interaction counter.
According to another aspect of the present invention, there is provided a terminal for constructing track data, comprising:
the acquisition module is used for acquiring card information, and acquiring a random number range and a first random number set by the terminal;
the generation module is used for generating a first variable according to the first random number and the random number range acquired by the acquisition module; the card information processing module is used for generating a first random number according to the first variable and the card information;
the generation module is also used for obtaining and generating an application ciphertext instruction according to the second random number;
the sending module is used for sending the generated application ciphertext instruction obtained by the generating module to the card;
the receiving module is used for receiving the generated application ciphertext response returned by the card;
the judging module is used for judging whether the receiving module receives the generated application ciphertext response returned by the card or not;
the error reporting module is used for reporting errors when the judging module judges that the receiving module does not receive the response of the generated application ciphertext returned by the card;
the acquisition module is also used for acquiring an interaction counter and an application ciphertext from the generated application ciphertext response when the receiving module receives the generated application ciphertext response returned by the card;
the acquisition module is also used for acquiring service code information, year and month information of application expiration date and effective primary account number in the card information;
the filling module is used for filling track data according to the effective primary account number, the year and month information of the application expiration date, the service code information, the second random number generated by the generating module, the application ciphertext acquired by the acquiring module and the interaction counter, and taking the filled track data as the acquired track data.
Optionally, the sending module is further used for sending a reading record instruction to the card;
the judging module is also used for judging whether a read record response returned by the card is received or not;
the judging module is also used for judging whether the preset time is exceeded or not when judging that the read record response returned by the card is not received;
the error reporting module is also used for reporting errors when the judging module judges that the preset time is exceeded;
the receiving module is also used for waiting to receive the read record response returned by the card when the judging module judges that the preset time is not exceeded.
Optionally, the acquiring module is specifically configured to acquire card information, acquire key information in the card information, and acquire a random number range and a first random number set by the acquiring module;
the generation module comprises:
the operation submodule is used for carrying out modular operation on the random number range by the first random number to obtain a modular result;
and the setting submodule is used for setting the modulus taking result as the first variable.
Optionally, the acquiring module is specifically configured to acquire an application validation date, an application expiration date, primary account information, and two-track equivalent data.
Optionally, the generating module is specifically configured to calculate to obtain a first result according to the application validation date and the first variable; and saving the first result into the first random number to generate a second random number.
Optionally, the generating module is specifically configured to store the second random number in a data field of the first generated application ciphertext instruction to obtain the generated application ciphertext instruction.
Optionally, the judging module is further configured to judge whether the preset time is exceeded before the error is reported when the receiving module does not receive the response of the generated application ciphertext returned by the card;
and the error reporting module is used for reporting errors when the judging module judges that the preset time is exceeded.
Optionally, the judging module is further configured to judge whether the received generated application ciphertext response includes the interaction counter and the application ciphertext when the judging module judges that the receiving module receives the generated application ciphertext response returned by the card.
Optionally, the acquiring module is specifically configured to acquire service code information from the two-track equivalent data, acquire year and month information from the application failure date, and acquire the valid primary account number from the primary account number information.
According to the method, the terminal generates the new track data containing the application ciphertext, the random number and the interaction counter according to the acquired track data containing the card information, and reports the new track data to the payee, and the payee can verify the application ciphertext, the random number and the interaction counter in the new track data.
Drawings
FIG. 1 is a flow chart of a method of constructing track data according to embodiment 1 of the present invention;
FIG. 2 is a flow chart of a method of constructing track data according to embodiment 2 of the present invention;
FIG. 3 is a thread diagram of a method of constructing track data according to embodiment 3 of the present invention;
fig. 4 is a block diagram showing the structure of a terminal for constructing track data according to embodiment 4 of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
According to embodiment 1 of the present invention, there is provided a method of constructing track data, as shown in fig. 1, including:
step s1: the terminal acquires card information, and acquires a random number range and a first random number set by the terminal; generating a first variable according to the first random number and the random number range; generating a second random number according to the first variable, the first random number and the card information;
step s2: the terminal obtains an application ciphertext generating instruction according to the second random number and sends the application ciphertext generating instruction to the card;
step s3: the terminal waits for receiving the generated application ciphertext response returned by the card, judges whether the generated application ciphertext response returned by the card is received or not, and if yes, executes step s4; otherwise, reporting errors, and failing to construct track data;
step s4: the terminal acquires an interaction counter and an application ciphertext from the generated application ciphertext response;
step s5: the terminal acquires service code information, year and month information of application expiration date and an effective main account number in the card information; filling track information according to the effective main account number, the year and month information of the application expiration date, the service code information, the second random number, the application ciphertext and the interaction counter;
step s6: the terminal uses the filled track information as the acquired track data and ends.
Optionally, step s1 further includes, before:
the terminal sends a reading and recording instruction to the card, judges whether a reading and recording response returned by the card is received, and if yes, executes step s1; otherwise, judging whether the preset time is exceeded, if yes, reporting errors, and constructing track data fails; if not, continuing to wait for receiving the read record response returned by the card.
Optionally, step s1 specifically includes:
the terminal acquires card information, key information in the card information and a random number range and a first random number set by the terminal; and performing modular operation on the random number range by using the first random number to obtain a modular result, and setting the modular result as a first variable.
Optionally, the key information in the card information includes: application validation date, application expiration date, primary account information, and two-track equivalent data.
Optionally, step s2 specifically includes:
the terminal calculates and obtains a first result according to the application effective date and a first variable; and saving the first result into the first random number to generate a second random number.
Optionally, step s2 specifically includes:
the terminal stores the second random number in a data field of the first generation application ciphertext instruction to obtain a generation application ciphertext instruction, and sends the generation application ciphertext instruction to the card;
optionally, in step s3, before the terminal does not receive the response of the card to generate the application ciphertext, the method further includes: judging whether the preset time is exceeded by the terminal, if yes, reporting errors, and failing to construct the track data; if not, the step s3 is continued.
Optionally, after the step s3 is determined to be yes, before executing the step s4, the method further includes:
the terminal judges whether the received generated application ciphertext response contains an interaction counter and an application ciphertext, if so, the step s4 is executed; otherwise, reporting error, and constructing track data fails.
Optionally, step s5 specifically includes:
step s5-1: the terminal acquires service code information from the two-track equivalent data, acquires year and month information from the application failure date, and acquires a valid primary account number from the primary account number information;
step s5-2: the terminal fills track information according to the valid primary account number, the year and month information of the application expiration date, the service code information, the second random number, the application ciphertext and the interaction counter.
Example 2
According to embodiment 2 of the present invention, there is provided a method of constructing track data, as shown in fig. 2, including:
step 201: the terminal acquires card information from the card;
optionally, step 201 specifically includes: the terminal sends a reading and recording instruction to the card, receives a reading and recording response returned by the card, and acquires card information from the reading and recording response;
optionally, the card information acquired by the terminal includes: application validation date, application expiration date, primary account information, two-track equivalent data and the like; the application effective date, the application expiration date, the primary account information and the two-track equivalent data are key data in the card information;
for example: the terminal sends a reading and recording instruction to the card and receives a reading and recording response 70 81 B8 5F 20 05 55 53 45 52 31 8C 1B 9F 02 06 9F 03 06 9F 1A 02 95 05 5F 2A 02 9A 03 9C 01 9F37 04 9F 6E 04 9F 34 03 8D 1D 8A 02 9F 02 06 9F 03 06 9F 1A 02 95 05 5F 2A 02 9A 03 9C 01 9F37 04 9F 6E 04 9F 34 03 9F 70 020000 9F 08 020001 9F 07 02FF 00 5F 28 02 06 20 9F 42 02 09 78 8E 12 00000000000000 00 42 03 41 03 5E 03 1F 03 0000 5F2503101004 5F2403491231 5A08373412345678904F 5F 34 0100 9F 0D 05 0000000000 9F 0E 05 0000000000 9F 0F 05 0000000000 5713373412345678904D491270200000000000000F 90 00 returned by the card; wherein 5F2503101004 5F2403491231 is an application expiration date and an application validation date; 5A08373412345678904F is the primary account number; 5713373412345678904D491270200000000000000F is two-track equivalent data.
Step 202: the terminal judges whether the acquired card information accords with preset conditions, if so, the step 203 is executed; otherwise, reporting error, and failing to construct track data;
optionally, step 202 specifically includes: the terminal judges whether the key data in the acquired card information accords with a preset format, if so, the step 203 is executed; otherwise, reporting error, and failing to construct track data;
for example: the terminal judges whether the application effective date, the application expiration date, the two-track equivalent data and the primary account information in the acquired card information all accord with a preset format, and if so, step 203 is executed; otherwise, reporting error, and failing to construct track data;
for example: application validation date: 5F2503101004, YMMDD format date was obtained: 101004, namely 10.04 in 2010, is a legal date format, and the application effective date accords with a preset format;
application expiration date: 5F2403491231, YMMDD format date was obtained: 491231, namely 2049, 12 and 31, is a legal date format, and the application expiration date accords with a preset format;
two-track equivalent data: 5713373412345678904D491270200000000000000F, the data length is 19 or less, is legal data.
Primary account information: 5A08373412345678904F, the data length is less than or equal to 10, is legal data.
Step 203: the terminal acquires a random number range configured by the terminal and a first random number, and calculates a first variable according to the first random number and the random number range;
optionally, step 203 specifically includes: the terminal acquires a random number Range UN Range configured by a user at the terminal, and acquires a first random number generated by the terminal in the interaction process; the terminal performs modular operation on the range of the random number by the first random number to obtain a modular result, and the modular result is set as a first variable;
optionally, the first variable rnm=un mod (UN range+1).
Alternatively, in the present embodiment, the random number Range UN Range defaults to a Range of 0 to 60.
For example: UN (9F 37) = 4D F8AE9C UN Range =60;
first variable rnm=29= (0 x4DF8AE 9C) mod (60+1).
Step 204: the terminal acquires a preset part of the effective date of the card application from the card information; calculating a first result according to a preset part of the effective date of the card application and the first variable; saving the first result to the first random number to generate a second random number;
optionally, in this embodiment, the preset portion for acquiring the date of validity of the card application is a year and month (YYMM) portion for acquiring the date of validity of the card application.
Optionally, the calculating the first result according to the preset part of the card application effective date and the first variable is specifically: the terminal calculates the month number of the card application effective date minus the first variable unit to obtain a first result, and the first result is stored in a first random number to obtain a second random number;
for example: application validation date (5F 25) =yymmdd= 101004; obtaining YYMM fractions, wherein: yy=10, mm=10; rnm=29, converting RNM to YYMM format, wherein: yy=2=29/12; mm=5=29mod 12
Thus yy=8=10-2, mm=5=10-5
Obtaining a second random number un=0805
Optionally, the second random number is in a format of 0000YYMM; thus, the second random number un= 00000805 is obtained.
Step 205: the terminal fills the second random number into a data field for generating an application ciphertext instruction according to the requirement of card return;
optionally, the terminal fills the second random number into the generated data field of the application ciphertext instruction according to the data format requirement returned by the card;
for example: 80AE 40 00 24 00000000 15 00000000000000 000080 00000000 09 78 18 09 27 000000 0805 58 000000 3F 0000 00;
wherein 00000805 is a second random number.
Step 206: the terminal sends an application ciphertext generation instruction to the card, judges whether a response returned by the card is received, and if so, executes step 207; otherwise, reporting error, and ending the construction failure of the track data;
optionally, in step 206, when the terminal does not accept the response returned by the card, the method further includes: judging whether the preset time is exceeded by the terminal, if yes, reporting errors, and ending the construction failure of the track data; otherwise, go on to step 206;
step 207: the terminal judges whether the response returned by the card meets the preset condition, if so, step 208 is executed; otherwise, reporting error, and ending the construction failure of the track data;
optionally, step 207 specifically includes:
the terminal judges whether the response data returned by the card meets a preset format, and if so, step 208 is executed; otherwise, reporting error, and ending the construction failure of the track data;
further, the terminal judges whether response data returned by the card comprise an interaction counter and an application ciphertext, and if so, the response data returned by the card accords with a preset format; otherwise, the response data returned by the card does not accord with the preset format;
for example: the response data returned by the card are: 77 1E 9F 27 01 88 9F36020001 9F26086C4B03B516C0A9F5 9F 10 07 06 01 02 03 A0 0000 90 00, wherein 9f36020001 is an interaction counter; 9F26086C4B03B516C0A9F5 is the application ciphertext, and thus conforms to the predetermined format, and step s108 is performed.
Step 208: the terminal acquires an interaction counter and an application ciphertext in a response returned by the card;
specifically, the terminal acquires the interaction counter 9f36020001 and the application ciphertext 9F26086C4B03B516C0A9F5 from the response data 77 1E 9F 27 01 88 9F36020001 9F26086C4B03B516C0A9F5 9F 10 07 06 01 02 03 A0 0000 90 00 returned from the card.
Step 209: the terminal acquires service code information, year and month information and an effective account number from key data of card information, and fills track information according to the effective main account number, an application expiration date year and month information part, a service code, a second random number, an application ciphertext and an interaction counter;
optionally, step 209 specifically includes: the terminal acquires service code information from the two-track equivalent data, acquires year and month information from the application expiration date, and acquires an effective primary account number from the primary account number information; filling track information according to the valid primary account number, the application expiration date and month information part, the service code, the second random number, the application ciphertext and the interaction counter;
optionally, step 209 specifically includes: the terminal acquires service code information in the two-track equivalent data, acquires year and month information from the application expiration date, acquires an effective primary account number from the primary account number information, and adds'; 'as a start identifier, a valid primary account number is added, a separator' = ', an expiration date, year and month information part is added, a service code is added, a second random number is added, an ciphertext is added, an interaction counter is added, and an end identifier'? 'A';
for example: the application expiration date is 5F2403491231, wherein the year and month information is 4912; the two-track equivalent data is 5713373412345678904D491270200000000000000F, wherein the service code is 702; the primary account number information is 5a08373412345678904F, wherein the effective primary account number is 373412345678904; the interaction counter is 9F36020001 data, and the data is 0001; converting the interaction counter into five digits of 00001; the application ciphertext is 9F26086C4B03B516C0A9F5 data; the 3 bytes C0A9F5 after the sampling are converted into 10 system: 12626421; take the 5-bit number from the lowest order: 26421;
optionally, the track information obtained by filling according to the rule is:
;373412345678904=491270208052642100001?
step 210: and the terminal takes the track information obtained after filling as the acquired track data and ends.
Example 3
According to embodiment 3 of the present invention, there is provided a method of constructing track data, including:
step 301: the terminal is started, whether a card is detected or not is judged, and if yes, step 302 is executed; otherwise, go on to step 301;
step 302: the terminal selects application, initializes card application and reads card application data;
step 303: the terminal performs offline data authentication, processing restriction, cardholder identity authentication and terminal risk management operation on the card;
step 304: the terminal judges whether the card is interacted in a magnetic stripe mode, if so, the step 305 is executed; otherwise, go to step 306;
step 305: the terminal generates a new terminal random number by using the terminal random number, the random number range and the card application effective date, and step 306 is executed;
step 306: the terminal analyzes the terminal behavior and fills the random number and other data into the application ciphertext instruction according to the format required by the card;
step 307: the terminal sends an application ciphertext instruction to the card, receives an application ciphertext response returned by the card, judges whether online authorization is needed, and if yes, executes step 308; otherwise, the terminal completes interaction according to the interaction result determined by the terminal and the card together, and ends;
step 308: the terminal constructs track data by using random numbers, application ciphertext, interaction counters, application expiration dates, primary account numbers and two-track equivalent data;
step 309: the terminal generates an online request message according to the data such as the interaction amount, the random number, the country code, the currency code, the track data, the application ciphertext, the application interaction characteristic data, the interaction counter, the interaction date, the interaction time, the interaction type and the like, and sends the online request message to the server;
step 310: the server receives the online request message, judges whether necessary data is complete, if yes, executes step 311; otherwise, the online authorization result is set as rejection, and step 314 is executed;
step 311: the server calculates an application ciphertext according to the data in the authorization request message and the card data stored in the background; judging whether the application ciphertext in the authorization request message is consistent with the calculated application ciphertext, and if so, executing step 312; otherwise, the online authorization result is set as rejection, and step 314 is executed;
step 312: the server converts the three-byte data after the application ciphertext into numbers, takes 5 numbers from the lowest bit, takes corresponding application ciphertext digital data in the track data in the online authorization request message, compares whether the application ciphertext digital data are consistent, and if so, executes step 313; otherwise, the connection authorization result is set as rejection, and step 314 is executed;
step 313: the server acquires the primary account number in the track data in the request message, acquires background account number information corresponding to the primary account number according to the primary account number, acquires the amount according to the background account number information, judges whether the amount in the background account number information is consistent with the interaction amount, if so, sets the online authorization result as approval, and executes step s314; otherwise, the online authorization result is set as rejection, and step 314 is executed;
step 314: the server generates an online authorization response message and returns the online authorization response message to the terminal;
step 315: and the terminal completes interaction according to the online authorization response message.
Example 4
According to embodiment 4 of the present invention, there is provided a terminal for constructing track data, including:
the acquiring module 401 is configured to acquire card information, and acquire a random number range and a first random number set by the terminal;
a generating module 402, configured to generate a first variable according to the first random number and the random number range acquired by the acquiring module 401; the method comprises the steps of generating a second random number according to a first variable, the first random number acquired by an acquisition module 401 and card information;
the generating module 402 is further configured to obtain an application ciphertext instruction according to the second random number;
a sending module 403, configured to send the generated application ciphertext instruction obtained by the generating module 402 to a card;
the receiving module 404 is configured to receive a response of the generated application ciphertext returned by the card;
a judging module 405, configured to judge whether the receiving module 404 receives a response of the generated application ciphertext returned by the card;
the error reporting module 406 is configured to report an error when the judging module 405 judges that the receiving module 404 does not receive the response of the generated application ciphertext returned by the card;
the obtaining module 401 is further configured to obtain, when the receiving module 404 receives the response of the generated application ciphertext returned by the card, an interaction counter and an application ciphertext from the response of the generated application ciphertext;
the obtaining module 401 is further configured to obtain service code information, year and month information of an application expiration date, and a valid primary account number in the card information;
the filling module 407 is configured to fill track data according to the valid primary account number acquired by the acquiring module 401, the year and month information of the application expiration date, the service code information, the second random number generated by the generating module 402, the application ciphertext acquired by the acquiring module 401, and the interaction counter, and take the filled track data as the acquired track data.
Optionally, the sending module 403 is further configured to send a read record instruction to the card;
the judging module 405 is further configured to judge whether a read record response returned by the card is received;
the judging module 405 is further configured to judge whether a preset time is exceeded when it is judged that a read record response returned by the card is not received;
the error reporting module 406 is further configured to report an error when the judging module 405 judges that the preset time is exceeded;
the receiving module 404 is further configured to wait for receiving a read record response returned by the card when the judging module 405 judges that the preset time is not exceeded.
Optionally, the obtaining module 401 is specifically configured to obtain card information, obtain key information in the card information, and obtain a random number range set by the obtaining module and a first random number;
the generation module 402 includes:
the operation submodule is used for carrying out modular operation on the random number range by the first random number to obtain a modular result;
and the setting submodule is used for setting the modulus taking result as a first variable.
Optionally, the obtaining module 401 is specifically configured to obtain an application validation date, an application expiration date, primary account information, and two-track equivalent data.
Optionally, the generating module 402 is specifically configured to calculate a first result according to the application effective date and the first variable; and saving the first result into the first random number to generate a second random number.
Optionally, the generating module 402 is specifically configured to save the second random number in a data field of the first generated application cryptogram instruction to obtain the generated application cryptogram instruction.
Optionally, the judging module 405 is further configured to judge whether the preset time is exceeded before the receiving module 404 does not receive the response of the card returning to generate the application ciphertext to report the error;
the error reporting module 406 is configured to report an error when the judging module 405 judges that the preset time is exceeded.
Optionally, the determining module 405 is further configured to determine, when the determining module 405 determines that the receiving module 404 receives the generated application ciphertext response returned by the card, whether the received generated application ciphertext response includes the interaction counter and the application ciphertext.
Optionally, the obtaining module 401 is specifically configured to obtain service code information from the two-track equivalent data, obtain year and month information from the application failure date, and obtain a valid primary account number from the primary account number information.

Claims (16)

1. A method of constructing track data, comprising:
step s1: the terminal acquires card information, and acquires a random number range set by the terminal and a first random number generated by the terminal; generating a first variable according to the first random number and the random number range; generating a second random number according to the first variable, the first random number and key information of the card information;
step s2: the terminal obtains an application ciphertext generating instruction according to the second random number and sends the application ciphertext generating instruction to a card;
step s3: the terminal waits for receiving the generated application ciphertext response returned by the card, judges whether the generated application ciphertext response returned by the card is received or not, and if yes, executes step s4; otherwise, reporting errors, and failing to construct track data;
step s4: the terminal acquires an interaction counter and an application ciphertext from the generated application ciphertext response;
step s5: the terminal acquires service code information, year and month information of application expiration date and an effective primary account number in the card information; splicing the effective main account number, the year and month information of the application expiration date, the service code information, the second random number, the application ciphertext and the interaction counter, and filling track information;
step s6: the terminal takes the filled track information as the acquired track data and ends;
the step s2 specifically includes:
and the terminal fills the second random number into a data field of an application ciphertext generation instruction according to the requirement of the card to obtain the application ciphertext generation instruction, and sends the application ciphertext generation instruction to the card.
2. The method according to claim 1, wherein the step s1 is preceded by the further steps of:
the terminal sends a reading and recording instruction to the card, judges whether a reading and recording response returned by the card is received or not, and if yes, executes step s1; otherwise, judging whether the preset time is exceeded, if yes, reporting errors, and constructing track data fails; and if the read record response returned by the card is not exceeded, continuing to wait for receiving the read record response returned by the card.
3. The method according to claim 1, wherein the step s1 is specifically:
the terminal acquires card information, key information in the card information, a random number range set by the terminal and a first random number generated by the terminal; and performing modular operation on the random number range by using the first random number to obtain a modular result, setting the modular result as the first variable, and generating a second random number according to the first variable, the first random number and key information in the card information.
4. The method of claim 3, wherein the key information in the card information comprises: application validation date, application expiration date, primary account information, and two-track equivalent data.
5. The method of claim 4, wherein generating a second random number in step s1 based on the first variable, the first random number, and the card information is specifically:
the terminal calculates and obtains a first result according to the application effective date and a first variable; and saving the first result into the first random number to generate the second random number.
6. The method of claim 1, wherein in step s3, before the terminal does not receive the response of the card to generate the application ciphertext, the method further comprises: the terminal judges whether the preset time is exceeded or not, if yes, the error is reported, and the construction of the track data fails; if not, the step s3 is continued.
7. The method of claim 6, wherein after the step s3 of determining yes, further comprising, before performing the step s4:
the terminal judges whether the received generated application ciphertext response contains an interaction counter and an application ciphertext, if so, the step s4 is executed; otherwise, reporting error, and constructing track data fails.
8. The method according to claim 4, wherein the step s5 specifically includes:
step s5-1: the terminal acquires service code information from the two-track equivalent data, acquires year and month information from an application failure date and acquires a valid main account number from main account number information;
step s5-2: and the terminal is spliced according to the effective main account number, the year and month information of the application expiration date, the service code information, the second random number, the application ciphertext and the interaction counter to fill track information.
9. A terminal for constructing track data, comprising:
the acquisition module is used for acquiring card information, a random number range set by the terminal and a first random number generated by the terminal;
the generation module is used for generating a first variable according to the first random number and the random number range acquired by the acquisition module; the first random number is used for generating a first random number according to the first variable, the first random number acquired by the acquisition module and key information of the card information;
the generation module is further configured to store the second random number in a data field of a first generated application ciphertext instruction to obtain the generated application ciphertext instruction;
the sending module is used for sending the application ciphertext generating instruction obtained by the generating module to the card;
the receiving module is used for receiving the generated application ciphertext response returned by the card;
the judging module is used for judging whether the receiving module receives the generated application ciphertext response returned by the card or not;
the error reporting module is used for reporting errors when the judging module judges that the receiving module does not receive the response of the generated application ciphertext returned by the card;
the acquisition module is further used for acquiring an interaction counter and an application ciphertext from the generated application ciphertext response when the receiving module receives the generated application ciphertext response returned by the card;
the acquisition module is also used for acquiring service code information, year and month information of application expiration date and effective primary account number in the card information;
and the filling module is used for splicing the effective primary account number acquired by the acquisition module, the year and month information of the application expiration date, the service code information, the second random number generated by the generation module, the application ciphertext acquired by the acquisition module and the interaction counter to fill track data, and taking the filled track data as the acquired track data.
10. The terminal of claim 9, wherein,
the sending module is also used for sending a reading and recording instruction to the card;
the judging module is also used for judging whether a read record response returned by the card is received or not;
the judging module is further used for judging whether the preset time is exceeded or not when judging that the read record response returned by the card is not received;
the error reporting module is further used for reporting errors when the judging module judges that the preset time is exceeded;
and the receiving module is also used for waiting to receive the read record response returned by the card when the judging module judges that the preset time is not exceeded.
11. The terminal of claim 9, wherein,
the acquisition module is specifically used for acquiring the card information, acquiring key information in the card information, acquiring a random number range set by the acquisition module and a first random number generated by the acquisition module;
the generation module comprises:
the operation submodule is used for carrying out modulo operation on the random number range by the first random number to obtain a modulo result;
the setting submodule is used for setting the modulus taking result as the first variable;
and the generation sub-module is used for generating a second random number according to the first variable, the first random number and key information in the card information.
12. The terminal of claim 11, wherein the obtaining module is specifically configured to obtain an application validation date, an application expiration date, primary account information, and two-track equivalent data.
13. The terminal of claim 12, wherein the generating module is specifically configured to calculate a first result according to the application validation date and the first variable; and saving the first result into the first random number to generate the second random number.
14. The terminal of claim 9, wherein the judging module is further configured to judge whether a preset time is exceeded before the receiving module does not receive the response of the generated application ciphertext returned by the card, and the error is reported;
the error reporting module is used for reporting errors when the judging module judges that the preset time is exceeded.
15. The terminal of claim 14, wherein the determining module is further configured to determine whether the received generated application ciphertext response includes an interaction counter and an application ciphertext when the determining module determines that the receiving module receives the generated application ciphertext response returned by the card.
16. The terminal of claim 12, wherein the obtaining module is specifically configured to obtain service code information from the two-track equivalent data, obtain year and month information from the application expiration date, and obtain a valid primary account number from the primary account number information.
CN201911030916.0A 2019-10-28 2019-10-28 Method and terminal for constructing track data Active CN110796443B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911030916.0A CN110796443B (en) 2019-10-28 2019-10-28 Method and terminal for constructing track data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911030916.0A CN110796443B (en) 2019-10-28 2019-10-28 Method and terminal for constructing track data

Publications (2)

Publication Number Publication Date
CN110796443A CN110796443A (en) 2020-02-14
CN110796443B true CN110796443B (en) 2023-09-19

Family

ID=69441670

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911030916.0A Active CN110796443B (en) 2019-10-28 2019-10-28 Method and terminal for constructing track data

Country Status (1)

Country Link
CN (1) CN110796443B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104240387A (en) * 2013-06-21 2014-12-24 北京数码视讯科技股份有限公司 Method and system for processing bank card transaction
CN104603809A (en) * 2012-04-16 2015-05-06 盐技术股份有限公司 Systems and methods for facilitating a transaction using a virtual card on a mobile device
CN107194692A (en) * 2017-05-27 2017-09-22 飞天诚信科技股份有限公司 A kind of method and terminal for obtaining two magnetic track informations of dynamic
GB2551865A (en) * 2017-01-14 2018-01-03 PQ Solutions Ltd Improved stream cipher system
WO2018076365A1 (en) * 2016-10-31 2018-05-03 美的智慧家居科技有限公司 Key negotiation method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104603809A (en) * 2012-04-16 2015-05-06 盐技术股份有限公司 Systems and methods for facilitating a transaction using a virtual card on a mobile device
CN104240387A (en) * 2013-06-21 2014-12-24 北京数码视讯科技股份有限公司 Method and system for processing bank card transaction
WO2018076365A1 (en) * 2016-10-31 2018-05-03 美的智慧家居科技有限公司 Key negotiation method and device
GB2551865A (en) * 2017-01-14 2018-01-03 PQ Solutions Ltd Improved stream cipher system
CN107194692A (en) * 2017-05-27 2017-09-22 飞天诚信科技股份有限公司 A kind of method and terminal for obtaining two magnetic track informations of dynamic

Also Published As

Publication number Publication date
CN110796443A (en) 2020-02-14

Similar Documents

Publication Publication Date Title
JP4742049B2 (en) System and method for generating a digital certificate
CN111861456A (en) 5G message transfer transaction verification method, system and device based on block chain
CN102377570B (en) Method and device for generating dynamic passwords
US20050120217A1 (en) Apparatus, System, and Method for Electronically Signing Electronic Transcripts
EP0855685A2 (en) An electronic lottery system and its operating method and computer-readable recording medium in which the electronic lottery program code is stored
CN103377442B (en) A kind of data processing method and system
US20160314469A1 (en) Method for generating off-line authentication credentials by intelligent card
CN110210270B (en) Two-dimensional code information security reinforcement method and system and two-dimensional code image analysis method and system
CN110175838A (en) Offline barcode scanning method of payment and offline barcode scanning payment mechanism
CN108900311A (en) A kind of no certificate bluetooth key endorsement method and system
CN101964710B (en) Digital signature and signature authenticating method
CN107730253B (en) Offline transaction aging management method and device
CN110796443B (en) Method and terminal for constructing track data
CN110443927A (en) Passwords of visitors generation method, verification method, server and intelligent door lock
CN103578009A (en) Terminals, coupon management server, coupon use system and coupon use method
CN110585728A (en) Method, system and mobile terminal for preventing mobile phone game from excessive recharge
CN102905237A (en) Enhanced short message verification code
CN110599272B (en) Method for issuing electronic invoice and related products
CN112396418A (en) Information processing method, device and system
CN111861435A (en) Remote payment method and system for realizing user cash withdrawal
CN112950226A (en) Industrial and commercial cluster registration method and device, electronic equipment and readable storage medium
CN111950284A (en) Method, system, equipment and storage medium for recording list and automatically identifying sender real name information
CN114896582B (en) Off-line authentication method for paper invoice
CN117170656B (en) Low-code business form design system based on data visualization
CN115941186B (en) Quantum cracking resistant multi-credential verification method and device and nonvolatile storage medium

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