1
votes

I have a javacard and it has 2 applets installed. Now I would like to select one among the two. Currently how I do is that, I provide the cap file of the applet from which I get its AID. But I don't find this method satisfactory. So

  1. Is there a way or steps to get the AID of the applets installed in a java card without having the cap file?
  2. Is there a way to select the applet without its AID? By this I mean that is there a way to make an applet auto selectable after reset?
  3. Are there any other ideas or insights over this?
2

2 Answers

6
votes

For the questions you have asked,

  1. Yes. PyApduTool can make you reach you goal. This tool can help you get all the packages' or applets'AID in java card even though you don NOT have the cap file. Just press the "Refresh" button. the things you need appears in the right text field.

enter image description here

  1. You can set you applet as "Default Selected" when installing it. In this way, you can make you applet selected by default without having to know its AID.

enter image description here

  1. For convenience, it should be better to know the applet-AID. Only one applet can be the default selected.
4
votes

The answer from Andy is good but i feel that its missing an important part of the question:

Javacard get applet AID of installed applets through Java code

If the question refers to finding installedf Applets from the code of one java card applet itself than this answer might apply:
First, it is possible to get the AID of the applet itself by JCSystem.getAID().
Second, it is not possible to "detect" other applets from within an installed applet.
Although if you know the other applet's AID you can get a hack of useful information about it using JCSystem and GPSystem.

So apart from inside JavaCard code, the Card Manager is able to list of installed applets with all their privileges and so on. You can use a tool of your choice. If you are working with JCOP, I recommend JCOP Shell. If you work with freeware I recommend Global Platform Pro from Martin Paljak.

Beside selecting AIDs and default selection there is no direct way to select an applet. There is an indirect way by using the SharedObjectInterface mechanism from JavaCard which lets you change control flow to a different applet.