PBOC-based e-Wallet consumption and transaction process

Source: Internet
Author: User

For the consumption and transaction process of the smart wallet used in the smart card finance industry, developers can refer

First, the terminal and the card have a common key called the consumption key: purchkey

Assume purchkey = 11223344556677888877665544332211

When security conditions are met:

Step 1: The terminal sends the consumption initialization command to the card:

APDU: 80 50 001 02 0b 01 00001000 001122334455

TLS ins P1 P2 LC keyindex transaction amount terminal No.

 

The card returns the following 15 bytes of data (excluding 9000 ):

00000000 0000 000000 01 00 11223344

Card balance transaction No. overdraft quota key version number algorithm ID Random Number

 

The calculation process of mac1 is as follows (terminal ):

1. computing process key: sessionkey

Inputdata =11223344 0000 0001
(8 bytes)

Random Number card offline transaction No. Terminal transaction No. last four digits

Purchkey = 11223344556677888877665544332211

 

Sessionkey =3 desenypt (inputdata,Purchkey) =003238ab1_659dd

Use loadkey to encrypt inputdata with 3DES

 

2. Calculate mac1

Inputdata1 =00001000 06 001122334455 20120229135100

Transaction amount transaction type terminal number Date and Time

Sessionkey = 003238ab1_659dd

 

Mac1 =MAC (inputdata1 sessionkey)= F15cab75

Use sessionkey to perform Mac operations on inputdata1

 

Step 2: The terminal sends the consumption command to the card:

 APDU: 80 54 01 00 0f 00000001 20111221214822 3a845bf0

L4 ins P1 P2 LC terminal transaction No. Transaction date and time mac1

 

The card calculates mac1 in the same way and verifies that mac1 sent from the terminal is correct to confirm that the terminal is legal. If mac1 verification fails, the card returns a Mac error to terminate the transaction. If mac1 passes verification, perform step 3.

 

Step 3: change the balance of the card, add 1 to the offline transaction number, calculate mac2 and tac, and return it to the terminal.

Computing Mac

Inputdata2 =00001000

Transaction amount

Sessionkey = 003238ab1_659dd

Mac2 =MAC (inputdata2 sessionkey)= 88a13

Use sessionkey to perform Mac operations on inputdata2

Calculate tac

The card and terminal also have a common key TAC key: tackey

Assume tackey = 00112233445566778899 aabbccddeeff

Tacsessionkey =XOR (left (8), right (8 ))= 8888888888888888

About 8 bytes of tackey for exclusive or operation

 

Inputdata3 =00001000 01 001122334455 00000001 20111221 214822

Transaction amount transaction type terminal No. Terminal transaction No. Transaction date transaction time

Tac = MAC (inputdata3, tacsessionkey) = 3ff7a28a

 

Mac2 and TAC are returned to the terminal as the data returned by the consumption command, and the consumption transaction ends now,

As an important basis for verifying the authenticity and integrity of transaction data during liquidation, TAC is stored on the terminal together with transaction records.

 

Cao Kun

2012-03-01

Caokun_8341@sina.com

Qq 1, 87193978

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.