UnboundID LDAP SDK for Java

LDAP SDK Home Page
Product Information
Getting Started with the LDAP SDK

ASN.1 BER Processing

LDAP communication is encoded using the basic encoding rules (BER) subset of the ASN.1 (abstract syntax notation one). This is a binary encoding mechanism that is compact and efficient to process. The LDAP SDK uses ASN.1 extensively to encode and decode requests and responses. For most purposes, it should not be necessary for clients using the LDAP SDK to perform any ASN.1 processing. However, it may be necessary to perform custom encoding/decoding if you wish to add support for additional controls and/or extended operations. Further, some SDK components use ASN.1 octet string elements in cases where a value can be treated as either a string or a byte array.

Generic ASN.1 elements (instances of the ASN1Element class) have type (which is a single byte) and a value (which is a byte array). It also provides methods for encoding elements to and decoding from byte arrays, for writing encoded elements to an output stream, and for reading them from an input stream.

All other types of ASN.1 elements are subclasses of the generic ASN1Element. They include:

  • ASN1OctetString -- Used to hold generic data. It may be possible to interpret the value as a string.

  • ASN1Null -- Used for elements which have zero-length values (generally as a placeholder).

  • ASN1Boolean -- Used to hold Boolean values of "true" or "false".

  • ASN1Integer -- Used to hold 32-bit integer values.

  • ASN1Long -- Used to hold 64-bit integer values.

  • ASN1Enumerated -- Used to hold integer values in which each value has a particular meaning in the associated context.

  • ASNSequence -- Used to hold a collection of other ASN.1 elements in which the order of the elements should be considered significant.

  • ASN1Set -- Used to hold a collection of other ASN.1 elements in which the order of the elements is not considered significant.