Connected: An Internet Encyclopedia
RFC 1906 - 8. Serialization using the Basic Encoding Rules

Top: Connected: An Internet Encyclopedia
Up: Requests For Comments
Up: RFC 1906
Prev: 7. Proxy to SNMPv1
Next: 8.1. Usage Example

### 8. Serialization using the Basic Encoding Rules

When the Basic Encoding Rules [10] are used for serialization:

1. 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.

2. 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.

3. 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.

8.1. Usage Example

Next: 8.1. Usage Example

Connected: An Internet Encyclopedia
RFC 1906 - 8. Serialization using the Basic Encoding Rules