public class Simulator extends Object implements JavaCardInterface
| Modifier and Type | Field and Description |
|---|---|
static String |
ATR_SYSTEM_PROPERTY |
static String |
DEFAULT_ATR |
protected SimulatorRuntime |
runtime
The simulator runtime
|
| Modifier | Constructor and Description |
|---|---|
|
Simulator()
Create a Simulator object using the default SimulatorRuntime.
|
|
Simulator(SimulatorRuntime runtime)
Create a Simulator object using a provided Runtime.
|
protected |
Simulator(SimulatorRuntime runtime,
Properties properties) |
| Modifier and Type | Method and Description |
|---|---|
void |
changeProtocol(String protocol)
Switch protocol
Supported protocols are:
T=0 (alias: *)
T=1
T=CL, TYPE_A, T0 (alias: T=CL)
T=CL, TYPE_A, T1
T=CL, TYPE_B, T0
T=CL, TYPE_B, T1
|
javacard.framework.AID |
createApplet(javacard.framework.AID aid,
byte[] bArray,
short bOffset,
byte bLength)
Create
Applet instance in Simulator |
void |
deleteApplet(javacard.framework.AID aid)
Delete an applet
|
byte[] |
getATR()
Returns ATR
|
String |
getProtocol() |
protected byte |
getProtocolByte(String protocol) |
javacard.framework.AID |
installApplet(javacard.framework.AID aid,
Class<? extends javacard.framework.Applet> appletClass)
Install
Applet into Simulator without installing data |
javacard.framework.AID |
installApplet(javacard.framework.AID aid,
Class<? extends javacard.framework.Applet> appletClass,
byte[] bArray,
short bOffset,
byte bLength)
Install
Applet into Simulator. |
javacard.framework.AID |
installApplet(javacard.framework.AID aid,
String appletClassName,
byte[] appletContents,
byte[] bArray,
short bOffset,
byte bLength)
Install
Applet into Simulator. |
javacard.framework.AID |
installApplet(javacard.framework.AID aid,
String appletClassName,
byte[] bArray,
short bOffset,
byte bLength)
Install
Applet into Simulator. |
javacard.framework.AID |
loadApplet(javacard.framework.AID aid,
Class<? extends javacard.framework.Applet> appletClass)
Load
Applet into Simulator |
javacard.framework.AID |
loadApplet(javacard.framework.AID aid,
String appletClassName)
Load
Applet into Simulator |
javacard.framework.AID |
loadApplet(javacard.framework.AID aid,
String appletClassName,
byte[] appletJarContents)
Load
Applet into Simulator |
void |
reset()
Powerdown/Powerup
|
void |
resetRuntime() |
boolean |
selectApplet(javacard.framework.AID aid)
Select applet by it's AID
It's method must be called before start working with applet instance
|
byte[] |
selectAppletWithResult(javacard.framework.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
If no applet was selected returns
byte[2]
with status word 0x6986 (Command not allowed (no current EF)) |
public static final String DEFAULT_ATR
public static final String ATR_SYSTEM_PROPERTY
protected final SimulatorRuntime runtime
public Simulator()
Simulator instances share one SimulatorRuntime.Simulator(SimulatorRuntime)public Simulator(SimulatorRuntime runtime)
runtime - SimulatorRuntime instance to useNullPointerException - if runtime is nullprotected Simulator(SimulatorRuntime runtime, Properties properties)
public javacard.framework.AID loadApplet(javacard.framework.AID aid,
String appletClassName,
byte[] appletJarContents)
throws javacard.framework.SystemException
JavaCardInterfaceApplet into SimulatorloadApplet in interface JavaCardInterfaceaid - applet aidappletClassName - fully qualified applet class name StrinappletJarContents - contains a byte array containing a jar file with an applet and its dependent classesAIDjavacard.framework.SystemException - if appletClass not instanceof
javacard.framework.Appletpublic javacard.framework.AID loadApplet(javacard.framework.AID aid,
String appletClassName)
throws javacard.framework.SystemException
JavaCardInterfaceApplet into SimulatorloadApplet in interface JavaCardInterfaceaid - applet aidappletClassName - fully qualified applet class name StringAIDjavacard.framework.SystemException - if appletClass not instanceof
javacard.framework.Appletpublic javacard.framework.AID loadApplet(javacard.framework.AID aid,
Class<? extends javacard.framework.Applet> appletClass)
throws javacard.framework.SystemException
Applet into Simulatoraid - applet aidappletClass - applet classAIDjavacard.framework.SystemException - if appletClass not instanceof
javacard.framework.Appletpublic javacard.framework.AID createApplet(javacard.framework.AID aid,
byte[] bArray,
short bOffset,
byte bLength)
throws javacard.framework.SystemException
JavaCardInterfaceApplet instance in SimulatorcreateApplet in interface JavaCardInterfaceaid - applet aidbArray - the array containing installation parametersbOffset - the starting offset in bArraybLength - the length in bytes of the parameter data in bArrayAIDjavacard.framework.SystemException - if exception in Applet.install(..)
method occurs.public javacard.framework.AID installApplet(javacard.framework.AID aid,
Class<? extends javacard.framework.Applet> appletClass)
throws javacard.framework.SystemException
Applet into Simulator without installing dataaid - applet aid or nullappletClass - applet classAIDjavacard.framework.SystemException - if appletClass not instanceof
javacard.framework.Appletpublic javacard.framework.AID installApplet(javacard.framework.AID aid,
Class<? extends javacard.framework.Applet> appletClass,
byte[] bArray,
short bOffset,
byte bLength)
throws javacard.framework.SystemException
Applet into Simulator. This method is equal to:
loadApplet(...);
createApplet(...);
aid - applet aid or nullappletClass - applet classbArray - the array containing installation parametersbOffset - the starting offset in bArraybLength - the length in bytes of the parameter data in bArrayAIDjavacard.framework.SystemException - if appletClass not instanceof
javacard.framework.Appletpublic javacard.framework.AID installApplet(javacard.framework.AID aid,
String appletClassName,
byte[] bArray,
short bOffset,
byte bLength)
throws javacard.framework.SystemException
JavaCardInterfaceApplet into Simulator.
This method is equal to:
loadApplet(...);
createApplet(...);
installApplet in interface JavaCardInterfaceaid - applet aid or nullappletClassName - fully qualified applet class name StrinbArray - the array containing installation parametersbOffset - the starting offset in bArraybLength - the length in bytes of the parameter data in bArrayAIDjavacard.framework.SystemException - if appletClass not instanceof
javacard.framework.Appletpublic javacard.framework.AID installApplet(javacard.framework.AID aid,
String appletClassName,
byte[] appletContents,
byte[] bArray,
short bOffset,
byte bLength)
throws javacard.framework.SystemException
JavaCardInterfaceApplet into Simulator.
This method is equal to:
loadApplet(...);
createApplet(...);
installApplet in interface JavaCardInterfaceaid - applet aid or nullappletClassName - fully qualified applet class name StrinappletContents - Contains a byte array containing a jar file with an applet and its dependent classesbArray - the array containing installation parametersbOffset - the starting offset in bArraybLength - the length in bytes of the parameter data in bArrayAIDjavacard.framework.SystemException - if appletClass not instanceof
javacard.framework.Appletpublic void deleteApplet(javacard.framework.AID aid)
aid - applet aidpublic boolean selectApplet(javacard.framework.AID aid)
throws javacard.framework.SystemException
JavaCardInterfaceselectApplet in interface JavaCardInterfaceaid - appletIdjavacard.framework.SystemExceptionpublic byte[] selectAppletWithResult(javacard.framework.AID aid)
throws javacard.framework.SystemException
JavaCardInterfaceselectAppletWithResult in interface JavaCardInterfaceaid - appletIdjavacard.framework.SystemExceptionpublic byte[] transmitCommand(byte[] command)
CardInterfacebyte[2]
with status word 0x6986 (Command not allowed (no current EF))transmitCommand in interface CardInterfacecommand - command apduCommandAPDU,
ResponseAPDUpublic void reset()
CardInterfacereset in interface CardInterfacepublic final void resetRuntime()
public byte[] getATR()
CardInterfacegetATR in interface CardInterfaceprotected byte getProtocolByte(String protocol)
public void changeProtocol(String protocol)
JavaCardInterfaceT=0 (alias: *)T=1T=CL, TYPE_A, T0 (alias: T=CL)T=CL, TYPE_A, T1T=CL, TYPE_B, T0T=CL, TYPE_B, T1changeProtocol in interface JavaCardInterfaceprotocol - protocol to useJavaCardInterface.changeProtocol(String)public String getProtocol()
getProtocol in interface JavaCardInterfaceJavaCardInterface.getProtocol()