SSE4E GPError GPSystem ByteString ByteBuffer TLV TLVList Card Atr Key Crypto Application GPApplication GPSecDomain ASN1 CardFile IsoSecureChannel ApplFactory GPXML JsScript CardSim X509 CRL KeyStore CMSSignedData CMSGenerator XMLSignature OCSPQuery LDAP SOAP URLConnection PKCS11Provider PKCS11Session PKCS11Object OutlineNode OpenSCDP |
CardSimulationAdapter - Reference Documentation
Class to control a card simulation adapter that forwards APDUs to a script implementation Index of MethodsConstructorPrototypeCardSimulationAdapter(String adapter, String parameter) DescriptionCreate a new card simulation adapter. Currently only the JCOP Simulation adapter is available. It is configured as adapter name "JCOPSimulation" with the port number as parameter. Arguments
Exceptions
Examplevar sa = new CardSimulationAdapter("JCOPSimulation", "8050"); setSimulationObject()Prototypevoid setSimulationObject(Object simulation) DescriptionSet the object that receives reset() and processAPDU() calls from the card simulation adapter. The simulation object must implement the following methods: void reset(Number coldOrWarm); ByteString processAPDU(ByteString capdu);The parameter coldOrWarm allows to differentiate between a cold and a warm reset. This parameter is currently always 0 (cold reset). The parameter capdu contains the raw command APDU, including CLA, INS, P1, P2 and conditionally the Lc, Command Data and Le field. The processAPDU() method must return the response APDU as ByteString object, with the conditional response data field and the trailer bytes SW1/SW2. Arguments
Return
Exceptions
Example// Create a very simple card simulator var simulationObject = new Object(); // The simulator needs a processAPDU method simulationObject.processAPDU = function(capdu) { print("Received APDU: " + capdu); var rapdu = capdu.concat(new ByteString("9000", HEX)); return rapdu; } // The simulator needs a reset method simulationObject.reset = function(type) { print("Reset type: " + type); var atr = new ByteString("3B600000", HEX); return atr; } sa.setSimulationObject(simulationObject); start()Prototypevoid start() DescriptionStarts the simulator adapter. If the adapter is already running, it is stopped first. Return
Exceptions
Examplesa.start(); var card = new Card("JCOPSimulation"); var atr = card.reset(Card.RESET_COLD); print(atr); assert(atr.toByteString().toString(HEX) == "3B600000"); var rapdu = card.sendApdu(0x00, 0x10, 0x01, 0x02, new ByteString("1234", HEX), [0x9000]); assert(rapdu.toString(HEX) == "00100102021234"); stop()Prototypevoid stop() DescriptionStops the simulator adapter. Return
Exceptions
Examplesa.stop(); © Copyright 2003 - 2010 CardContact Software & System Consulting, Minden, Germany |