General Mapping without ASN.1 Schema Information

A BER, DER, or CER encoded data stream may be translated to XML format without providing associated ASN.1 schema information. In this case, XML element names are derived from built-in ASN.1 tag information contained within the message and values are encoded as either hexadecimal text, ASCII text, or as specific data-typed values if universal tag information is present.

XML element names derived from ASN.1 tag names for all tags except known universal tags is in the following general form:

<TagClass_TagValue>

where TagClass is the tag class name (APPLICATION, CONTEXT, or PRIVATE) and TagValue is the numeric tag value. For example, an [APPLICATION 1] tag would be printed as <APPLICATION_1> and a [0] tag (context-specific zero) would be printed as <CONTEXT_0>.

In the case of known universal tags, the tag value is derived using the name of the known type. In general, this is the type name defined in the ASN.1 standard with an underscore character used in place of embedded whitespace if it exists. The following table shows the XML tag names for the known types:

Tag XML Element Name
UNIVERSAL 1 BOOLEAN
UNIVERSAL 2 INTEGER
UNIVERSAL 3 BIT_STRING
UNIVERSAL 4 OCTET_STRING
UNIVERSAL 5 NULL
UNIVERSAL 6 OBJECT_IDENTIFIER
UNIVERSAL 7 OBJECT_DESCRIPTOR
UNIVERSAL 8 EXTERNAL
UNIVERSAL 9 REAL
UNIVERSAL 10 ENUMERATED
UNIVERSAL 11 EMBEDDED_PDV
UNIVERSAL 12 UTF8STRING
UNIVERSAL 13 RELATIVE_OID
UNIVERSAL 16 SEQUENCE
UNIVERSAL 17 SET
UNIVERSAL 18-22, 25-30 Character string
UNIVERSAL 23 UTCTIME
UNIVERSAL 24 GENERALIZEDTIME

Element content will be formatted in one of three ways: hexadecimal text, ASCII (character) text, or specific-typed value.

Hexadecimal text is the default format for untyped content. ASCII text will be used if the -ascii command-line switch is specified and all byte values within a particular field are determined to be printable ASCII characters. A specific-type value encoding will be done if a known universal tag is found. The mapping in this case will be as described in the "Specific ASN.1 Type to XML Value Mapping" section below.