SmartCardIO EMV Reader, find my card type with ATR number only

I am starting a new project, but I am using an EMV reader and Javax SmartCardIO.

I have a RID list for each type of card, but the only thing I can get without knowing the type of card is ATR, I am wondering if there is a way to get RID or card type using just this information, any help is appreciated.

Thanks in advance!

EDIT:

I tried to execute the select PSE command with this method:

public static byte[] selectPSE(CardChannel channel) throws CardException { byte[] selectPSE = {(byte)0x00, (byte)0xA4, (byte)0x04, (byte)0x00, (byte)0x0E, (byte)0x31, (byte)0x50, (byte)0x41, (byte)0x59, (byte)0x2E, (byte)0x53, (byte)0x59, (byte)0x53, (byte)0x2E, (byte)0x44, (byte)0x44, (byte)0x46, (byte)0x30, (byte)0x31}; CommandAPDU command = new CommandAPDU(selectPSE); ResponseAPDU response = channel.transmit(command); System.out.println(response.getBytes()); return response.getBytes(); } 

However, it only works with AMEX and Visa, I get error 6a82 with two MasterCard cards (credit and debit).

It looks very strange, as far as I know, all major card issuers (including MasterCard) use 1PAY.SYS.DDF01, I can get the information I want using Try and Error of AID, but I do not think this is the best decision.

+2
source share
2 answers

Unable to get RID values ​​from card with ATR. ATR is used to identify the hardware and software of the card, it is not used to obtain information about installed applications (visa, visa electron, mastercard, etc.) https://eftlab.com/index.php/site-map/knowledge- base / 212-emv-rid

There is one way to get installed applications by reading the payment system environment (PSE). You can send Read PSE commands to contact cards and Read ProSimity PSE for contactless cards

Contact PSE:

00A404000E315041592E5359532E4444463031

Contactless PPSE:

00A404000E325041592E5359532E444446303100

And then you have to parse if more than one installed application is installed.

+5
source

AID (application identifier) ​​= RID (registered application identifier) ​​|| PIX (Property Application Extension)

The best way to find out which application is installed on the map is to make a Select PSE . Detailed description in EMV Book 1, 12 Application Selection, 12.3.2 Using PSE .

The complete algorithm, which you can find in Figure 17: Terminal Logic Using Directories.

Fast algorithm:

1) Command Select PSE or PPSE.

  Send: 00 A4 04 00 0E 31 50 41 59 2E 53 59 53 2E 44 44 46 30 31 00 Responce will will contain: '6F' FCI Template M '84' DF Name M 'A5' FCI Proprietary Template M '88' SFI of the Directory Elementary File M '5F2D' Language Preference O '9F11' Issuer Code Table Index O 'BF0C' FCI Issuer Discretionary Data O 

Here you can find the SFI PSE.

2) ReadRecord 1 SFI X Command

  Send: 00 B2 01 0C 00 Receive list of tag. '70' Application Elementary File (AEF) Data Template '61' Application Template '70' Application Elementary File (AEF) Data Template '61' Application Template '4F' Application Identifier (AID) '50' Application Label ... and so on 

Look at the tag '4F' Application Identifier (AID). From it you can extract and compare the RID.

You can also:

1) Get your own AID list and serial SELECT application from it.

2) CHOOSE Default or Following Applications and get the AID from the response.

+5
source

Source: https://habr.com/ru/post/1269396/


All Articles