Using a JSON Configuration File for capgen in the Extended Mode

In the extended mode, the capgen tool generates extended CAP files, from one or multiple Java Card Assembly files.

For using the capgen tool in the extended mode, a JSON configuration file must be used with the -config option. This JSON file is similar to the one used by the Converter tool (see Using a JSON Configuration File for Converter in the Extended Mode ). The only difference is, some of the general conversion parameters that are used by the Converter tool, including the export paths, are not used by the capgen tool. This is because, this information is already present in the JCA files. For each of the package, only the path to the JCA files is provided. The information that is not present in the JCA files remain in the JSON file, similar to the extended CAP file information and static resources information.

The configuration in the JSON file is a JSON object with a single field, inputConfig. All other fields are defined inside this field at different levels of hierarchy. The description of levels follows:

Table 5-5 JSON File Options for capgen

Option Level Description
CAP_AID CAP file The AID of the CAP file available as an executable load module.
CAP_name CAP file The name of the CAP file generated by the Converter. On the disk, the name of the CAP file would look like <CAP_name>.cap and all the components inside the CAP file will be located in the <CAP_name>/javacard directory.
CAP_version CAP file The user-defined version of the CAP file as an executable load module.
debug CAP file Generates the optional debug component of a CAP file. The same rules apply to the compact mode.
outputDir CAP file Sets the root directory for output of the CAP file.
inputPackages CAP file An array of JSON objects, each representing the configuration for the Java package to be converted and added to the CAP file.
staticResources CAP file An array of JSON objects. Each representing the configuration for a static resource to be loaded on the CAP file.
jcainputfile Package

A valid path to an existent and accessible Java Card Assembly file converted for this package.

This path can be given as a relative path. Relative paths conform to the same rules as the Converter JSON configuration files. These are relative to the location of the JSON configuration file.

outputDir Package Sets the root directory for output of the JCA and EXP files generated for this package. The same rules apply for the compact mode. If this option is not set, the baseDir value is taken.
id Static Resource An integer representing the identification number for the static resource. The static resource IDs must be unique across the CAP file.
file Static Resource A valid system path to an existent and accessible file on the disk. The contents of this file is loaded as binary data in the CAP file for the static resource.