simulation - JCardSim 包错误?

标签 simulation javacard emulation

我尝试用 https://github.com/licel/jcardsim 模拟智能卡.

示例代码如下

// 1. create simulator
CardSimulator simulator = new CardSimulator();

// 2. install applet
AID appletAID = AIDUtil.create("F000000001");
simulator.installApplet(appletAID, HelloWorldApplet.class);

// 3. select applet
simulator.selectApplet(appletAID);

// 4. send APDU
CommandAPDU commandAPDU = new CommandAPDU(0x00, 0x01, 0x00, 0x00);
ResponseAPDU response = simulator.transmitCommand(commandAPDU);

// 5. check response
assertEquals(0x9000, response.getSW());

但是2.2.2.jar中没有名为Cardsimulator的Package。这是版本 3 的代码吗?

最佳答案

2.2.2 版本的文档可在此处找到: https://github.com/licel/jcardsim/blob/jc2.2.2/README.md

与该问题相对应的摘录如下:

//1. create simulator
JavaxSmartCardInterface simulator = new JavaxSmartCardInterface();
//2. install applet
simulator.installApplet(appletAID, HelloWorldApplet.class);
//3. select applet
simulator.selectApplet(appletAID);
//4. send apdu
ResponseAPDU response = simulator.transmitCommand(new CommandAPDU(0x01, 0x01, 0x00, 0x00));
//5. check response
assertEquals(0x9000, response.getSW());

关于simulation - JCardSim 包错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42502252/

相关文章:

nfc - SIMPLE-TLV 与 BER-TLV

使用 Microsoft Web 浏览器 OCX 控件时 addEventListener 上的 jQuery 2.x 问题

android - 如何在 Android 模拟器 4.0 中启用网络摄像头?

python - 如何使用 vpython 库描绘球形物体上的小电荷?

javacard - 发送扩展 APDU 失败

scala - Gatling-Value baseURL 不是 io.gatling.http.protocol.HttpProtocolBuilder 的成员

testing - .scr 文件和 APDU

java - 网络模拟器

python - 模拟相关的多变量数据

javascript - 单位圆内的 10 个点 - 寻找 D3 力布局的最佳分布?