views:

88

answers:

3

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.

A: 

I think you should start at http://java.sun.com/javacard/

JuanZe
+3  A: 

You're talking about GlobalPlatform and there's a right open source tool out there for this, called GPJ

martin
yes you are right and I checked it before but I want the source code for it to take a specific part which deals with the CAP file and application management. Thanks
It comes with source code!?Here's a link for you to click well: http://gpj.svn.sourceforge.net/viewvc/gpj/
martin
A: 

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