1

我正在尝试使用A Smart Card Framework for .NET通过 CryptoTech SCR3310 签署文件。我使用第二篇文章(SmartcardFmwk)中的演示。在发送 APDUCommand 时,我会收到如下错误:

  • 用于验证 (new APDUCommand(0x00, 0x20, 0, 1, null, 0)) SW1= 69 SW2=83 (验证方法被阻止) ErrorNr1
  • 用于选择文件 (new APDUCommand(0x00, 0xA4, 0, 0, null, 0)) [SW=61 SW2=2E][4] ErrorNr2
  • 用于获取响应(新 APDUCommand(0x00, 0xC0, 0, 0, null, 0)) SW=68 00 ErrorNr3

代码:

APDUCommand apduVerifyCHV = new APDUCommand(0x00, 0x20, 0, 1, null, 0)
APDUCommand apduSelectFile = new APDUCommand(0x00, 0xA4, 0, 0, null, 0)
APDUResponse apduResp;

CardNative iCard = new CardNative();
iCard.Connect(readers[0], SHARE.Shared, PROTOCOL.T0orT1); //connected
Console.WriteLine("Connects card on reader: " + readers[0]);

// Verify the PIN  (PIN = 12341234)
byte[] pin = new byte[] { 0x31, 0x32, 0x33, 0x34, 0x31, 0x32, 0x33, 0x34 }; 

APDUParam apduParam = new APDUParam();
apduParam.Data = pin;
apduVerifyCHV.Update(apduParam);
apduResp = iCard.Transmit(apduVerifyCHV); //ErrorNr1

// Select the MF (3F00)
apduParam.Data = new byte[] { 0x3F, 0x00 };
apduSelectFile = new APDUCommand(0x00, 0xA4, 0, 0, apduParam.Data, 0);

apduSelectFile.Update(apduParam);
apduResp = iCard.Transmit(apduSelectFile); //ErrorNr2
apduGetResponse.Update(apduParam);
apduResp = iCard.Transmit(apduGetResponse); //ErrorNr3

我该怎么做才能摆脱这些错误?我用另一个程序测试了卡,没有错误。

可能是APDUCommand 参数错误。你怎么想?

4

2 回答 2

1

If this card works correctly with other programs, than the key is to set the appropriate parameters for the APDU command. I've never done this, but my friend had some university project related to the student cards. He provided me with the following link with the list of known APDU commands. Don't know, maybe it will help You find the correct combination.

APDU table

于 2011-03-23T19:26:12.953 回答
1
  • 问题中的智能卡读卡器无关紧要,它只是的网关设备。您的错误不是来自阅读器,而是来自
  • 您确实需要为您的卡准备一本手册,或者您可以尝试使用 ISO 7816-4 中的命令
  • 调用 GET RESPONSE 通常意味着使用 T=0 协议,您使用 T=0 或 T=1 连接,对于支持它的现代卡,默认为 T=1。
于 2011-03-25T05:50:11.080 回答