Reputation: 11
I need a 'java' source code on how to extract a cap file from the computer and divide it into blocks in order to send it using APDUs to the smart card to install or load or delete an application. Thanks in advance.
Upvotes: 0
Views: 790
Reputation: 620
Get the source code from http://gpj.svn.sourceforge.net/viewvc/gpj/
You may get some idea about dealing with CAP file in the method getEntries(ZipInputStream in)
of 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;
}
Upvotes: 0
Reputation: 4142
You're talking about GlobalPlatform and there's a right open source tool out there for this, called GPJ
Upvotes: 4