Access an applet directly without AID selection

左心房为你撑大大i 提交于 2019-12-07 11:55:31

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/44648073/access-an-applet-directly-without-aid-selection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!