Thoughts on the current state of ASN.1 and XML technologies.

Extending JSON Encoding Rules (JER)

ITU-T standardized the JSON encoding of ASN.1 data in X.697 (JER), but we believe customers want to support use cases the standard doesn’t address.  This post briefly describes two extensions to JER that we’re planning to implement in our ASN.1 compiler, ASN1C.  We plan to implement the first extension (for contents constraints) as an undocumented feature in a 7.3.x patch release in the September-October time frame.

Extension for Contents Constraints

The first extension relates to encoding of BIT STRING or OCTET STRING with a contents constraint.  For example:

OCTET STRING (CONTAINING SomeType)

In short, the purpose of this first extension is to allow the contained type to be encoded in JSON just as it would be encoded if it weren’t a contained type, instead of encoding it as a string of hexadecimal characters.  This extension is all about making the JSON more human-readable.  Here’s an example:

Say your ASN.1 has something like this:

   my-bit-string BIT STRING ( CONTAINING TwoStrings )
…

TwoStrings ::= SEQUENCE {
   one UTF8String,
   two UTF8String
}

The standard JER encoding would look something like:

"my-bit-string" : { "value" : "7B20226F6E6522203A20226D6F6E6579222C202274776F22203A202273686F7722207D", "length" : 280 }

Our extension would instead produce something like:

"my-bit-string" : { "value+" : { "one" : "money", "two" : "show" } }

Extension for Values of Unknown Types

The second extension relates to encoding values of unknown types, which may appear as SEQUENCE/SET/CHOICE extension elements or in open types.  It isn’t possible to convert values of unknown types from BER or PER to standard JER.  Since its type isn’t known, the value is stuck in BER or PER, so to speak.  So, in short, the purpose of our second extension is to enable converting the rest of your data to JSON while preserving what can’t be properly converted (in case you need it) and making a round trip back to the original encoding possible.  This is done by embedding the original encoding in the JSON in hexadecimal form, along with some supplemental information where necessary.

Below are some examples of the JSON that would be produced using our extension.

Handling an unknown open type value:

"some-open-type-element" : { 
   "encoding-rules+" : "BER",
   "encoded-data+" : "03020101"
}

Handling unknown SEQUENCE or SET extension elements:

"extensions+" : {
   "encoding-rules+" : "BER",
   "encoded-data+": [ "hex for extension X", "hex for extension Y" ]
}

Handling an unknown CHOICE extension element:

some-choice-field : {
   "extension+" : {
      "encoding-rules+" : "PER",
      "encoded-data+" : "04020301",
      "encoded-per-index+" : 5
   }
}

No Comments

The updated ASN1C Eclipse Plug-in

An updated version of our ASN1C Eclipse Plug-in is now available for Eclipse versions 4.6 (Neon) and higher.

A previous version of this plug-in had been available for Eclipse 3.x.  However, once Eclipse modified the way in which it installs and supports plug-ins, this version ceased to function and there was a significant delay in getting it up-to-date with newer Eclipse versions.  This upgrade is now complete.

Capabilities of this plug-in include:

  • ASN.1 editing and syntax checking
  • Code generation of C/C++, Java, and C# languages from ASN.1

Click on the “Eclipse Plugin” tab near the bottom of our ASN1C product page for more information and installation instructions.

No Comments

The ASN1C Visual Studio Wizard

You may or not be aware that ASN1C includes a Visual Studio Wizard that you can use from Visual Studio to build a library from one or more ASN.1 files. If you have at least ASN1C v732, the wizard is present and usable.

The files for the wizard are in the vswizard folder of your ASN1C installation. There are three files here that are the components of the wizard: ASN1CWizard.ico, ASN1CWizard.vsdir, and ASN1CWizard.vsz. There is also a README.txt file here that provides instructions for configuring and installing the wizard. One of the steps is to modify the .vsz file, and note in particular the instructions to remove the comment-like lines that are at the top. In ASN1C v7.4, which will likely be released in January, this .vsz file will be generated during the installation, and there will no longer be a need to edit it.

Once the files for the wizard are correct and in place, you can use Visual Studio to create a new project just like you normally would, but now you can choose ASN1C as the project type. The wizard will invoke the ASN1C GUI, with some of the irrelevant options disabled. You can use the GUI to choose the ASN.1 files and define how you want the code to be generated for your library. Then you click on the Compile button to generate the code and a Visual Studio project file. Once you exit the GUI, the project file will be loaded into Visual Studio.

No Comments

Missing DLL Error When Trying to Start ASN1VE on Windows

If you’re running a Windows system with a version of the operating system that’s older than Windows 10, there’s a chance you’ll see a pop-up box like this if you install and try to start ASN1VE:

The missing DLL is part of the Visual Studio 2015 redistributable kit. If this error occurs, it means your Windows system doesn’t have this kit.

You can download the kit and install it from here.

No Comments

New ASN1VE and ASN2TXT releases for 2019

New major releases of our ASN1VE and ASN2TXT products are now available. The primary new feature added to each is support for the new ASN.1 JSON Encoding Rules (JER) as documented in the ITU-T X.697 standard that was made public last fall. ASN1VE now has a JSON tab that shows the JSON encoding for any binary message type. In addition, the Import and Export options under the File pulldown menu allow export to, or importing from JSON. ASN2TXT support translations in both directions (binary -> JSON and JSON -> binary).

Other improvements to ASN1VE included the following:

  • Added the capability to display and edit the contents of OCTET or BIT STRING types with contents constraints (CONTAINING constructs) using the inner contained type.
  • Added level to the tag search dialog to make it possible to search for tags at a given level instead of at any level.
  • Improved PDU tag matching for BER/DER messages with UNIVERSAL tags (common in ASN.1 used in security specifications). This makes it easier to find the PDU type of a message if it is not known.
  • Changed the Windows and Mac installation procedures to install the executable files in the Program Files area and sample programs in the User area. On Windows, sample programs are now copied to the user’s Documents directory under the ASN1VE folder.

For ASN2TXT, the capability do tag path filtering was another new feature that was added. This makes it possible to find and output elements in textual form if the full ASN.1 specification is not available. This capability was further described in this blog post.

Further details can be found in the release notes:

ASN1VE Release Notes
ASN2TXT Release Notes

No Comments