ASN.1 Contents Constraints

Contents constraints allow you to embed one kind of encoding into another. A constraint on a BIT STRING or OCTET STRING type specifies either that the contents will be an encoding of a specified ASN.1 type, or that specified procedures will be used to produce and process the contents.

Example

Ex1 shows how an OCTET STRING contains a PER INTEGER. The ENCODED BY field specifies the encoding rules used. Each of the encoding rules has an associated OBJECT IDENTIFIER (unaligned PER). Ex1 shows the OID inline; Ex2 shows it in a separate value referred to by the ENCODED BY.

Ex1 ::= OCTET STRING (
           CONTAINING INTEGER
           ENCODED BY {joint-iso-itu-t(2) asn1(1)
           packed-encoding(3) basic(0) aligned(0)})

enc-PER-Aligned OBJECT IDENTIFIER ::=
           {joint-iso-itu-t(2) asn1(1)
           packed-encoding(3) basic(0) aligned(0)}

Ex2 ::= BIT STRING (
           CONTAINING IA5String (SIZE(0..8))
           ENCODED BY enc-PER-Aligned)

Related Topics