java for 缺省_javacard卡片上电后,自动选择缺省的applet | 学步园

在一些卡片部署中,一个默认小应用程序可以被定义为在卡片复位以后被自动地选择,用于在基本逻辑通道(通路0)上通信。Java Card 2.2允许你定义默认小应用程序,但是不指定的如何做;其机理由厂家特定。

javacard复位后,设置默认选择的applet,详见JCRE default applet。

4.1 The Default Applets

Normally, applet instances become selected only via a successful SELECT FILE command. However, some smart card CAD applications require that there be a default card applet instance to become implicitly selected after every card reset. In addition, some CAD applications may also require a default applet selection when a new logical channel is opened.

The Java Card platform allows the card implementer to designate a default applet instance for each of the logical channels supported by the card. For any logical channel, the card implementation may designate an applet instance as the default applet instance for that logical channel. Alternatively, for any logical channel, the implementation may choose to designate no default applet instance at all. Logical channels may share the same applet instance as the default applet instance for more than one channel.

Upon card reset, only the basic logical channel (channel 0) is automatically opened. The default card applet instance, if any, is therefore the default applet instance for logical channel 0.

The card reset behavior is:

After card reset (or power on, which is a form of reset) the Java Card RE performs its initialization and checks to see if its internal state indicates that a particular applet instance is the default applet instance for the basic logical channel. If so, the Java Card RE makes this applet instance the currently selected applet instance on the basic logical channel, and the applet’s select method is called. If this method throws an exception or returns false, then the Java Card RE sets its state to indicate that no applet is active on the basic logical channel.

When a default card applet instance becomes active upon card reset, it shall not require its process method to be called. The applet instance’s process method is not called during default applet selection because there is no SELECT FILE APDU.

The Java Card RE ensures that the ATR has been sent and the card is now ready to accept APDU commands.

The default applet selection behavior on opening a new channel is:

When a MANAGE CHANNEL command is issued on the basic logical channel and a new logical channel is opened, the Java Card RE checks if there is a designated default applet instance for the newly opened logical channel. If so, the Java Card RE makes this applet instance the currently selected applet instance on the new logical channel, and the applet’s select method (MultiSelectable.select method if required) is called. If this method throws an exception or returns false, then the Java Card RE closes the new logical channel. (The applet instance’s process method is not called during default applet selection, because there is no SELECT FILE APDU). A default applet instance shall not require its processmethod to be called.

If a default applet instance was successfully selected, then APDU commands can be sent directly to the applet instance on that logical channel. If no applet is active, then only SELECT FILE commands for applet selection or MANAGE CHANNEL commands can be processed on that logical channel.

The mechanism for specifying the default applet instance for a logical channel is not defined in the Java Card API. It is a Java Card RE implementation detail and is left to the individual implementers.

解决方法:在INSTALL APPLET的时候加个-D参数就行了

install [-e|--delegation][-l|--cm-lock][-t|--terminate]

[-d|--default] [-p|--pin-change] [-s|--security-domain] [-b|--sd-dap]

[-m|--mandated-dap] [-q|--install-param params] [-i|--instance-aid AID]

[-o|--install-only] pkgAID appAID

Name

Description

Required

--+-- -e -----------+-->

! !

+-- --delegation -+

Security Domain with delegated management.

No

--+-- -l --------+-->

! !

+-- --cm-lock -+

Card Manager lock permission.

No

--+-- -t ----------+-->

! !

+-- --terminate -+

Card terminate permission.

No

--+-- -d --------+-->

! !

+-- --default -+

Implicit selectable (default) applet.

No

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值