ASN.1 BIT STRING tag: 03

ASN.1 BIT STRING type values are arbitrary length strings of bits. A BIT STRING value doesn't need to be an even multiple of eight bits. Similar to INTEGERs, BIT STRING type definitions can include named bit lists. You can assign a meaning to each individual bit in the string (more than one value from the list can be present in a single BIT STRING value). BIT STRING values can be described as binary strings, hexadecimal strings, or using the identifiers from a BIT STRING's named bit list. A BIT STRING containing all zero bits can be expressed using empty curly brackets.


In the following example, contents1 is equivalent to contents2:

contents1 BIT STRING ::= 'B09'H
contents2 BIT STRING ::= '101100001001'B
Color ::= BIT STRING {red(0),
defaultColors Color ::= {red, yellow}
onlyblue Color ::= {blue}
currentColors Color ::= {}
BIT STRING encoding example
Color ::= BIT STRING {red(0), blue(1), yellow(2)}

In DER, the BIT STRING type values defined in the example above are encoded as follows:


The BIT STRING type can be constrained by a single value, by type inclusion, by size, and by contents constraints.

Related Topics