ASN.1 Made Simple — Why ASN.1?

Whether you're an experienced user or just starting, it may be hard to pick the right schema technology out of many popular alternatives such as ASN.1, JSON Schema, and Google Protocol Buffers. There are the two important factors that may help you with your decision - schema expressivity and schema authority. Both will allow your solution to grow without compromising its integrity and to avoid punitive costs.

Schema Expressivity

Writing a schema requires a good balance between being under- and over-expressive. In this regard, writing a JSON Schema can easily include both of those extremes, on the one hand it allows defining only parts of the entire message, on the other hand it allows complex (algorithmic) expressions (such as if/then, not, anyOf/allOf, etc.) which are hard to follow.

An under-expressive schema is close to no schema at all, it lacks the structural integrity of the data it's meant to validate.

An over-expressive schema may be hard to interpret and prone to human errors, e.g. its semantics can be easily "lost in translation".

An ASN.1 schema offers a middle ground. It requires a complete definition of every field in the message and it is easily read by a human/designer.

A schema for a basic empty object (example)
JSON Schema ASN.1 Schema
  "additionalProperties": false,
  "definitions": {},
  "description": "Empty Object",
  "properties": {},
  "type": [
-- Empty Object
EmptyObject ::= SEQUENCE {}

Schema Authority

Schema evolution is a boon. However, technologies that are too permissive, i.e. offer too much backward and forward compatibility, are prone to spill the data validation throughout the entire application code base. In the end, whether you want it or not, when you choose to communicate with Protobuf or JSON Schema, you have to utilize more developers and spend more time to ensure the sanity of your data.

An ASN.1 schema allows extensibility (an evolution) as well, but it does this in a predictable way, at compile-time (as in strongly-typed data), ensuring schema authority and a well-defined boundary for the validation logic. ASN.1 technology offers a "right time, right place" solution for scaling larger applications without compromising data integrity.