Example usage for javax.smartcardio CommandAPDU CommandAPDU

List of usage examples for javax.smartcardio CommandAPDU CommandAPDU

Introduction

In this page you can find the example usage for javax.smartcardio CommandAPDU CommandAPDU.

Prototype

public CommandAPDU(int cla, int ins, int p1, int p2) 

Source Link

Document

Constructs a CommandAPDU from the four header bytes.

Usage

From source file:test.be.fedict.eid.applet.PcscTest.java

private void selectCardManager(CardChannel cardChannel) {
    CommandAPDU selectApplicationApdu = new CommandAPDU(0x00, 0xA4, 0x04, 0x00);
    ResponseAPDU responseApdu;/*from   ww w  .j  a  v  a 2 s .c o  m*/
    try {
        responseApdu = cardChannel.transmit(selectApplicationApdu);
    } catch (CardException e) {
        LOG.debug("error selecting application");
        return;
    } catch (ArrayIndexOutOfBoundsException e) {
        LOG.debug("array error");
        return;
    }
    if (0x9000 != responseApdu.getSW()) {
        LOG.debug("could not select application");
    } else {
        LOG.debug("application selected");
    }
}