List of usage examples for javax.smartcardio CommandAPDU CommandAPDU
public CommandAPDU(int cla, int ins, int p1, int p2, byte[] data, int dataOffset, int dataLength, int ne)
From source file:test.be.fedict.eid.applet.PcscTest.java
@Test public void testGetChallenge() throws Exception { PcscEid pcscEid = new PcscEid(new TestView(), this.messages); if (false == pcscEid.isEidPresent()) { LOG.debug("insert eID card"); pcscEid.waitForEidPresent();//w w w .j a va 2 s. c om } CardChannel cardChannel = pcscEid.getCardChannel(); int size = 256; CommandAPDU getChallengeApdu = new CommandAPDU(0x00, 0x84, 0x00, 0x00, new byte[] {}, 0, 0, size); ResponseAPDU responseApdu; responseApdu = cardChannel.transmit(getChallengeApdu); if (0x9000 != responseApdu.getSW()) { fail("get challenge failure: " + Integer.toHexString(responseApdu.getSW())); } LOG.debug("challenge: " + Hex.encodeHexString(responseApdu.getData())); assertEquals(size, responseApdu.getData().length); pcscEid.close(); }