Where is the value notation used in ASN.1 and why?

Value notation is used in:

  • describing default values (i.e., the value that is assumed for a type if an encoding for that type is not physically present);
  • describing values used in subtype constraints (restrictions on the values of a type such as the values an integer can assume or the maximum size of a string);
  • defining information object sets that are used in restricting values that certain types can carry, or in restricting the type of value that can be carried by an open type, a field whose type is not determined until runtime;
  • creating abstract examples of messages. Such abstract examples are simpler to write and read compared to most other means of writing values of potentially complex types.

It is accurate to view value references as constants. You see examples of values, as described below. Some ASN.1 toolkits make little or no use of value notation, while others use them to their fullest to make life easier for you.

For example, the OSS ASN.1 Tools uses default values to determine whether it should encode a value when the Distinguished Encoding Rules are in use, because DER stipulates that default values should never be transmitted. Also, upon returning from ossDecode(), if a value of a given field was not present in the encoding and a default value was defined for it, then the default value is returned to your program as if it were present in the encoding.

The OSS ASN.1 Tools uses values specified in subtype constraints to enforce strong constraint checking at runtime (unless you elect to disable this feature.) For example, for an INTEGER type defined to carry values 7, 10 and 20-33, the OSS encoder/decoder will complain if the value is not one of these.

The OSS ASN.1 Tools uses values specified in information object set definitions to allow it to enforce component relation constraints (restrictions imposed on one field based on the value of another field) and to automatically encode or decode nested open type values via a single call to the encoder or decoder, if you elect to use this feature.

When the -test option of the OSS ASN.1 Compiler is specified it causes the compiler to generate a complete program to encode, decode, print, etc. values defined via value assignments. The value is encoded in BER, PER and DER, and printed in value notation and hex formats. This makes it easy for you to see what the encodings might look like in the various encoding rules without your having to write a program to encode and print the values.


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
download

Test drive the OSS Nokalva ASN.1, LTE, 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.