本文整理汇总了Java中javax.smartcardio.CommandAPDU.getINS方法的典型用法代码示例。如果您正苦于以下问题:Java CommandAPDU.getINS方法的具体用法?Java CommandAPDU.getINS怎么用?Java CommandAPDU.getINS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.smartcardio.CommandAPDU
的用法示例。
在下文中一共展示了CommandAPDU.getINS方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transmit
import javax.smartcardio.CommandAPDU; //导入方法依赖的package包/类
protected ResponseAPDU transmit(final CommandAPDU apdu)
throws CardException {
// "SELECT FILE"
if (apdu.getCLA() == 0x00 && apdu.getINS() == 0xA4
&& apdu.getP1() == 0x08 && apdu.getP2() == 0x0C) {
return selectFile(apdu.getData());
}
// "READ BINARY"
else if (apdu.getCLA() == 0x00 && apdu.getINS() == 0xB0) {
final int offset = (apdu.getP1() << 8) + apdu.getP2();
return readBinary(offset, (int) apdu.getNe());
}
return COMMAND_NOT_AVAILABLE;
}
示例2: setUpClass
import javax.smartcardio.CommandAPDU; //导入方法依赖的package包/类
@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);
}