CAP File Analysis & Decompilation Tool
A comprehensive parser for Java Card CAP (Converted Applet) files that interprets binary structures and converts them into human-readable format according to Java Card 3.0.5 specifications.
Scroll to explore
Understanding the Java Card compilation and conversion process
Java Card applications written in Java are first compiled using the standard Java compiler, which generates .class files containing bytecode.
The Java Card converter transforms .class files into CAP (Converted Applet) files along with .exp (export) files of imported packages.
CAP files are optimized binary packages ready for deployment on Java Card-enabled smart cards with limited memory and processing power.

Contains information about the public APIs of the entire package. Used by the Java Card converter to transform a Java package into a CAP file.
Contains comprehensive information about all package items (classes, methods, fields) represented by tokens. Consists of multiple components in big-endian byte order.

Detailed breakdown of each component in a Java Card CAP file
Contains general information about the CAP file including the package AID (Application Identifier), major and minor version numbers, and compilation metadata.
Contains an entry for each applet defined in the package with their AIDs. Not present if no applets are defined.
Lists the size of each component defined in the CAP file, providing an index for component navigation.
Contains entries for each class, method, and field referenced by the Method Component. Each 4-byte entry contains item tokens resolved by the VM at runtime.
Describes all classes and interfaces defined in the package with information for instance creation, method/field access, and cast checking. References Import Component for external superclasses.
Contains bytecode information for all methods defined in the package, including exception handlers representing catch and finally blocks.
Contains information to create and initialize an image of all static fields defined in the package.
Import Component: Lists imported packages identified by AIDs. Export Component: Describes classes, static functions, and fields offered to other packages.
Contains lists of offsets into the Method Component's info items, which are indices into the constant pool table.
Provides sufficient information to parse and verify all elements of the CAP file, ensuring structural integrity.
Contains metadata necessary for debugging a package on an instrumented Java Card VM. Not required for production execution.
Python-based CAP file analyzer conforming to Java Card 3.0.5 specifications
My parser script interprets Java Card binaries and converts binary data into human-readable format for analysis.
CapParser.py [option] .cap [option] 'component name'/'all'
Display help information and usage instructions
Specify valid path to the CAP file for analysis
Component name (e.g., 'header') or 'all' to get all component info
Important Note
All options are case sensitive. Refer to Java Card 3.0.5 Specification for detailed component structures.