javacard.framework.AID Java Examples
The following examples show how to use
javacard.framework.AID.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NdefApplet.java From openjavacard-ndef with GNU General Public License v3.0 | 6 votes |
/** * Attempt to connect to the backend service */ private void connectService() { NdefService service = null; // get AID object for service AID aid = JCSystem.lookupAID(serviceAID, (short)0, (byte)serviceAID.length); if(aid != null) { // get service object Shareable share = JCSystem.getAppletShareableInterfaceObject(aid, serviceID); // cast the service object if(share instanceof NdefService) { service = (NdefService)share; } } // check that we got a valid object if(service == null) { ISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED); } // retrieve the data array byte[] data = service.getData(); if(data == null) { ISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED); } // remember both references refs[REF_SERVICE] = service; refs[REF_DATA] = data; }
Example #2
Source File: CardManager.java From JCMathLib with MIT License | 5 votes |
private CardChannel ConnectJCardSimLocalSimulator(Class appletClass) throws Exception { System.setProperty("com.licel.jcardsim.terminal.type", "2"); CAD cad = new CAD(System.getProperties()); JavaxSmartCardInterface simulator = (JavaxSmartCardInterface) cad.getCardInterface(); byte[] installData = new byte[0]; AID appletAID = new AID(m_APPLET_AID, (short) 0, (byte) m_APPLET_AID.length); AID appletAIDRes = simulator.installApplet(appletAID, appletClass, installData, (short) 0, (byte) installData.length); simulator.selectApplet(appletAID); return new SimulatedCardChannelLocal(simulator); }
Example #3
Source File: CardManager.java From JCMathLib with MIT License | 5 votes |
private CardChannel ConnectJCardSimLocalSimulator(Class appletClass) throws Exception { System.out.print("Setting up Javacard simulator..."); //CardSimulator simulator = new CardSimulator(); System.setProperty("com.licel.jcardsim.terminal.type", "2"); CAD cad = new CAD(System.getProperties()); JavaxSmartCardInterface simulator = (JavaxSmartCardInterface) cad.getCardInterface(); byte[] installData = new byte[0]; AID appletAID = new AID(m_APPLET_AID, (short) 0, (byte) m_APPLET_AID.length); AID appletAIDRes = simulator.installApplet(appletAID, appletClass, installData, (short) 0, (byte) installData.length); simulator.selectApplet(appletAID); return new SimulatedCardChannelLocal(simulator); }
Example #4
Source File: KeycardTest.java From status-keycard with Apache License 2.0 | 5 votes |
private static void openSimulatorChannel() throws Exception { simulator = new CardSimulator(); // Install KeycardApplet AID aid = AIDUtil.create(Identifiers.KEYCARD_AID); ByteArrayOutputStream bos = new ByteArrayOutputStream(); bos.write(Identifiers.getKeycardInstanceAID().length); bos.write(Identifiers.getKeycardInstanceAID()); simulator.installApplet(aid, KeycardApplet.class, bos.toByteArray(), (short) 0, (byte) bos.size()); bos.reset(); // Install NDEFApplet aid = AIDUtil.create(Identifiers.NDEF_AID); bos.write(Identifiers.NDEF_INSTANCE_AID.length); bos.write(Identifiers.NDEF_INSTANCE_AID); bos.write(new byte[] {0x01, 0x00, 0x02, (byte) 0xC9, 0x00}); simulator.installApplet(aid, NDEFApplet.class, bos.toByteArray(), (short) 0, (byte) bos.size()); bos.reset(); // Install CashApplet aid = AIDUtil.create(Identifiers.CASH_AID); bos.write(Identifiers.CASH_INSTANCE_AID.length); bos.write(Identifiers.CASH_INSTANCE_AID); bos.write(new byte[] {0x01, 0x00, 0x02, (byte) 0xC9, 0x00}); simulator.installApplet(aid, CashApplet.class, bos.toByteArray(), (short) 0, (byte) bos.size()); bos.reset(); cardTerminal = CardTerminalSimulator.terminal(simulator); openPCSCChannel(); }
Example #5
Source File: GidsBaseTestClass.java From GidsApplet with GNU General Public License v3.0 | 5 votes |
@Before public void setUp() throws Exception { // 1. Create simulator byte[] TEST_APPLET_AID_BYTES = new byte[] {(byte) 0xA0,0x00,0x00,0x03,(byte) 0x97,0x42,0x54,0x46,0x59}; AID TEST_APPLET_AID = new AID(TEST_APPLET_AID_BYTES, (short)0, (byte) TEST_APPLET_AID_BYTES.length); simulator = new JavaxSmartCardInterface (); // 2. Install applet simulator.installApplet(TEST_APPLET_AID, GidsApplet.class); simulator.selectApplet(TEST_APPLET_AID); // 3. Select applet }
Example #6
Source File: CardMngr.java From ECTester with MIT License | 5 votes |
public boolean prepareLocalSimulatorApplet(byte[] appletAIDArray, byte[] installData, Class<? extends Applet> appletClass) { simulator = new JavaxSmartCardInterface(); AID appletAID = new AID(appletAIDArray, (short) 0, (byte) appletAIDArray.length); simulator.installApplet(appletAID, appletClass, installData, (short) 0, (byte) installData.length); return simulator.selectApplet(appletAID); }