Java Code Examples for javax.smartcardio.CommandAPDU#getBytes()
The following examples show how to use
javax.smartcardio.CommandAPDU#getBytes() .
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: TestClient.java From JCMathLib with MIT License | 6 votes |
static String formatFailedAPDUCmd(CommandAPDU failedCommand) { // If command corectness verification failed, then output for easy resend during debugging later byte[] failedcmd = failedCommand.getBytes(); String failedAPDU = String.format("\tcardMngr.transmit(new CommandAPDU(hexStringToByteArray(\"%s\")));", Util.bytesToHex(failedcmd)); failedAPDU += "\n\tstatic byte[] failedCommand = {"; for (int i = 0; i < failedcmd.length; i++) { failedAPDU += String.format("(byte) 0x%x", failedcmd[i]); if (i != failedcmd.length - 1) { failedAPDU += ", "; } } failedAPDU += "};"; failedAPDU += "\n\t"; return failedAPDU; }
Example 2
Source File: ChannelImpl.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public ResponseAPDU transmit(CommandAPDU command) throws CardException { this.checkClosed(); this.card.checkExclusive(); byte[] commandBytes = command.getBytes(); byte[] responseBytes = this.doTransmit(commandBytes); return new ResponseAPDU(responseBytes); }
Example 3
Source File: ChannelImpl.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public ResponseAPDU transmit(CommandAPDU command) throws CardException { this.checkClosed(); this.card.checkExclusive(); byte[] commandBytes = command.getBytes(); byte[] responseBytes = this.doTransmit(commandBytes); return new ResponseAPDU(responseBytes); }
Example 4
Source File: ChannelImpl.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public ResponseAPDU transmit(CommandAPDU command) throws CardException { this.checkClosed(); this.card.checkExclusive(); byte[] commandBytes = command.getBytes(); byte[] responseBytes = this.doTransmit(commandBytes); return new ResponseAPDU(responseBytes); }
Example 5
Source File: ChannelImpl.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public ResponseAPDU transmit(CommandAPDU command) throws CardException { this.checkClosed(); this.card.checkExclusive(); byte[] commandBytes = command.getBytes(); byte[] responseBytes = this.doTransmit(commandBytes); return new ResponseAPDU(responseBytes); }
Example 6
Source File: CommandAPDUTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@BeforeClass public static void setUpClass() throws Exception { //expected values of apdu, data, headers, nc, ne CommandAPDU capdu = new CommandAPDU(C1); apdu = capdu.getBytes(); data = capdu.getData(); cla = capdu.getCLA(); if (cla != (C1[0] & 0xff)) { throw new RuntimeException("Failure: cla is not right"); } ins = capdu.getINS(); if (ins != (C1[1] & 0xff)) { throw new RuntimeException("Failure: ins is not right"); } p1 = capdu.getP1(); if (p1 != (C1[2] & 0xff)) { throw new RuntimeException("Failure: p1 is not right"); } p2 = capdu.getP2(); if (p2 != (C1[3] & 0xff)) { throw new RuntimeException("Failure: p2 is not right"); } nc = capdu.getNc(); ne = capdu.getNe(); //Test on following constructors cm1 = new CommandAPDU(apdu); cm2 = new CommandAPDU(cla, ins, p1, p2); cm3 = new CommandAPDU(cla, ins, p1, p2, data); cm4 = new CommandAPDU(cla, ins, p1, p2, data, ne); cm5 = new CommandAPDU(cla, ins, p1, p2, ne); cm6 = new CommandAPDU(ByteBuffer.wrap(apdu)); cm7 = new CommandAPDU(apdu, 0, apdu.length); cm8 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc); cm9 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc, ne); }
Example 7
Source File: CommandAPDUTest.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@BeforeClass public static void setUpClass() throws Exception { //expected values of apdu, data, headers, nc, ne CommandAPDU capdu = new CommandAPDU(C1); apdu = capdu.getBytes(); data = capdu.getData(); cla = capdu.getCLA(); if (cla != (C1[0] & 0xff)) { throw new RuntimeException("Failure: cla is not right"); } ins = capdu.getINS(); if (ins != (C1[1] & 0xff)) { throw new RuntimeException("Failure: ins is not right"); } p1 = capdu.getP1(); if (p1 != (C1[2] & 0xff)) { throw new RuntimeException("Failure: p1 is not right"); } p2 = capdu.getP2(); if (p2 != (C1[3] & 0xff)) { throw new RuntimeException("Failure: p2 is not right"); } nc = capdu.getNc(); ne = capdu.getNe(); //Test on following constructors cm1 = new CommandAPDU(apdu); cm2 = new CommandAPDU(cla, ins, p1, p2); cm3 = new CommandAPDU(cla, ins, p1, p2, data); cm4 = new CommandAPDU(cla, ins, p1, p2, data, ne); cm5 = new CommandAPDU(cla, ins, p1, p2, ne); cm6 = new CommandAPDU(ByteBuffer.wrap(apdu)); cm7 = new CommandAPDU(apdu, 0, apdu.length); cm8 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc); cm9 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc, ne); }
Example 8
Source File: CommandAPDUTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@BeforeClass public static void setUpClass() throws Exception { //expected values of apdu, data, headers, nc, ne CommandAPDU capdu = new CommandAPDU(C1); apdu = capdu.getBytes(); data = capdu.getData(); cla = capdu.getCLA(); if (cla != (C1[0] & 0xff)) { throw new RuntimeException("Failure: cla is not right"); } ins = capdu.getINS(); if (ins != (C1[1] & 0xff)) { throw new RuntimeException("Failure: ins is not right"); } p1 = capdu.getP1(); if (p1 != (C1[2] & 0xff)) { throw new RuntimeException("Failure: p1 is not right"); } p2 = capdu.getP2(); if (p2 != (C1[3] & 0xff)) { throw new RuntimeException("Failure: p2 is not right"); } nc = capdu.getNc(); ne = capdu.getNe(); //Test on following constructors cm1 = new CommandAPDU(apdu); cm2 = new CommandAPDU(cla, ins, p1, p2); cm3 = new CommandAPDU(cla, ins, p1, p2, data); cm4 = new CommandAPDU(cla, ins, p1, p2, data, ne); cm5 = new CommandAPDU(cla, ins, p1, p2, ne); cm6 = new CommandAPDU(ByteBuffer.wrap(apdu)); cm7 = new CommandAPDU(apdu, 0, apdu.length); cm8 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc); cm9 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc, ne); }
Example 9
Source File: CommandAPDUTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@BeforeClass public static void setUpClass() throws Exception { //expected values of apdu, data, headers, nc, ne CommandAPDU capdu = new CommandAPDU(C1); apdu = capdu.getBytes(); data = capdu.getData(); cla = capdu.getCLA(); if (cla != (C1[0] & 0xff)) { throw new RuntimeException("Failure: cla is not right"); } ins = capdu.getINS(); if (ins != (C1[1] & 0xff)) { throw new RuntimeException("Failure: ins is not right"); } p1 = capdu.getP1(); if (p1 != (C1[2] & 0xff)) { throw new RuntimeException("Failure: p1 is not right"); } p2 = capdu.getP2(); if (p2 != (C1[3] & 0xff)) { throw new RuntimeException("Failure: p2 is not right"); } nc = capdu.getNc(); ne = capdu.getNe(); //Test on following constructors cm1 = new CommandAPDU(apdu); cm2 = new CommandAPDU(cla, ins, p1, p2); cm3 = new CommandAPDU(cla, ins, p1, p2, data); cm4 = new CommandAPDU(cla, ins, p1, p2, data, ne); cm5 = new CommandAPDU(cla, ins, p1, p2, ne); cm6 = new CommandAPDU(ByteBuffer.wrap(apdu)); cm7 = new CommandAPDU(apdu, 0, apdu.length); cm8 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc); cm9 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc, ne); }
Example 10
Source File: CommandAPDUTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@BeforeClass public static void setUpClass() throws Exception { //expected values of apdu, data, headers, nc, ne CommandAPDU capdu = new CommandAPDU(C1); apdu = capdu.getBytes(); data = capdu.getData(); cla = capdu.getCLA(); if (cla != (C1[0] & 0xff)) { throw new RuntimeException("Failure: cla is not right"); } ins = capdu.getINS(); if (ins != (C1[1] & 0xff)) { throw new RuntimeException("Failure: ins is not right"); } p1 = capdu.getP1(); if (p1 != (C1[2] & 0xff)) { throw new RuntimeException("Failure: p1 is not right"); } p2 = capdu.getP2(); if (p2 != (C1[3] & 0xff)) { throw new RuntimeException("Failure: p2 is not right"); } nc = capdu.getNc(); ne = capdu.getNe(); //Test on following constructors cm1 = new CommandAPDU(apdu); cm2 = new CommandAPDU(cla, ins, p1, p2); cm3 = new CommandAPDU(cla, ins, p1, p2, data); cm4 = new CommandAPDU(cla, ins, p1, p2, data, ne); cm5 = new CommandAPDU(cla, ins, p1, p2, ne); cm6 = new CommandAPDU(ByteBuffer.wrap(apdu)); cm7 = new CommandAPDU(apdu, 0, apdu.length); cm8 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc); cm9 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc, ne); }
Example 11
Source File: CommandAPDUTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@BeforeClass public static void setUpClass() throws Exception { //expected values of apdu, data, headers, nc, ne CommandAPDU capdu = new CommandAPDU(C1); apdu = capdu.getBytes(); data = capdu.getData(); cla = capdu.getCLA(); if (cla != (C1[0] & 0xff)) { throw new RuntimeException("Failure: cla is not right"); } ins = capdu.getINS(); if (ins != (C1[1] & 0xff)) { throw new RuntimeException("Failure: ins is not right"); } p1 = capdu.getP1(); if (p1 != (C1[2] & 0xff)) { throw new RuntimeException("Failure: p1 is not right"); } p2 = capdu.getP2(); if (p2 != (C1[3] & 0xff)) { throw new RuntimeException("Failure: p2 is not right"); } nc = capdu.getNc(); ne = capdu.getNe(); //Test on following constructors cm1 = new CommandAPDU(apdu); cm2 = new CommandAPDU(cla, ins, p1, p2); cm3 = new CommandAPDU(cla, ins, p1, p2, data); cm4 = new CommandAPDU(cla, ins, p1, p2, data, ne); cm5 = new CommandAPDU(cla, ins, p1, p2, ne); cm6 = new CommandAPDU(ByteBuffer.wrap(apdu)); cm7 = new CommandAPDU(apdu, 0, apdu.length); cm8 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc); cm9 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc, ne); }
Example 12
Source File: CommandAPDUTest.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
@BeforeClass public static void setUpClass() throws Exception { //expected values of apdu, data, headers, nc, ne CommandAPDU capdu = new CommandAPDU(C1); apdu = capdu.getBytes(); data = capdu.getData(); cla = capdu.getCLA(); if (cla != (C1[0] & 0xff)) { throw new RuntimeException("Failure: cla is not right"); } ins = capdu.getINS(); if (ins != (C1[1] & 0xff)) { throw new RuntimeException("Failure: ins is not right"); } p1 = capdu.getP1(); if (p1 != (C1[2] & 0xff)) { throw new RuntimeException("Failure: p1 is not right"); } p2 = capdu.getP2(); if (p2 != (C1[3] & 0xff)) { throw new RuntimeException("Failure: p2 is not right"); } nc = capdu.getNc(); ne = capdu.getNe(); //Test on following constructors cm1 = new CommandAPDU(apdu); cm2 = new CommandAPDU(cla, ins, p1, p2); cm3 = new CommandAPDU(cla, ins, p1, p2, data); cm4 = new CommandAPDU(cla, ins, p1, p2, data, ne); cm5 = new CommandAPDU(cla, ins, p1, p2, ne); cm6 = new CommandAPDU(ByteBuffer.wrap(apdu)); cm7 = new CommandAPDU(apdu, 0, apdu.length); cm8 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc); cm9 = new CommandAPDU(cla, ins, p1, p2, data, 0, nc, ne); }