【发布时间】:2010-03-12 14:40:27
【问题描述】:
我需要一个“java”源代码,了解如何从计算机中提取 cap 文件并将其分成块,以便使用 APDU 将其发送到智能卡以安装或加载或删除应用程序。提前致谢。
【问题讨论】:
我需要一个“java”源代码,了解如何从计算机中提取 cap 文件并将其分成块,以便使用 APDU 将其发送到智能卡以安装或加载或删除应用程序。提前致谢。
【问题讨论】:
您说的是 GlobalPlatform,并且有一个合适的开源工具,称为 GPJ
【讨论】:
我认为你应该从http://java.sun.com/javacard/开始
【讨论】:
从http://gpj.svn.sourceforge.net/viewvc/gpj/获取源代码
你可能对CapFile.java的getEntries(ZipInputStream in)方法中处理CAP文件有所了解
private Map<String, byte[]> getEntries(ZipInputStream in)
throws IOException {
Map<String, byte[]> result = new HashMap<String, byte[]>();
while (true) {
ZipEntry entry = in.getNextEntry();
if (entry == null) {
break;
}
if (entry.getName().indexOf("MANIFEST.MF") != -1) {
continue;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int c;
while ((c = in.read(buf)) > 0)
bos.write(buf, 0, c);
result.put(entry.getName(), bos.toByteArray());
}
return result;
}
【讨论】: