当前位置: 首页>>代码示例>>Java>>正文


Java AIDUtil.create方法代码示例

本文整理汇总了Java中com.licel.jcardsim.utils.AIDUtil.create方法的典型用法代码示例。如果您正苦于以下问题:Java AIDUtil.create方法的具体用法?Java AIDUtil.create怎么用?Java AIDUtil.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.licel.jcardsim.utils.AIDUtil的用法示例。


在下文中一共展示了AIDUtil.create方法的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;
}
 
开发者ID:bertrandmartel,项目名称:javacard-tutorial,代码行数:19,代码来源:TestSuite.java

示例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;
}
 
开发者ID:bertrandmartel,项目名称:javacard-tutorial,代码行数:19,代码来源:TestSuite.java

示例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;
}
 
开发者ID:bertrandmartel,项目名称:javacard-tutorial,代码行数:26,代码来源:TestSuite.java

示例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;
}
 
开发者ID:bertrandmartel,项目名称:javacard-tutorial,代码行数:19,代码来源:TestSuite.java

示例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);
	}
}
 
开发者ID:patrick-werner,项目名称:EGKfeuer,代码行数:24,代码来源:CardReaderServiceTest.java

示例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());

}
 
开发者ID:patrick-werner,项目名称:EGKfeuer,代码行数:30,代码来源:EgkCardTest.java


注:本文中的com.licel.jcardsim.utils.AIDUtil.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。