What are the OBJECT IDENTIFIER values that are allowed by the standard and how are they encoded?

The OBJECT IDENTIFIER cannot have arbitrary values for the first 2 arcs. The first arc can be ONLY 0, 1 and 2. The second arc cannot exceed 4 if the first arc is 0 and cannot exceed 3 if the first arc is 1. The minimum number of arcs in OBJECT IDENTIFIER values is 2.

A number of protocols were created violating the above standard rules. So to compile erroneously written ASN.1, we introduced the ASN.1 compiler command line option -allowbadvalues which allows bad value notation like:

{0 9 2342 19200300 100 1 2}

Keep in mind that in contrast to the encoder, the decoder is not concerned if you pass a valid arc or not. Very often the problem is that one of the arcs exceeds the maximum value for a given ASN.1 compiler generated OBJECT IDENTIFIER representation, like a linked list for example:

typedef struct ObjectID {
struct ObjectID *next;
unsigned short value;
} *ObjectID;

In such a case, the arc 19200300 would not fit into a short integer representation and you would need to use the following directive along with the -allowbadvalues command line option to force generation of unsigned long instead:

p P ::= {0 9 2342 19200300 100 1 25}


The samples included with some of the Knowledge Center answers are meant for your general understanding of the OSS products. Different versions of the products might produce slightly different outputs. Consult the products documentation and samples for the most up-to-date products information and code examples.

Contact Support
contact Our office hours
24 hours/day, 7 days/week

  • Phone: 1-888-OSS-2761 (USA and Canada)
  • Phone: 1-732-302-9669 (International)
  • Fax: 1-732-302-0023
  • Email: support@oss.com
Free Trial

Test drive the OSS Nokalva ASN.1, 4G and XML Tools now! Your trial includes complete software, documentation, sample programs, free 24x7 technical support and more.

Learn ASN.1
Learn ASN.1

Our expert personnel can help you learn ASN.1!

We offer 4-day ASN.1 courses at our headquarters or your premises.