Application creation list of PBOC/EMV

Source: Internet
Author: User

Reprinted please indicate the source

Author: Pony

 

There are two ways to create an Application List: the PSE directory selection method and the aid selection method. The latter is relatively simple and easy to understand. This article only introduces the directory selection method.

 

The steps are as follows:

1. Select PSE from the terminal and read SFI from the FCI returned by the card.

PSE itself is an EF file, so it is located through SFI. The EF file is composed of many records and is read through read record. the number of records is not certain. The terminal should keep reading from the first record and keep reading the card and return 6a83. format:

2. The terminal reads all records in SFI through read record. every time you read a record, go to the portal. we can see that each record is a T (70) LV, which contains many T (61) LV records. The terminal must handle this nested structure. the V (that is, the entry) of the T (61) LV may be the ADF or DDF. for example:

 

Note that the order of tags in the above two images may not be fixed. for example, in the second figure, the tag '4f 'can appear after '50. I used to think that the Order was fixed until the case of EMV L2 was upgraded in 2012.12.1. I added a case dedicated to test this, so that I could know that this order can be changed. this case is written as follows:

 

Objective:

To ensure that the terminal accepts a response to read record on

A payment ststem directory file with data stored in an order different

From example given in EMV specifications.

Bytes ----------------------------------------------------------------------------------------------------------

Conditions:

Lt returns ADF entry format data in response to read

Record of the payment system directory in that order: '50'

Application label, '9f12' application preferred name, '4f 'ADF

Name and '87 'application priority indicator

 

 

If the entry is an ADF, It's easy. Just take the 4f value and point the index to the next one. the difficulty is that, if it is DDF, the terminal selects this DDF, obtains SFI in FCI, and then reads the records in this SFI. here, we can see that the entrance is DDF, which is equivalent to returning to step 1, but changing the PSE to DDF.

In this case, you need to save the breakpoint information before DDF processing, so that after processing the DDF, you can continue the current processing process. this is a bit like a nested interrupt in the CPU. Its principle is to use the stack to save the information at the breakpoint. After the interrupt is processed, the stack is restored. in this process, there are generally two Processing Methods: recursion and non-recursion. recursive methods are simple and easy to read, but inefficient. however, the record formats in the EMV test cases are generally relatively simple and the nesting is not deep. the following is a pseudo-code process. Assume that the function for creating the list is buildlistbyddf.

 

Buildlistbyddf (char * DDF) {select PSE (DDF); read SFI while (read records in SFI do not return 6a83) {If (tag70 succeeded) {If (tag61 succeeded) {If (the retrieved entry is 4f) {compare terminal aid. If they are consistent (partially or completely matched), they are added to the candidate list;} else if (the obtained entry is 9d) {buildlistbyddf (DDF value of 9d); // pay attention to the recursive flag position here; }}if (flag position)/* the flag position is used to re-select the card, after the card is selected recursively, It is restored to the Current Status */{re-select the current DDF and read SFI }}}

3. After step 2, the candidate list is basically established. The last step is to sort the list based on the priority parameters of aid. Generally, an array variable is used to save the Application List, the application with the highest priority can be placed at the beginning of the array. this makes it easy to automatically select the application with the highest priority when the cardholder is not supported.

 

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.