When the Basic Encoding Rules [10] are used for serialization:
When encoding the length field, only the definite form is used; use
of the indefinite form encoding is prohibited. Note that when
using the definite-long form, it is permissible to use more than
the minimum number of length octets necessary to encode the length
field.
When encoding the value field, the primitive form shall be used for
all simple types, i.e., INTEGER, OCTET STRING, and OBJECT
IDENTIFIER (either IMPLICIT or explicit). The constructed form of
encoding shall be used only for structured types, i.e., a SEQUENCE
or an IMPLICIT SEQUENCE.
When encoding an object whose syntax is described using the BITS
construct, the value is encoded as an OCTET STRING, in which all
the named bits in (the definition of) the bitstring, commencing
with the first bit and proceeding to the last bit, are placed in
bits 8 to 1 of the first octet, followed by bits 8 to 1 of each
subsequent octet in turn, followed by as many bits as are needed of
the final subsequent octet, commencing with bit 8. Remaining bits,
if any, of the final octet are set to zero on generation and
ignored on receipt.
These restrictions apply to all aspects of ASN.1 encoding, including
the message wrappers, protocol data units, and the data objects they
contain.