Large Integer Support

The maximum size for a Java long integer type is 64 bits. ASN.1 has no such limitation on integer sizes and some applications (security key values for example) demand larger sizes. In order to accommodate these types of applications, the ASN1C compiler allows an integer to be declared a "big integer" via a configuration file variable (the <isBigInteger/ > setting is used to do this – see the section describing the configuration file for full details). When the compiler detects this setting, it will declare the integer class to be derived from the Asn1BigInteger class instead of the Asn1Integer class. The Asn1BigInteger class encapsulates an object of the Java BigInteger class. This provides full support for working with integers of arbitrary lengths.

For example, the following INTEGER type might be declared in the ASN.1 source file:

   SecurityKeyType ::= [APPLICATION 2] INTEGER

Then, in a configuration file used with the ASN.1 definition above, the following declaration can be made:

   <production>
      <name>SecurityKeyType</name>
      <isBigInteger/>
   </production>

This will cause the compiler to generate the following class header:

   class SecurityKeyType extends Asn1BigInteger

The value field is populated by creating a Java BigInteger object and either passing it in through the constructor or using it to directly populate the public member variable named value declared in the base class.