BERSequence (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.asn1

## Class BERSequence

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.ASN1Primitive
    - - org.bouncycastle.asn1.ASN1Sequence
      - - org.bouncycastle.asn1.BERSequence

- All Implemented Interfaces:
    java.lang.Iterable<ASN1Encodable>, ASN1Encodable, Encodable

      public class BERSequence
      extends ASN1Sequence

  Indefinite length SEQUENCE of objects.

  Length field has value 0x80, and the sequence ends with two bytes of: 0x00, 0x00.

  For X.690 syntax rules, see `ASN1Sequence`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static BERSequence` | `EMPTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BERSequence()` Create an empty sequence.
    `BERSequence(ASN1Encodable element)` Create a sequence containing one object.
    `BERSequence(ASN1Encodable[] elements)` Create a sequence containing an array of objects.
    `BERSequence(ASN1Encodable element1, ASN1Encodable element2)` Create a sequence containing two objects.
    `BERSequence(ASN1EncodableVector elementVector)` Create a sequence containing a vector of objects.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static BERSequence` | `fromElementsOptional(ASN1Encodable[] elements)`

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Sequence

      `getInstance, getInstance, getObjectAt, getObjects, getTagged, hashCode, iterator, parser, size, toArray, toString`

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Primitive

      `encodeTo, encodeTo, equals, equals, equals, fromByteArray, fromStream, toASN1Primitive`

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Object

      `getEncoded, getEncoded, hasEncodedTagValue`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Field Detail

    - #### EMPTY

          public static final BERSequence EMPTY

  - ### Constructor Detail

    - #### BERSequence

          public BERSequence()

      Create an empty sequence.

    - #### BERSequence

          public BERSequence(ASN1Encodable element)

      Create a sequence containing one object.
      Parameters:
        `element` - the object to go in the sequence.

    - #### BERSequence

          public BERSequence(ASN1Encodable element1,
                             ASN1Encodable element2)

      Create a sequence containing two objects.
      Parameters:
        `element1` - the first object to go in the sequence.
        `element2` - the second object to go in the sequence.

    - #### BERSequence

          public BERSequence(ASN1EncodableVector elementVector)

      Create a sequence containing a vector of objects.

    - #### BERSequence

          public BERSequence(ASN1Encodable[] elements)

      Create a sequence containing an array of objects.

  - ### Method Detail

    - #### fromElementsOptional

          public static BERSequence fromElementsOptional(ASN1Encodable[] elements)