我正在嘗試使用A Smart Card Framework for .NET通過CryptoTech SCR3310簽署文檔。 我使用第二篇文章(SmartcardFmwk)的演示。 雖然發送APDUCommand我會得到這樣的錯誤:連接到智能卡
- 爲verifing(新APDUCommand(0×00, 爲0x20,0,1,NULL,0))SW1= 69 SW2=83 (Authentication method blocked) ErrorNr1
- 選擇文件(新 APDUCommand(0×00 ,0xA4,0,0,NULL, 0))[SW = 61 SW2 = 2E] [4] ErrorNr2
- 用於獲取響應(新 APDUCommand(0×00,將0xC0,0,0,NULL, 0)) SW = 68 00 ErrorNr3
CODE:
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參數錯了。你怎麼想?
編譯器不會說更多關於錯誤的東西嗎? – 2011-03-23 13:00:01