Simulator



com.licel.jcardsim.base
Class Simulator

java.lang.Object
  extended by com.licel.jcardsim.base.Simulator
All Implemented Interfaces:
CardInterface, JavaCardInterface
Direct Known Subclasses:
JavaxSmartCardInterface

public class Simulator
extends Object
implements JavaCardInterface

Main class for deal with Applets


Constructor Summary
Simulator()
          Construct Simulator object and init base systems
 
Method Summary
 AID createApplet(AID aid, byte[] bArray, short bOffset, byte bLength)
          Create Applet instance in Simulator
 byte[] getATR()
          Returns ATR
 AID installApplet(AID aid, Class appletClass)
          Install Applet into Simulator without installing data
 AID installApplet(AID aid, Class appletClass, byte[] bArray, short bOffset, byte bLength)
          Install Applet into Simulator.
 AID installApplet(AID aid, String appletClassName, byte[] appletContents, byte[] bArray, short bOffset, byte bLength)
          Install Applet into Simulator.
 AID installApplet(AID aid, String appletClassName, byte[] bArray, short bOffset, byte bLength)
          Install Applet into Simulator.
 AID loadApplet(AID aid, Class appletClass)
          Load Applet into Simulator
 AID loadApplet(AID aid, String appletClassName)
          Load Applet into Simulator
 AID loadApplet(AID aid, String appletClassName, byte[] appletJarContents)
          Load Applet into Simulator
 void reset()
          Powerdown/Powerup
 void resetRuntime()
           
 boolean selectApplet(AID aid)
          Select applet by it's AID It's method must be called before start working with applet instance
 byte[] transmitCommand(byte[] command)
          Transmit APDU to previous selected applet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Simulator

public Simulator()
Construct Simulator object and init base systems

Method Detail

loadApplet

public AID loadApplet(AID aid,
                      String appletClassName,
                      byte[] appletJarContents)
               throws SystemException
Description copied from interface: JavaCardInterface
Load Applet into Simulator

Specified by:
loadApplet in interface JavaCardInterface
Parameters:
aid - applet aid
appletClassName - fully qualified applet class name Strin
appletJarContents - contains a byte array containing a jar file with an applet and its dependent classes
Returns:
applet AID
Throws:
SystemException - if appletClass not instanceof javacard.framework.Applet

loadApplet

public AID loadApplet(AID aid,
                      String appletClassName)
               throws SystemException
Description copied from interface: JavaCardInterface
Load Applet into Simulator

Specified by:
loadApplet in interface JavaCardInterface
Parameters:
aid - applet aid
Returns:
applet AID
Throws:
SystemException - if appletClass not instanceof javacard.framework.Applet

loadApplet

public AID loadApplet(AID aid,
                      Class appletClass)
               throws SystemException
Load Applet into Simulator

Parameters:
aid - applet aid
appletClass - applet class
Returns:
applet AID
Throws:
SystemException - if appletClass not instanceof javacard.framework.Applet

createApplet

public AID createApplet(AID aid,
                        byte[] bArray,
                        short bOffset,
                        byte bLength)
                 throws SystemException
Description copied from interface: JavaCardInterface
Create Applet instance in Simulator

Specified by:
createApplet in interface JavaCardInterface
Parameters:
aid - applet aid
bArray - the array containing installation parameters
bOffset - the starting offset in bArray
bLength - the length in bytes of the parameter data in bArray
Returns:
applet AID
Throws:
SystemException - if exception in Applet.install(..) method occurs.

installApplet

public AID installApplet(AID aid,
                         Class appletClass)
                  throws SystemException
Install Applet into Simulator without installing data

Parameters:
aid - applet aid or null
appletClass - applet class
Returns:
applet AID
Throws:
SystemException - if appletClass not instanceof javacard.framework.Applet

installApplet

public AID installApplet(AID aid,
                         Class appletClass,
                         byte[] bArray,
                         short bOffset,
                         byte bLength)
                  throws SystemException
Install Applet into Simulator. This method is equal to: loadApplet(...); createApplet(...);

Parameters:
aid - applet aid or null
appletClass - applet class
bArray - the array containing installation parameters
bOffset - the starting offset in bArray
bLength - the length in bytes of the parameter data in bArray
Returns:
applet AID
Throws:
SystemException - if appletClass not instanceof javacard.framework.Applet

installApplet

public AID installApplet(AID aid,
                         String appletClassName,
                         byte[] bArray,
                         short bOffset,
                         byte bLength)
                  throws SystemException
Description copied from interface: JavaCardInterface
Install Applet into Simulator. This method is equal to: loadApplet(...); createApplet(...);

Specified by:
installApplet in interface JavaCardInterface
Parameters:
aid - applet aid or null
appletClassName - fully qualified applet class name Strin
bArray - the array containing installation parameters
bOffset - the starting offset in bArray
bLength - the length in bytes of the parameter data in bArray
Returns:
applet AID
Throws:
SystemException - if appletClass not instanceof javacard.framework.Applet

installApplet

public AID installApplet(AID aid,
                         String appletClassName,
                         byte[] appletContents,
                         byte[] bArray,
                         short bOffset,
                         byte bLength)
                  throws SystemException
Description copied from interface: JavaCardInterface
Install Applet into Simulator. This method is equal to: loadApplet(...); createApplet(...);

Specified by:
installApplet in interface JavaCardInterface
Parameters:
aid - applet aid or null
appletClassName - fully qualified applet class name Strin
appletContents - Contains a byte array containing a jar file with an applet and its dependent classes
bArray - the array containing installation parameters
bOffset - the starting offset in bArray
bLength - the length in bytes of the parameter data in bArray
Returns:
applet AID
Throws:
SystemException - if appletClass not instanceof javacard.framework.Applet

selectApplet

public boolean selectApplet(AID aid)
                     throws SystemException
Description copied from interface: JavaCardInterface
Select applet by it's AID It's method must be called before start working with applet instance

Specified by:
selectApplet in interface JavaCardInterface
Parameters:
aid - appletId
Returns:
true if applet selection success
Throws:
SystemException

transmitCommand

public byte[] transmitCommand(byte[] command)
                       throws SystemException
Description copied from interface: CardInterface
Transmit APDU to previous selected applet

Specified by:
transmitCommand in interface CardInterface
Returns:
response apdu
Throws:
SystemException
See Also:
CommandAPDU, ResponseAPDU

reset

public void reset()
Description copied from interface: CardInterface
Powerdown/Powerup

Specified by:
reset in interface CardInterface

resetRuntime

public final void resetRuntime()

getATR

public byte[] getATR()
Description copied from interface: CardInterface
Returns ATR

Specified by:
getATR in interface CardInterface