I am working on reading a smart card in Java. When I execute the following code below, the card returns 6985 (Conditions of use not satisfied) as a result.
TerminalFactory factory = TerminalFactory.getDefault();
List<CardTerminal> terminals = factory.terminals().list();
System.out.println("Terminals: " + terminals);
if (terminals != null && !terminals.isEmpty()) {
// Use the first terminal
CardTerminal terminal = terminals.get(0);
// Connect with the card
Card card = terminal.connect("*");
System.out.println("card: " + card);
CardChannel channel = card.getBasicChannel();
CommandAPDU commandAPDU = new CommandAPDU(0x00, 0xA4, 0x00, 0x0C,
new byte[]{0002},0,0x01);
ResponseAPDU responseCheck = channel.transmit(commandApdu);
System.out.println(responseCheck.getSW1()+":"+responseCheck.getSW2()+":"+
commandApdu.toString());
The parameters provided by the client are:
- CLA = 00
- INS = A4
- P1 = 00
- P2 = 0C
- LC = 02
- Data = XXXX (The data passed here is File Identifier),As I want to select EF file so EFID for the file given by client is 0002