ASN.1 Size Constraints

Size constraints restrict the length of a bit, octet, character string, or the number of elements of a SEQUENCE OF or SET OF. The syntax used to express this is the word "SIZE" followed by the type's size limits in parentheses.

Size constraints can be used only with the following parent types:

  • BIT STRING
  • OCTET STRING
  • SEQUENCE OF
  • SET OF
  • Character string types

NOTE: Size constraints applied to OCTET STRING, BIT STRING, SEQUENCE OF, and SET OF types are PER-visible, that is, they affect PER encodings.

Example

LoginName    ::= PrintableString (SIZE (1..20))

Password     ::= OCTET STRING (SIZE (1..6))

ArgumentList ::= SET SIZE (0..10) OF Argument

EventReports ::= SEQUENCE SIZE (1..20) OF Report

Related Topics