Smart Card Solution
User Manual
- R502 Manual
JavaCard API Samples
- Algorithm
Java Card Specification
Knowledge Sharing
Smart Card Solution
User Manual
JavaCard API Samples
Java Card Specification
Knowledge Sharing
This chapter describes the Java Card converted applet (CAP) file format. Each CAP file contains all of the classes and interfaces defined in one Java package. Java Card Converters must be capable of producing CAP files that conform to the specification provided in this chapter.
A CAP file consists of a stream of 8-bit bytes. All 16-bit and 32-bit quantities are constructed by reading in two and four consecutive 8-bit bytes, respectively. Multibyte data items are always stored in big-endian order, where the high-order bytes come first. The first bit read of an 8-bit quantity is considered the high bit.
This chapter defines its own set of data types representing Java Card CAP file data: the types u1, and u2 represent an unsigned one-, and two-byte quantities, respectively. Some u1 types are represented as bitfield structures, consisting of arrays of bits. The zeroeth bit in each bit array represents the most significant bit, or high bit.
The Java Card CAP file format is presented using pseudo structures written in a C-like structure notation. To avoid confusion with the fields of Java Card virtual machine classes and class instances, the contents of the structures describing the Java Card CAP file format are referred to as items. Unlike the fields of a C structure, successive items are stored in the Java Card platform file sequentially, without padding or alignment.
Variable-sized tables, consisting of variable-sized items, are used in several CAP file data structures. Although we will use C-like array syntax to refer to table items, the fact that tables are streams of variable-sized structures means that it is not possible to directly translate a table index into a byte offset into the table.
A data structure referred to as an array consists of items equal in size.
Some items in the structures of the CAP file format are describe using a C-like union notation. The bytes contained in a union structure have one of the two formats. Selection of the two formats is based on the value of the high bit of the structure.