2

我希望有人可以帮助我了解PIV 智能卡标准

我想通过使用先前生成的 RSA 1024 位模数数字签名密钥 0x9C 对 PKCS#1 填充随机数进行签名来验证智能卡。这是我的测试应用程序的输出:

Requesting Signature
Sending: 0087069C867C84820081800001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00CB441C4A656E071F1FB9F31BC6AB1824324FB42780
Error: (6A80) Incorrect parameters in command data

这是细分:

00 - Not chained (chaining not required because message does not exceed max length)
87 - GENERAL AUTHENTICATE
06 - RSA 1024 Algorithm
9C - Digital Signature Key
86 - Length of data field
  7C - Dynamic Authentication template identifier
  84 - Length of dynamic authentication template
    82 - Response
    00 - Response length 0 (Response requested)
    81 - Challenge
    80 - Challenge length 128
      0001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00CB441C4A656E071F1FB9F31BC6AB1824324FB427 - PKCS #1 padded 20-byte Nonce (Padded with OpenSSL RSA_padding_add_PKCS1_type_1)
80 - Expected response length (128 bytes)

我还使用所有不同的密钥(已经成功生成所有密钥)并使用链式消息与单部分消息运行测试。查看更多测试数据

4

1 回答 1

2

我的智能卡上加载的 PIV 卡小程序存在错误。它不会对任何以 0x00 开头的数据进行签名。如果您将 0x00 更改为其他任何值(只要整数形式的数据小于 RSA 算法要求的整数形式的模数),它将成功签名。所以当然这意味着这些卡不能签署任何标准的 PKCS1 填充数据:(

谢谢您的帮助

于 2012-07-05T13:43:59.817 回答