The ASN.1 ENUMERATED type is used to create a list of named items. It is similar to the INTEGER type, however, for ENUMERATED, the only values permitted are those identified by name in the list. For INTEGER, the named list is just a set of useful labels for specific numbers, and does not limit what values are permitted.


Color ::= ENUMERATED {red    (0),
                      blue   (1),
                      yellow (2)}
colorOfTheSky Color ::= blue
MorP ::= ENUMERATED {minus (-1),
                      zero (0),
                      plus (1)}
negative MorP ::= minus
ENUMERATED encoding example

In BER, the ENUMERATED type value defined in the first example is encoded as follows:

0A 01 01

The ENUMERATED type value defined in the second example is encoded in BER as follows:

0A 01 FF


The ENUMERATED type can be constrained by a single value and by type inclusion.

Related Topics