Applications & SmartCard : JavaCard - Identification - LIFL
Applications & SmartCard : JavaCard - Identification - LIFL
Applications & SmartCard : JavaCard - Identification - LIFL
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>JavaCard</strong>.Framework.Applet.deselect()<br />
<strong>JavaCard</strong>.Framework.Applet.deselect()<br />
Applet<br />
sources<br />
Applet<br />
class files<br />
remove<br />
remove<br />
Applet<br />
cap file<br />
load<br />
Applet<br />
Loaded<br />
Applet<br />
Activited<br />
Install / Register<br />
Applet<br />
Selected<br />
JCVM<br />
Applet<br />
Processing<br />
Off-card<br />
On-card<br />
• Automatically called by the JCRE<br />
upon selection of another applet<br />
• Informs the current applet that<br />
another applet has been selected<br />
• Not called in case of power loss<br />
process( )( )<br />
Applet 1 Applet 2<br />
Process( )<br />
Select →<br />
← Deselect<br />
Process →<br />
← return<br />
OK, I am no<br />
longer selected<br />
deselect( ) select( )<br />
JCRE<br />
http://www.lifl.fr/~grimaud/Cours<br />
<strong>JavaCard</strong> System & Framework 45<br />
http://www.lifl.fr/~grimaud/Cours<br />
<strong>JavaCard</strong> System & Framework 46<br />
Applet Example<br />
package com.gemplus.training.code... ;<br />
import javacard.framework.* ;<br />
public class MyApplet extends javacard.framework.Applet {<br />
private final static byte CONSTANT = 0x.. ;<br />
private static final int myVariable = ... ;<br />
private int counterValue ;<br />
MyBaseApplet() { super() ; counterValue = ... ; }<br />
public static void install(byte[] param,short offs,byte ln)<br />
{<br />
MyBaseApplet myApplet = new MyBaseApplet() ;<br />
myApplet.register() ; }<br />
public boolean select() { return true ; }<br />
public void process( APDU apdu ) {<br />
switch ( INS... ) {<br />
case COMMAND_1 : command_1( _apdu) ; break ;<br />
case COMMAND_2 : command_2( _apdu) ; break ;<br />
default ...<br />
break ;<br />
}}<br />
private void command_1( APDU _apdu ) { ... }<br />
private void command_2( APDU _apdu ) { ... }<br />
private void utilityMethod( ... ) { ... }<br />
http://www.lifl.fr/~grimaud/Cours<br />
}<br />
Initialization Command<br />
declaration selection dispaching<br />
<strong>JavaCard</strong> System & Framework 47<br />
<strong>JavaCard</strong>.Framework.Applet<br />
• 0. Applet design and download<br />
• 1. Install ()<br />
• 2. Register ()<br />
• 3. Select ()<br />
• 4. Process ()<br />
• 5. Deselect ()<br />
• 6. Power loss<br />
http://www.lifl.fr/~grimaud/Cours<br />
<strong>JavaCard</strong> System & Framework 48