ASN.1 SET OF tag: 17

The ASN.1 SET OF type is similar to the SEQUENCE OF type. It indicates an arbitrary length list of values of the same type, however, unlike SEQUENCE OF, the elements can be encoded in any order.

Using SET OF types can sometimes make implementation of encoding/decoding software more difficult; therefore it is recommended to use the SEQUENCE OF type whenever possible.

Example

PersonnelRecord ::=  SET {
              name  IA5String,
              location  INTEGER {
                         homeOffice(0),
                         fieldOffice(1),
                         roving(2)} OPTIONAL,
               age  INTEGER OPTIONAL
}

PersonnelFile ::= SET OF PersonnelRecord
SET OF encoding example

The encoding of SET OF is similar to the encoding of SEQUENCE OF.

DailyTemperatures ::= SET OF INTEGER
weeklyHighs DailyTemperatures ::= {10, 12, -2, 8}

In BER, the SET OF type values defined in the example above are encoded as follows:

31 0C
   02010A
   02010C
   0201FE
   020108

Constraints

The SET OF type can be constrained by a single value, by type inclusion, by size, and by constraints on its components (inner subtyping).

Related Topics