Documentation



Java Card 3 Platform Development Kit User Guide, Classic Edition

Running maskgen

The file to invoke the maskgen is a batch file (maskgen.bat) that must be run from a working directory of JC_CLASSIC_HOME\bin in order for the code to execute properly.

To run maskgen:

  1. Enter the following command (options are described in Table 11-1):

    maskgen [options] generator filename [filename ...]


Table 11-1 Command Line Arguments for the maskgen Tool

Argument Description

-help

Prints a help message.

generator

Specifies the generator, the plug-in that formats the output for a specific target platform. The generators are:

  • a51 - Output for the Keil A51 assembly language interpreter (not supported for this release).

  • cref - Output for the cref interpreter.

  • jref - Output for the Java programming language Java Card RE interpreter (not supported for this release).

  • size - Outputs mask size statistics.

In this release, the only supported generator is cref.

filename [filename...]

Any number of Java Card Assembly files can be input to maskgen as a whitespace-separated list.

You can also create a text file containing a list of Java Card Assembly file names for a new mask, and prepend an "@" character to the name of this text file as an argument to maskgen.

-c filename

Specifies a configuration file, which contains generator-specific settings. For example, the following line maps a native Java Card API method to a native label:javacard/framework/JCSystem/beginTransaction()V=beginTransaction_NM

cref_mask.cfg is an example of a maskgen configuration file.

-debuginfo

Generates debug information for the generated mask. This option is available only with the jref generator.

-nobanner

Suppresses all banner messages.

-o filename

Specifies the file name output from maskgen. If the output file is not specified, output defaults to a.out.

-version

Prints the version number of maskgen, then exits.


Order of Packages on the Command Line

The Java Card Assembly files that can be listed on the command line can belong to API packages, the installer package, or the user's library and applet packages. The Java Card Assembly files that belong to API packages must be listed first on the command line, followed by the Java Card Assembly files belonging to any applets.

If you include the installer package's Java Card Assembly file on the command line, it must be listed after all of the assembly files belonging to API packages and before the assembly files of any other applet packages.

For example:

maskgen -nobanner cref API_package_1.jca .... API_package_n.jca     
    installer_package.jca applet_package_1.jca ... 
    applet_package_n.jca

Version Numbers for Processed Packages

The packages that you specify to generate a mask can import other packages. These imported packages must share the same major and minor version number as the specified packages.

For example, presume that you are using Package A, version 1.1 to create a mask, and that Package A imports Package B, version 1.1. Then you must ensure that Package B, version 1.1 is listed in the import component of the Package A .jca file.

maskgen Example

This example uses a text file (args.txt) to pass command line arguments to maskgen:

maskgen -o mask.c cref @args.txt

where the contents of the file args.txt is:

first.jca second.jca third.jca

This is equivalent to the command line:

maskgen -o mask.c cref first.jca second.jca third.jca

This command produces an output file mask.c that is compiled with a C compiler to produce mask.o, which is linked with the Java Card RE interpreter. Refer to Using the Reference Implementation for more information about this target platform.

Close Window

Table of Contents

Java Card: 3 Platform Development Kit User Guide, Classic Edition

Expand | Collapse