ASN.1 Viewer

ASN.1

Included in v1.29.31 beta or later

This option can be used to display ASN.1 data structures, either from a file or manual entry.  Support for DER, PEM, PKCS#7, and PKCS#12 file formats. The manual entry provides the option to enter an ASN.1 data structures as either hex or base64 data.

The toolbar is used to open files, enter or edit data, and control what information is displayed.  The details of the toolbar options is shown below.

You can manually enter the ASN.1 data by clicking on the Data Entry button, which will display the Data Entry form.  It's possible to paste the data from other options in NetTools, or manually enter the data in hex or base64 format.  For the hex entry the data is entered as bytes separated by a spaces, the same format that is produced by the base64 Hex Dump (No ANSII) option, or a continuous stream of hex bytes with no spaces, the same as Hex Stream produced by Wireshark. Once the data has been entered, the option to save the data back to a file is enabled.  The data is written in a binary format.  If PEM format is required, then the Data Entry option should be used to copy the data in Base64 format and copied manually to a text file with the required PEM headers and footers.

ANS.1 Hex Format
ANS.1 Hex Format
ASN.1 Base64 Format

There are a couple of ways to view the ASN.1 details, a tree view and a hex data dump.  The tree view is always displayed when a file is selected or data entered.  The hex dump view is selected via the toolbar, and can be displayed either at the bottom or the right side of the tree view. When an item is selected in the tree view, the corresponding data is highlighted in the hex view.

ASN.1 Hex Dump Bottom
ASN.1 Hex Dump Right

The tree view can display a number of the common primitive BER/DER data type tags.  However, when a Display Type doesn't exist for a tag, then the data in the tag is displayed as a hex dump.  The ASN.1 Viewer also includes the ability to select an alternative display type that should be used to display the data, these are selected from the context menu.

When an alternative Display Type is selected, the icon of the item is changed to the cogs icon, to show that a user defined Display Type has been selected. As shown below the left picture doesn't have any Display Type assigned and normal icons are displayed, while right picture shows the same items with the Hex Dump Display Type assigned with the cogs icon.

No User Decode Defined
Hex Decode Dump Assigned

The Constructed option on the context menu doesn't define a Display Type, instead it is used to set the Primitive/Constructed flag in the tag header to Constructed, this will cause the item to be treaded like an item which contains BER encoded sub items.

Once a user assigned Display Type has been assigned, it can be cleared via the context menu Clear Assignment option, or using the Clear all Display Type assignments toolbar button.  The Display Type assignments will be cleared when a new file is loaded or the data is edited.

The viewer doesn't support the loading or defining of ASN.1 schema definitions, instead it uses a number of predefined Display Types based on Object Identifiers (OID). These are predefined Display Types are focused on X.509 certificate OIDs, and cover the common field types, however, it doesn't cover all possible field types, the user assigned Display Type can be used to correctly display these fields.  The OID based Display Types can be turned off via the toolbar button.

While the viewer is not intended to be an ASN.1 editor or file creation tool, it does provide the ability to change data via the Data Entry option on the toolbar.  In the Hex view it’s then possible to change the raw data.  Once complete the updated information will be displayed in the tree view.  If data structure is invalid, details of the issue will be displayed.

ASN1 Data Error

The last option on the toolbar is to display additional information, when the option is pressed the treeview will display tadditional information.

Show Additional Information

The additional information includes, the bytes of the tag and length fields, the offset in the file, Tag, Class, Primitive or Constructed, Length, the OID Display Type Index, Display Type.

This is the Key:

O: = Offset, the position of the tag in the file
T: = Tag, the BER/DER tag assigned to the item
C: = Class, the BER class, 0 Universal, 1 - Application, 2- Context Specific, 3 - Private
P/C: = Primitive or Constructed
L: = Length, the length of the data of the item
DN: OID Display Type Index, internal number of the OID Display Type definition
DT: = Display Tag, the alternative Display Type that has been assigned