本文整理汇总了Java中com.licel.jcardsim.utils.AIDUtil类的典型用法代码示例。如果您正苦于以下问题:Java AIDUtil类的具体用法?Java AIDUtil怎么用?Java AIDUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AIDUtil类属于com.licel.jcardsim.utils包,在下文中一共展示了AIDUtil类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import com.licel.jcardsim.utils.AIDUtil; //导入依赖的package包/类
@BeforeClass
public static void setup() throws CardException {
if (mInitialized) {
return;
}
if (System.getProperty("testMode") != null && System.getProperty("testMode").equals("smartcard")) {
mCard = initGp();
CommandAPDU c = new CommandAPDU(AIDUtil.select(APPLET_AID));
ResponseAPDU response = mCard.getBasicChannel().transmit(c);
assertEquals(0x9000, response.getSW());
} else {
mSimulator = new CardSimulator();
AID appletAID = AIDUtil.create(APPLET_AID);
mSimulator.installApplet(appletAID, HelloWorld.class);
mSimulator.selectApplet(appletAID);
}
mInitialized = true;
}
示例2: setup
import com.licel.jcardsim.utils.AIDUtil; //导入依赖的package包/类
@BeforeClass
public static void setup() throws CardException {
if (mInitialized) {
return;
}
if (System.getProperty("testMode") != null && System.getProperty("testMode").equals("smartcard")) {
mCard = initGp();
CommandAPDU c = new CommandAPDU(AIDUtil.select(APPLET_AID));
ResponseAPDU response = mCard.getBasicChannel().transmit(c);
assertEquals(0x9000, response.getSW());
} else {
mSimulator = new CardSimulator();
AID appletAID = AIDUtil.create(APPLET_AID);
mSimulator.installApplet(appletAID, Counter.class);
mSimulator.selectApplet(appletAID);
}
mInitialized = true;
}
示例3: setup
import com.licel.jcardsim.utils.AIDUtil; //导入依赖的package包/类
@BeforeClass
public static void setup() throws CardException {
if (mInitialized) {
return;
}
if (System.getProperty("testMode") != null && System.getProperty("testMode").equals("smartcard")) {
mCard = initGp();
CommandAPDU c = new CommandAPDU(AIDUtil.select(APPLET_AID));
ResponseAPDU response = mCard.getBasicChannel().transmit(c);
assertEquals(0x9000, response.getSW());
try {
TestUtils.setPinCode(mCard, TestUtils.concatByteArray(new byte[]{0x07}, TestUtils.TEST_PIN_CODE), 0x9000, new byte[]{});
} catch (CardException e) {
System.out.println("set pin code failed");
}
} else {
mSimulator = new CardSimulator();
AID appletAID = AIDUtil.create(APPLET_AID);
mSimulator.installApplet(appletAID, PasswordPinManager.class);
mSimulator.selectApplet(appletAID);
TestUtils.setPinCode(mSimulator, TestUtils.concatByteArray(new byte[]{0x07}, TestUtils.TEST_PIN_CODE), 0x9000, new byte[]{});
}
mInitialized = true;
}
示例4: setup
import com.licel.jcardsim.utils.AIDUtil; //导入依赖的package包/类
@BeforeClass
public static void setup() throws CardException {
if (mInitialized) {
return;
}
if (System.getProperty("testMode") != null && System.getProperty("testMode").equals("smartcard")) {
mCard = initGp();
CommandAPDU c = new CommandAPDU(AIDUtil.select(APPLET_AID));
ResponseAPDU response = mCard.getBasicChannel().transmit(c);
assertEquals(0x9000, response.getSW());
} else {
mSimulator = new CardSimulator();
AID appletAID = AIDUtil.create(APPLET_AID);
mSimulator.installApplet(appletAID, PasswordManager.class);
mSimulator.selectApplet(appletAID);
}
mInitialized = true;
}
示例5: insertTerminal
import com.licel.jcardsim.utils.AIDUtil; //导入依赖的package包/类
private void insertTerminal(Class<? extends Applet> card) throws CardException
{
if (card != null)
{
CardSimulator simulator = new CardSimulator();
AID appletAID = AIDUtil.create("D2760000015445535442");
simulator.installApplet(appletAID, card);
CardTerminal terminal = CardTerminalSimulator.terminal(simulator);
CommandAPDU selectCommand = new CommandAPDU(AIDUtil.select(appletAID));
simulator.transmitCommand(selectCommand);
terminallist.add(terminal);
terminallistCardPresent.add(terminal);
}
else
{
CardTerminal emptyTerminal = EasyMock.createNiceMock(CardTerminal.class);
EasyMock.expect(emptyTerminal.connect(EasyMock.anyString())).andThrow(
new javax.smartcardio.CardNotPresentException("no card found"));
EasyMock.expect(emptyTerminal.isCardPresent()).andReturn(false);
EasyMock.replay(emptyTerminal);
terminallist.add(emptyTerminal);
}
}
示例6: testsim
import com.licel.jcardsim.utils.AIDUtil; //导入依赖的package包/类
@Test
public void testsim() throws CardException
{
CardSimulator simulator = new CardSimulator();
AID appletAID = AIDUtil.create("D2760000015445535442");
simulator.installApplet(appletAID, EgkSimG1Plus.class);
CardTerminal terminal = CardTerminalSimulator.terminal(simulator);
Card connect = terminal.connect("T=1");
CardChannel channel = connect.getBasicChannel();
CommandAPDU selectCommand = new CommandAPDU(AIDUtil.select(appletAID));
simulator.transmitCommand(selectCommand);
byte[] SELECT_ROOT = new byte[] { 0x00, (byte) 0xa4, 0x04, 0x0c, 0x07, (byte) 0xd2, 0x76, 0x00, 0x01, 0x44,
(byte) 0x80, 0x00 };
byte[] READ_PD = new byte[] { 0x00, (byte) 0xb0, (byte) (0x80 + 0x01), 0x00, 0x00, 0x00, 0x00 };
byte[] READ_ATR = new byte[] { 0x00, (byte) 0xb0, (byte) (0x80 + 0x1d), 0x00, 0x00 };
ResponseAPDU selectRootResponse = simulator.transmitCommand(new CommandAPDU(SELECT_ROOT));
assertEquals(0x9000, selectRootResponse.getSW());
ResponseAPDU atrResponse = channel.transmit(new CommandAPDU(READ_ATR));
assertEquals(0x9000, atrResponse.getSW());
ResponseAPDU readPdResponse = channel.transmit(new CommandAPDU(READ_PD));
assertEquals(0x9000, readPdResponse.getSW());
}