asn.1der

ASN.1 schema compatibility


Does ASN.1 schema support some form of well-defined set of backward/forward-compatible changes?

I worked with protobuf and it allows changing schema in a way that clients using old schema would continue to work normally. Is there the same for ASN.1, I mean some set of rules which one has to follow to be sure he won't break clients using old schema?

In particular is that possible to add new (probably optional) field to SEQUENCE or add/remove CHOICE? Tried googling that, but didn't find appropriate article regarding this.


Solution

  • Yes, ASN.1 supports forward/backward capability. However, it starts with the original definition. E.g. for a sequence, if a client is built based on the following definition

    NetworkLocation ::= [APPLICATION 156] SEQUENCE
    {
       recEntityCode RecEntityCode OPTIONAL,
       callReference CallReference OPTIONAL,
       locationArea LocationArea OPTIONAL,
       cellId CellId OPTIONAL,
       ...                            -- future versions may add fields here
    }
    

    it should be built in a was, that it accepts further fields as part of this type where the ellipsis is. Naturally, in any future version of the specification, additional fields should be OPTIONAL. The same is true for the definition of CHOICEs and ENUMERATED types.