0

I need to retrieve a Certificate contained in a SmartCard ISO 7816 compatible. So far I've been able to verify the PIN using APDU commands but I need some pointers for retrieving the certificate. I've tried the following SELECT APDU which should select the first file (as I understand):

ResponseAPDU resp = ch.transmit( new CommandAPDU(0X00, 0XA4, 0X00, 0X90, new byte[]{0x54, 0x01}) );

However this produces '6a82' which is File Not Found. Do I need to provide a file name for it ? Actually I know the certificate name but obviously in String format. Is there a generic APDU command which retrieves the first file contained on the Smart Card ?
Thanks!

user2824073
  • 2,407
  • 10
  • 39
  • 73

1 Answers1

2

You've just tried selecting a file with file ID 5401 (hex). That file does not seem to exist, but maybe you need to select an application first (using SELECT by name and an AID as "name"). ISO/IEC 7816-4 compatible cards do not use filenames.

It's possible that the card supports ISO/IEC 7816-15 which contains a structure that contains references to the data stored on a card. It may be that your card supports such a structure, but without more information it is hard to tell.

AID for PKCS#15 is A000000063 504b43532d3135 and the ISO/IEC 7816-15 AID is - euh - missing in action ... comment if you require it :)

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
  • Thanks for your reply. Well, right now I've adopted a DLL library which speaks natively with the SmartCard. I don't have much control over it, yet it works. (And without information from the smart cart supplier I guess it's the only choice). Thanks anyway. – user2824073 Aug 11 '14 at 07:32
  • Yeah, normally a PKCS#11 .dll provided by the issuer should do the trick. – Maarten Bodewes Aug 11 '14 at 07:57