简体   繁体   中英

Can't select Application in EMV card using valid AID

I have both a Visa Electron and Debit Mastercard, however whenever i try to select the Application using their respective AIDs A0000000032010 and A0000000041010 I get a 6A82 response meaning the file was not found.

Here's my code snippet for both selections

//SELECTING VISA ELECRON CARD APPLICATION
byte[] ApduCMDVC = new byte[] {  (byte) 0x00, (byte) 0xA4, (byte) 0x04,
            (byte) 0x00, (byte) 0x0E,
            (byte) 0x41, (byte)0x30, (byte) 0x30, (byte) 0x30,
            (byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,
            (byte) 0x33,(byte) 0x32,(byte) 0x30,(byte) 0x31,(byte) 0x30};

//SELECTING MASTER CARD APPLICATION
byte[] ApduCMDMC = new byte[] {  (byte) 0x00, (byte) 0xA4, (byte) 0x04,
            (byte) 0x00, (byte) 0x0E,
            (byte) 0x41, (byte)0x30, (byte) 0x30, (byte) 0x30,
            (byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,(byte) 0x30,
            (byte) 0x34,(byte) 0x31,(byte) 0x30,(byte) 0x31,(byte) 0x30};

Could there be something I'm doing wrong?

I looked back at some C++ code I used for this in the past, and I believe your problem is that you are sending the AID in ASCII, as opposed to binary. Here's the C++ byte array I use:

static  BYTE    selectAIDCmd[] = {0x00, 0xA4, 0x04, 0x00, 0x07, 0xA0, 0x00, 0x00, 0x00, 0x04, 0x10, 0x10 };

So, you need this:

    byte[] ApduCMDMC = new byte[] {  (byte) 0x00, (byte) 0xA4, (byte) 0x04,
        (byte) 0x00, (byte) 0x07,
        (byte) 0xA0, (byte)0x00, (byte) 0x00, (byte) 0x00, (byte)0x03,(byte) 0x20,(byte) 0x10};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM