我可以在 Android 上从 PB 的 Tactivo 智能卡读卡器读取智能卡,但不熟悉验证过程。这是我必须阅读输入的示例:
...
channel = card.getBasicChannel();
// See www.globalplatform.org for more information about this command.
// CLA = 0x80
// INS = 0xCa
// P1 = 0x9F
// P2 = 0x7F
// Le = 0x00
CommandAPDU GET_DATA_CardProductionLifeCycle = new CommandAPDU(0x80, 0xCA, 0x9F, 0x7F, 0x00);
ResponseAPDU cardResponse;
// Send the command to the card
cardResponse = channel.transmit(GET_DATA_CardProductionLifeCycle);
// Check SW1 if we provided wrong Le
if (cardResponse.getSW1() == 0x6C) {
// Modify the command with correct Le reported by the card in SW2.
GET_DATA_CardProductionLifeCycle = new CommandAPDU(0x80, 0xCA, 0x9F, 0x7F, cardResponse.getSW2());
// Re-send the command but now with correct Le
cardResponse = channel.transmit(GET_DATA_CardProductionLifeCycle);
}
// Check if the card has data for us to collect
if (cardResponse.getSW1() == 0x61) {
// Issue a GET RESPONSE command using SW2 as Le
CommandAPDU GET_RESPONSE = new CommandAPDU(0x00, 0xC0, 0x00, 0x00, cardResponse.getSW2());
cardResponse = channel.transmit(GET_RESPONSE);
}
// Check the final result of the GET DATA CPLC command
if (cardResponse.getSW() != 0x9000) {
// The card does not support Global Platform
System.out.println(String.format("8Card responded with SW:%04x", cardResponse.getSW()));// some sort of SW from the card here... Read as "SW: 6a82
System.out.println("9This card does not support the Global Platform " + "GET CPLC command");
return;
}
// we do not validate the data in this example - we assume that it is
// correct...
...
如果有人在智能卡/CAC 卡验证/身份验证方面有经验,请给我一些指导、示例或可以解决的问题。因为那里的文档很少。
更新:我有一个想要使用智能卡保护的 Android 应用程序。我可以使用 Precise Biometrics Tactivo 智能卡读卡器读取任何智能卡的输入。如何验证/验证此输入以仅允许某些用户访问应用程序?