0

I am new to smart card development. What I am trying to do is,
1>get the name of the card reader.
2>connect to the card in the card reader.
3>change the admin key of the card using c# .

for the first point i used winscard.DLL- function SCardListReaders. It worked well.
now for next step, I tried with function -SCardConnect of winscard.dll.

but when ever i am running this , it returns "6", but it should return 0. I am really confused.
Any idea, what that means? where i am doing wrong?
Please help.
Thank you in advance.

Ondrej Janacek
  • 12,486
  • 14
  • 59
  • 93
codedip
  • 191
  • 3
  • 11

1 Answers1

5

You can refer here for smart card return values. And if not listed, you can refer here for system error codes.

The error code 6 is ERROR_INVALID_HANDLE. Try to check your OS (32-bit or 64-bit) and your smart card driver (32-bit or 64-bit). Ensure that they are the same. Also, check that your codes are using the correct variable type.

David
  • 3,957
  • 2
  • 28
  • 52
  • thank you for your answer. It helped. Is it possible to update admin key by apdu command....any idea? – codedip May 27 '13 at 10:39
  • Yes, it may be possible. Usually the admin key is protected with checksum, proprietary CLA and INS, or specific APDUs sequence. Please note that this depends on the vendor implementation which is RARELY shared. – David May 27 '13 at 10:48