2010-03-12 65 views
0

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

回答

4

你在谈论全球平台,有一个正确的开源工具,在那里为这家名为GPJ

+0

是的,你是对的,我之前检查过,但我希望它的源代码采取特定的部分,处理CAP文件和应用程序管理。谢谢 – user292395 2010-03-16 10:46:14

+3

它附带源代码!? 下面是一个链接,让您点击以下链接:http://gpj.svn.sourceforge.net/viewvc/gpj/ – 2010-03-17 22:05:10

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; 
    }