Question

I have a smart card, is there any way to find out what installed on it? Probably there is applet on it, but I cannot select it with APDU command.

Was it helpful?

Solution

You are talking about applets, so I presume in this answer that you are talking to a Java Card. Java Card itself does not specify any kind of discovery method.

The Global Platform specification does contain methods to retrieve such data. To retrieve the applets on the card you need to send the GET STATUS APDU's (paragraph 11.4 of the freely available GP 2.2.1 specifications). Almost all Java Card implementations also implement Global Platform. Note that you need to authenticate to the Global Platform card manager before you can issue those commands. For this, obviously, you will need a valid authentication key set.

Another trick to find out of what is selectable on the applet is to issue multiple SELECT by NAME commands to the card. You could restrict this to a set of AID's you want to test. A little trick is to use only the first 5 bytes of the AID, known as the RID. The registered RID's all start with A000000000 and then increment sequentially.

After you find an applet you can find out it's regular AID by adding bytes to the (company specific) RID - simply test all 256 values. You may want to automate this... a lot of implementations also return the full AID after selection; this is however applet specific (the SELECT by Name is response is generated by the Applet process method).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top