简体   繁体   English

编码APDU命令以验证PIN时出现问题

[英]Problems coding an APDU command to verify PIN

I'm trying to send a VERIFY (pin) command using javax.smartcardio API. 我正在尝试使用javax.smartcardio API发送VERIFY(引脚)命令。 My Pin code is 12345678. 我的密码是12345678。

Based on some examples I've found on the net, I've tried with this APDU: 根据我在网上发现的一些示例,我尝试使用此APDU:

00 20 00 83 08 01 02 03 04 05 06 07 08

but the result is: 69 84 (reference data invalid) . 但结果是: 69 84 (reference data invalid)

I've tried also with: 我也尝试过:

00 20 00 83 08 12 34 56 78

But I still get the same error. 但是我仍然遇到同样的错误。

According to my SmartCart specifications, the card has support for: 根据我的SmartCart规范,该卡支持:

  • ISO 7816 smart cards type A, B and C (5 V, 3 V, 1.8 V) ISO 7816智能卡A,B和C(5 V,3 V,1.8 V)
  • Compatible with communication protocols T=0, T=1 与通讯协议T = 0,T = 1兼容
  • Support for PPS (Protocol and Parameters Selection) 支持PPS(协议和参数选择)

I'm a bit desperate as I cannot find a way out. 我有点绝望,因为我找不到出路。 Can you suggest me some changes to my APDU or even a completely different approach (another library or language to connect with my Smart Card)? 您能建议我对APDU进行一些更改,甚至是完全不同的方法(与我的智能卡连接的另一个库或语言)吗?

Since your card is ISO 7816, please refer the APDU from the following link section 6.12. 由于您的卡是ISO 7816,因此请参考以下链接第6.12节中的APDU。

What you need to do is: 您需要做的是:

  1. Check the reference data (P2) that is used. 检查使用的参考数据(P2)。 For PIN, usually it is '01' or '81'. 对于PIN,通常为“ 01”或“ 81”。 But again, check the correct one from your card supplier. 但再次,请从您的卡供应商处检查正确的卡。
  2. Before doing the actual VERIFY command, try to get the remaining tries first. 在执行实际的VERIFY命令之前,请先尝试获得其余的尝试。 This will help you from locking the PIN, because each false verification reduce your remaining tries. 这将帮助您锁定PIN,因为每次错误验证都会减少您的剩余尝试次数。 This can be done by setting the Lc = '00' and remove your command data. 可以通过设置Lc ='00'并删除命令数据来完成。 The response is SW1='63' and SW2='CX', where X denotes the remaining tries. 响应为SW1 = '63'和SW2 ='CX',其中X表示其余尝试。 APDU command example: 00 20 00 81 00 APDU命令示例: 00 20 00 81 00
  3. You need to convert your PIN into ASCII hex bytes. 您需要将PIN转换为ASCII十六进制字节。 Therefore, if your PIN is 12345678 then the APDU is 00 20 00 81 08 31 32 33 34 35 36 37 38 . 因此,如果您的PIN为12345678,则APDU为00 20 00 81 08 31 32 33 34 35 36 37 38

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM