pythonsmartcardapdupyscard

APDU 6E00 status for every class


I am new to APDU and smartcard communications and I can't figure out how to successfully send APDU commands. When I try for example this command:

00 A4 00 00 02 3F 00 00

I get a 6E 00 response. I tried to figure out which class I had to use for my card, but for every class I tried in in the range 00-FF, I always get the 'Class not supported' error.

I figured this maybe has to do with some authentication in the card, but I have no idea how to do this right.

I used the following Python (pyscard) code:

from smartcard.System import readers
from smartcard.util import toHexString

r = readers()
con = r[0].createConnection()
con.connect()

for c in range(0x00, 0xFF):
    comm = [c, 0xA4, 0x00, 0x00, 0x02, 0x3F00, 0x00]
    data, sw1, sw2 = con.transmit(comm)

    if sw1 != 0x6e:
        print comm
        print 'Response:'
        print data, '\n'
        print 'Status:'
        print '%x %x' % (sw1, sw2)

EDIT: The ATR of the card is 3B 04 49 32 43 2E


Solution

  • Solved the issue, my card is a I2C card, so the APDU commands won't work with it. I got it working with the Synchronous API of Omnisoft, via C++. Not really what I had in mind, but so far it seems the only option.

    Thanks to all who helped me!