java card applet_可多选的javacard applet | 学步园
可多選的javacard applet,與多個邏輯通道上設(shè)置各自不同的applet是有區(qū)別的。
Java Card 2.2支持邏輯通道(logical channels)的概念,允許最多智能卡中的16個應(yīng)用程序會話同時開啟,每個邏輯通道一個會話。因為卡片中的APDU的處理不能中斷,并且每個APDU包含一個到邏輯通道(在CLA字節(jié))的引用,變動的APDU可以擬同步地訪問卡片上的許多小應(yīng)用程序。
你可以設(shè)計一個小應(yīng)用程序被多次選擇;也就是說,每次和一個以上邏輯通道通信。多選的小應(yīng)用程序必須實現(xiàn)
javacard.Framework.MultiSelectable接口和相應(yīng)方法。
4.2 Multiselectable Applets
Applets having the capability of being selected on multiple logical channels at the same time, or accepting other applets belonging to the same package being selected simultaneously, are referred to as multiselectable applets.
Note –?All applets within a package shall be multiselectable or none shall be.
An applet’s context is active when either an instance of the applet is already active, or when another applet instance from the same package is active. For more information about contexts see?Section?6.1.2 "Contexts and Context Switching.” An attempt to select an applet instance when the applet’s context is active, is referred to as a?multiselection?attempt. If successful, multiselection occurs, and the applet instance becomes multiselected.
Multiselectable applets shall implement thejavacard.framework.MultiSelectableinterface. In case of multiselection, the applet instance will be informed by invoking its methods?MultiSelectable.select?andMultiSelectable.deselectduring selection and deselection respectively.
When an applet instance not currently active is the first one selected in its package, its?Applet.select?method is called. Subsequent multiselections to this applet instance or selection of other applet instances in the same package shall result in a call to?MultiSelectable.select?method. This method is defined in the?MultiSelectable?interface. Its only purpose is to inform the applet instance that it will be multiselected. The applet instance may accept or reject a multiselection attempt.
If a multiselection attempt is made on an applet which does not implement the?MultiSelectable?interface, the selection shall be rejected by the Java Card RE.
When a multiselected applet instance is deselected from one of the logical channels, the method?MultiSelectable.deselect?is called. Only when the multiselected applet instance is the last active applet instance in the applet’s context, is its regular method?Applet.deselect?called.
There are two cases of multiselection:
When two distinct applet instances from within the same package are multiselected, each applet instance shares the same?CLEAR_ON_DESELECTmemory transient segment. The applet instances share objects within the context firewall as well as their transient data. The Java Card RE shall not reset this?CLEAR_ON_DESELECT?transient objects until all applet instances within the package are deselected.(Refer to?FIGURE?2.)
FIGURE?2??–??Different applet instances in same package
When the same applet instance is multiselected on two different logical channels simultaneously, it shares the?CLEAR_ON_DESELECT?memory segment space across logical channels. The Java Card RE shall not reset theCLEAR_ON_DESELECT?transient objects until all applet instances within the package are deselected. (Refer to?FIGURE?3.)
FIGURE?3??–??Same applet instance selected on multiple logical channels
In both cases of multiselection described above, the applet(s) must implement the?MultiSelectable?interface. If the applet(s) do not support this feature, then the selection must be rejected by the Java Card RE.
Method Summary
void
Called by the Java Card runtime environment to inform that this currently selected applet instance is being deselected on this logical channel while the same applet instance or another applet instance from the same package is still active on another logical channel.
boolean
Called by the Java Card runtime environment to inform that this applet instance has been selected while the same applet instance or another applet instance from the same package is active on another logical channel.
總結(jié)
以上是生活随笔為你收集整理的java card applet_可多选的javacard applet | 学步园的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 最近越来越怕回家了。。。怎么办,大家帮我
- 下一篇: 晴天宝珠的BOOS咋打!