The smart card is not responding to a reset

2

I have been working of the read / write operation of smart cards, I believe my card is sle_4428 and I am using HID OMNIKEY 3121 USB Card Reader. The problem is that when I enter card in card reader my program responds as the smart card is not responding to a reset with error code 0x80100066, instead of connecting the card and getting ATR...

[EDIT] It works fine if I do only the read operation. When I do the write operation and then reinsert the card it stops responding, giving the above message. The APDU command I use to write is: FF D6 00 00 #(01 02)

smartcard
smartcard-reader
pcsc
asked on Stack Overflow Aug 1, 2017 by Darab Javaid • edited Aug 6, 2017 by Maarten Bodewes

1 Answer

1

Your problem is that HID Omnikey failes to properly "cold" reset smart card.

With the following Java code-snipped, you can reset HID Omnikey reader CL.

import jnasmartcardio.Smartcardio;

import javax.smartcardio.*;
import javax.xml.bind.DatatypeConverter;

public class OMNIKEYConfiguration {

public static void main(String... args) throws Exception {
    TerminalFactory factory = TerminalFactory.getInstance("PC/SC", null, new Smartcardio());

    String terminalName = "OMNIKEY CardMan 5x21-CL 0";
    CardTerminal terminal = factory.terminals().getTerminal(terminalName);

    // Connect directly to reader
    Card card = terminal.connect("DIRECT");

    int code = 3224092; // #define IOCTL_CCID_ESCAPE SCARD_CTL_CODE(3500)
    byte[] command = DatatypeConverter.parseHexBinary("0300"); // 0300 - ON; 0301 - OFF
    byte[] resp = card.transmitControlCommand(code, command);
    System.out.println(DatatypeConverter.printHexBinary(resp));

    card.disconnect(true);
}
}

Use command "0x0300" to turn ON antenna, otherwise use "0x0301" to turn OFF antenna.

For cold reset call OFF and then ON commands.

answered on Stack Overflow Nov 2, 2017 by TomazStoiljkovic

User contributions licensed under CC BY-SA 3.0