Get your IBAN from your emv card

I have some problems reading the IBAN number from German CashCards (also known as Geldkarte). I can communicate with my card, and I get some information from it. but I don’t know which commandApdu should I send to the card to get the IBAN number ...

The application runs on Java 7 and I use java.smartcardio api Protocol equal to T = 1

my apdu command to get the date is as follows:

byte[] commandBytes = new byte[]{0x00, (byte)0xa4, 0x04, 0x00, 0x07, (byte)0xa0, 0x00, 0x00, 0x00,0x04, 0x30, 0x60, 0x00};

The information I receive:

6F 32 84 07 A0 00 00 00 04 30 60 A5 27 50 07 4D 61 65 73 74 72 6F 87 01 03 9F 38 09 9F 33 02 9F 35 01 9F 40 01 5F 2D 04 64 65 65 6E BF 0C 05 9F 4D 02 19 0A 

Can someone tell me the correct update for getting an IBAN number?

I'm sorry if I missed some necessary information, but this is my first question on this board :-)

+3
3

: , ( ):

private static byte[] aidWithPossibleIban = new byte[] { 0x00, (byte) 0xa4,
            0x04, 0x00, 0x09, (byte) 0xa0, 0x00, 0x00, 0x00, 0x59, 0x45, 0x43,
            0x01, 0x00, 0x00 };

:

private static byte[] cmdRaiseSecurityLevel = new byte[] { 0x00, 0x22,
            (byte) 0xf3, 0x02 };

, , :

private static byte[] readSelectedRecord = new byte[] { 0x00, (byte) 0xb2,
            0x01, (byte) 0xa4, 0x00 };

Andreas

0

, :

6F328407A0000000043060A52750074D61657374726F8701039F38099F33029F35019F40015F2D046465656EBF0C059F4D02190A

:

6F File Control Information (FCI) Template
    84 Dedicated File (DF) Name
        A0000000043060
    A5 File Control Information (FCI) Proprietary Template
        50 Application Label
            M a e s t r o
        87 Application Priority Indicator
            03
        9F38 Processing Options Data Object List (PDOL)
            9F33029F35019F4001
        5F2D Language Preference
            d e e n
        BF0C File Control Information (FCI) Issuer Discretionary Data
            9F4D Log Entry
                190A

, , " ", , ( , , , IBAN ( , )). " " EMV 3, psuedocode , Read Record, NUM_SFIS 5 NUM_RECORDS 16, .

for (int sfiNum = 1; sfiNum <= NUM_SFIS; sfiNum++) 
{ 
    for (int rec = 1; rec <= NUM_RECORDS; rec++) 
    {
          byte[] response = tag.transceive(new byte[]{0x00,(byte)0xB2 (byte)rec, (byte)((byte)(sfiNum << 3) | 4), 0x00});
    }
}
0

, IBAN, , .

IBAN - , . IBAN , ,

Since in the records we find the country code (DE), Bankleitzahl BLZ (8 digits) and account number (10 digits), the check digit can be calculated through

 public string ReturnIBAN(string lkz, string blz, string kntnr, bool groupedReturn = true)
    {
        string bban = string.Empty;

        lkz = lkz.ToUpper();
        switch (lkz)
        {
            case "AT":
                {
                    bban = blz.PadLeft(5, '0') + kntnr.PadLeft(11, '0');
                }
                break;
            case "DE":
                {
                    bban = blz.PadLeft(8, '0') + kntnr.PadLeft(10, '0');
                }
                break;
            case "CH":
                {
                    bban = blz.PadLeft(5, '0') + kntnr.PadLeft(12, '0');
                }
                break;
        }
        string sum = bban + lkz.Aggregate("", (current, c) => current + (c - 55).ToString()) + "00";

        var d = decimal.Parse(sum);
        var checksum = 98 - (d % 97);
        string iban = lkz + checksum.ToString().PadLeft(2, '0') + bban;
        return groupedReturn ? iban.Select((c, i) => (i % 4 == 3) ? c + " " : c + "").Aggregate("", (current, c) => current + c) : iban;
    }

Source (in German): here

0
source

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


All Articles