An often requested feature from users using our ASN2TXT tool is the capability to convert ASN.1-encoded data to CSV format. Unfortunately, this is often not an easy thing to do because ASN.1 data is hierarchal in nature whereas CSV is a flat data format. The result of completely flattening an ASN.1 structure is often a large number of data fields with column names that are long and hard to read. That is because the names are formed by concatanating the names of all of the intermediate elements leading up to the final element name.
A way to make this output more presentable is to use filters to select only certain fields for inclusion in the output file and to create custom names for these fields. Filters consist of a selection path and an optional output map used to transform the column name for individual elements. ASN2TXT uses filters to match names from the input specification to decoded content. When a selection path matches, the decoded content is saved to the output CSV file; non-matching data is skipped.
Filters are specified inside of a configuration file as follows:
<asn1config> <filter> <path>[selection]</path> <map>[new column name]</map> </filter> </asn1config>
Multiple filters may be specified in a single configuration by repeating the <filter> element. The <map> item is optional; it changes the output column name for a single element.
As an example from the well known employee sample we include in many of our products, the following configuration file can be used to select only name components:
<asn1config> <filter> <path>PersonnelRecord.name.givenName</path> <map>Employee First Name</map> </filter> <filter> <path>PersonnelRecord.name.initial</path> <map>Employee Middle Initial</map> </filter> <filter> <path>PersonnelRecord.name.familyName</path> <map>Employee Last Name</map> </filter> </asn1config>
The resulting CSV outut would be as follows:
Employee First Name,Employee Middle Initial,Employee Last Name "John","P","Smith"
This is just a brief summary of the basic idea behind CSV filters. Full details can be found in the ASN2TXT User's Manual in the section on Organizing CSV Output.