Using a JSON Configuration File for Converter in the Extended Mode

In the extended mode, the Converter tool generates extended CAP files from one or multiple Java packages.

To run the Converter in the extended mode, use a JSON configuration file with the -config option. The JSON file includes fields and options that are used in the compact mode, however most of these fields and options are associated with each package contained in the CAP file.

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 follow:

  • CAP file - Includes options for the entire CAP file.
  • Package - Includes options specific to each package in the CAP file.
  • Applet - Includes options specific to each applet in a package.
  • Static resource - Includes options specific to each static resource in the CAP file.
  • Sign - Includes options specific to the signing feature of the CAP file.

Table 4-3 JSON File Options for Converter

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.
noverify CAP file Suppresses the verification of input and output files. The same rules apply to the compact mode.
verbose CAP file Enables verbose output.
outputDir CAP file Sets the root directory for output of the CAP file.
nowarn CAP file Instructs the Converter not to report warning messages.
nobanner CAP file Suppresses all banner messages.
useCapComponents CAP file Instructs the Converter to retain the user-defined CAP components instead of generating them in the final CAP bundle. The input format is as follows:

<CAP_name>/javacard/*.cap

CAP CAP file Instructs the Converter to write or not to write the CAP file to the disk.
integer CAP file Instructs the Converter to support the 32-bit integer type.
exportPath CAP file Specifies the root directories in which the Converter looks for the export files. The same rules apply for the compact mode. Note that the Java Card API framework export files directory is not required.
target CAP file Specifies the Java Card platform version on which the CAP file that is generated by the Converter (in the extended mode) is loaded. If the target is not specified, the default value would be the latest release version, that is 3.2.0. The other valid value for the current release is 3.1.0. Extended CAP files are 2.3 version CAP files no matter the target platform used.
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.
sign CAP file A JSON object representing the configuration for signing the CAP file, which is generated by the Converter.
PackageAID Package The AID of the package as defined in the compact mode.
PackageName Package The fully-qualified name of the package as defined in the compact mode.
baseDir Package Sets the root directory from where the Converter looks for the classes in the package. If this option is not specified, the Converter uses the location of the configuration file as the root directory.
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.
public Package Specifies if a package is exported or not. The values and its description follow:
  • If the value is set to true, and the package is a library, then all the public classes and interfaces are exported.
  • If the value is set to true, and the package is an applet package, then only shareable interfaces are exported.
  • If the value is set to false, nothing from the package is exported. Also, the AID field of the package will not appear in the header component of the CAP file and the AID field is ignored. Because of this, in the generated JCA files, the AID of a private package will have a random value. For a private package, the EXP file is not generated and the value of the EXP file is ignored.
version Package The user-defined version of the package as defined in the compact mode. If the package is private and the exportmap field is set to false, the version field is ignored.
JCA Package Instructs the Converter to write or not to write the JCA file to the disk for the package.
EXP Package Instructs the Converter to write or not to write the EXP file to the disk for the package.

If the package doesn't have an export component (if the package is private or an applet package with no shareable interfaces), the EXP file is not generated. Therefore, the EXP field is ignored.

exportmap Package Uses the token mapping from the predefined export file of the package. The Converter looks for the export file in the given exportpath at the CAP file level. If this field is set to false and the package is private, the version field is ignored.
applets Package An array of JSON objects. Each representing the configuration for a Java Card applet contained in this package.
ClassAID Applet Specifies the AID of the applet.
ClassName Applet Specifies the fully-qualified Java class name for this applet.
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 existing and accessible file on the disk. The contents of this file is loaded as binary data in the CAP file for the static resource.
keystore Sign The keystore used in signing.
storepass Sign The keystore password.
alias Sign The keystore alias used in signing.
passkey Sign The alias password.