我正在用 Java 读取智能卡。当我执行下面的代码时,卡返回 6985(不满足使用条件)作为结果。
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());
客户端提供的参数有:
- CLA = 00
- INS = A4
- P1 = 00
- P2 = 0℃
- LC = 02
- Data = XXXX(这里传递的数据是文件标识符),因为我要选择EF文件所以客户端给的文件的EFID是0002