0

我需要一个关于如何从计算机中提取 cap 文件并将其划分为块的“java”源代码,以便使用 APDU 将其发送到智能卡以安装或加载或删除应用程序。提前致谢。

4

3 回答 3

4

你在谈论 GlobalPlatform 并且有一个合适的开源工具,称为GPJ

于 2010-03-15T19:47:50.230 回答
0

我认为您应该从http://java.sun.com/javacard/开始

于 2010-03-12T14:48:43.530 回答
0

从http://gpj.svn.sourceforge.net/viewvc/gpj/获取源代码

您可能会对使用以下方法处理 CAP 文件有所getEntries(ZipInputStream in)了解CapFile.java

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;
    }
于 2010-05-12T02:04:42.887 回答