ASN.1 to Java Compiler

The ASN.1 to Java Compiler can automatically translate ASN.1 specifications into Java classes that can be easily integrated into your applications.

The compiler has two components: the ASN.1 Java Code Generator and the ASN.1 Java Runtime Library.

ASN.1 Java Code Generator

The ASN.1 Java Code Generator takes a set of ASN.1 modules as input and automatically generates Java classes corresponding to ASN.1 types. The Code Generator generates system-independent Java code.

The mapping between ASN.1 types and Java classes is quite straightforward and intuitive. The ASN.1 Java Code Generator always generates type as primitive as possible, the following table lists the mapping from ASN.1 types to Java types:

ASN.1 TypeMapping to Java Type
BOOLEANBoolean
NULLObject
INTEGER Integer/Long
ENUMERATEDenum/singleton class1
REALFloat/Double
BIT STRINGGenerated Class
OCTET STRINGbyte[]
OBJECT IDENTIFIERObjectIdentifier2
RELATIVE-OIDObjectIdentifier
Character StringsString
GeneralizedTimeDate
UTCTimeDate
CHOICEGenerated Class
SEQUENCE/SETGenerated Class
SEQUENCE OF/SET OFVector3

ASN.1 Java Runtime Library

The ASN.1 Java runtime library facilitate encode, decode and various other operations on application messages. All routines are written completely in Java and can be run on any JVM, including resource limited environments like mobile phone, PDA, etc.

Features

FeatureASN.1 to Java Compiler
BER (Basic Encoding Rules)YES
CER (a canonical BER subset)YES
DER (another canonical BER subset)YES
PER (Packed Encoding Rules)YES, align and unaligned PER
XER (XML Encoding Rules)NO
Subtype constraintsYES
Information Object ClassesYES
Target languageJava
Execution envionmentJava SE/Java ME

Strength

Known limitations


1) singleton class is for J2SE 1.4 or under where enum type is not support.
2) wrap type over an id array, i.e. int[].
3) if type parameter is support, the Vector is parametered with component type.