Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access an applet directly without AID selection

Usually, when you power up a JavaCard smartcard and want to communicate with an applet, you must select the applet using its AID first.

Is there any way to have a "default applet" that is selected when the card is powered up?

What I really want to do is be able to send my application level APDUs immediately upon selecting the card and not need to go through the application selection process.

Is this possible? If so, how?

like image 838
jim Avatar asked Jun 20 '17 08:06

jim


Video Answer


1 Answers

If your Java Card smartcard implements the Global Platform Card specification, it will typically allow you to define an applet that is implicitly selected on the basic logical channel upon reset. Thus, upon powering up (resetting) the card the applet would be selected by default and immediately receives all commands (except those handled by the runtime environment, such as selection of other applets, logical channel management, etc.).

You can set an applet as the default selected applet by giving it the "Default Selected" (GP 2.1.1 terminology) or "Card Reset" (GP 2.2 terminology) privilege. This is set by bit 3 in the (first) privilege byte. Only one application can have this privilege.

If you use, for instance, GlobalPlatformPro, you could use the options --default (during installation) or --make-default <AID> (for an existing applet) to set this privilege.


Note that you can distinguish between being default selected and selected by AID by capturing the SELECT APDU within the Applet#process method. The best way is to call Applet.selectingApplet to check if explicit selection by AID has taken place.

like image 93
Michael Roland Avatar answered Sep 27 '22 00:09

Michael Roland