Constraints verification is partially supported

ASN.1 supports constraints that can restrict possible values for types. Such constraints can be a restricted alphabet for a string type, for example for PrintableString, or user-defined constraints that are written to the ASN.1 structure definition file, for example a size limitation for an OCTET STRING.

Causes

The ASN1Parse operator supports the so-called PER-visible constraints that are:

  • Single value and range constraint for INTEGER primitive type
  • Contained subtype constraint
  • Size constraints for OCTET STRING, SET OF and SEQUENCE OF types
  • Alphabet constraints for character string types with fixed and known character widths

The following example shows constraints that are verified:


SomeIntegers ::= INTEGER ( 1 | 3 | 5 | 7 )
Int16 ::= INTEGER ( -32768 .. 32767 )
SizedOctetString ::= OCTET STRING (SIZE(5..10))
SizedIA5String ::= IA5String (SIZE(5..10))
SubsetIA5String ::= IA5String (FROM("A".."Y"))

The following example shows constraints that are not verified:


SomeReals ::= REAL ( 3.1415 | 2.7182 ) -- only supported for INTEGER
RealRange ::= REAL ( -3.3 .. 5.7 ) -- only supported for INTEGER
Answer ::= IA5String ( "yes" | "no" ) -- only supported for INTEGER