Reputation: 329
I am trying to sign a document via CryptoTech SCR3310 using A Smart Card Framework for .NET. I use demo from second article (SmartcardFmwk). While sending APDUCommand I will get errors like:
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
What shall I do to get rid of those errors?? I tested the card with another programs and there are no errors.
May be the APDUCommand parameters are wrong. How do you think?
Upvotes: 1
Views: 4490
Reputation: 4142
Upvotes: 1
Reputation: 286
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.
Upvotes: 1