File Naming for the Converter
This section describes the names of input and output files for the Converter, and gives the correct location for these files. With some exceptions, the Converter follows the Java programming language naming conventions for default directories for input and output files. These naming conventions comply with the definitions in the Java Card Virtual Machine specification.
This section includes the following:
Input File Naming Conventions
The files input to the Converter are Java class files named with the.class
suffix. Generally, there are several class files making up a package. All the class files for a package must be located in the same directory under the root directory, following the Java programming language naming conventions. In the compact mode, the root directory can be set from the command line using the -classdir
option. If this option is not specified, the root directory defaults to the directory from which the user invoked the Converter. In the extended mode, the root directory can be set from the JSON configuration file using the baseDir
field. This is set for each package contained in the extended CAP file. If the field is not specified for a specific package, the root directory for that package defaults to the directory in which the JSON configuration file resides.
Suppose, for example, you want to convert the package java.lang
. If you use the -classdir
flag to specify the root directory as C:\
mywork, the command line is:
converter -classdir C:\
mywork java.lang
package_aid package_version
where package_aid is the application ID of the package and package_version is the user-defined version of the package.
If you use the baseDir
field to specify the root directory as C:\
mywork, the JSON field looks like this: "baseDir":"C:\\
mywork"
The Converter looks for all class files in the java.lang
package in the directory C:\
mywork\java\lang
.
Output File Naming Conventions
In the compact mode, the name of the CAP file, export file, and the Java Card Assembly file must be the last portion of the package name followed by the extensions.cap
,.exp
, and.jca
, respectively. In the extended mode, the name of the CAP file is the value of the CAP_name
field defined in the JSON configuration file followed by the .cap
extension. For the export files and Java Card Assembly files generated in this mode, the same rules as in the compact mode apply.
By default, the files output from the Converter are written to a directory called javacard
. This is a subdirectory of the input package's directory for the compact mode, or a subdirectory of the CAP name directory for the extended mode.
In the above -classdir
example, by default, the output files are written to the directory C:\
mywork\java\lang\javacard
.
In the above baseDir
example, assume that if the CAP_name
field has the "hellosample" value, by default, the output files are written to the directory C:\
mywork\
hellosample\
javacard
.
The -d
flag or the outputDir
field enable you to specify a different root directory for the output.
In the above example, if you use the -d
flag or the outputDir
field to specify the root directory for the output to beC:\
myoutput, the Converter writes the output files to the directory C:\
myoutput\java\lang\javacard
or C:\
myoutput\
hellosample\javacard
, respectively.
When generating a CAP file, the Converter creates one or more Java Card Assembly files in the output directory as an intermediate result. If you don't want a Java Card Assembly file to be produced, omit the option -out JCA
in the compact mode or set the JCA field to false
for the respective package in the JSON configuration file in the extended mode. The Converter deletes the Java Card Assembly files at the end of the conversion.
Verification of Input and Output Files
By default, the Converter invokes the Java Card technology-based off-card verifier ("Java Card off-card verifier") for every input EXP file and on the output CAP and EXP files.
-
If any of the input EXP files do not pass verification, then no output files are created.
-
If the output CAP or EXP files do not pass verification, then the output EXP and CAP files are deleted.
If you want to bypass verification of your input and output files, use the -noverify
command line option or set the noverify
field in the JSON configuration file to true
. Note that if the Converter finds any errors, output files are not produced.
Note:
When using the Java Card off-card verifier to verify an extended CAP file, all EXP files that are required by the packages and are present inside the extended CAP file, must pass the verification.Creating a debug.msk Output File
To create a debug.msk
output file:
- Set the
-mask
and-debug
options described in Table 5-2 when you run the Converter. - Verify that the file
debug.msk
is created in the same directory as the other output files.