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

org.bouncycastle.asn1

## Class DERSet

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.ASN1Primitive
    - - org.bouncycastle.asn1.ASN1Set
      - - org.bouncycastle.asn1.DERSet

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

      public class DERSet
      extends ASN1Set

  A DER encoded SET object

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

  For short: Constructing this form does sort the supplied elements, and the sorting happens also before serialization (if necesssary). This is different from the way `BERSet`,`DLSet` does things.

- - ### Field Summary

    - ### Fields inherited from class org.bouncycastle.asn1.ASN1Set

      `elements, sortedElements`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DERSet()` create an empty set
    `DERSet(ASN1Encodable element)` create a set containing one object
    `DERSet(ASN1Encodable[] elements)` create a set containing an array of objects.
    `DERSet(ASN1EncodableVector elementVector)` create a set containing a vector of objects.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static DERSet` | `convert(ASN1Set set)`

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

      `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`

- - ### Constructor Detail

    - #### DERSet

          public DERSet()

      create an empty set

    - #### DERSet

          public DERSet(ASN1Encodable element)

      create a set containing one object
      Parameters:
        `element` - the object to go in the set

    - #### DERSet

          public DERSet(ASN1EncodableVector elementVector)

      create a set containing a vector of objects.
      Parameters:
        `elementVector` - the vector of objects to make up the set.

    - #### DERSet

          public DERSet(ASN1Encodable[] elements)

      create a set containing an array of objects.
      Parameters:
        `elements` - the array of objects to make up the set.

  - ### Method Detail

    - #### convert

          public static DERSet convert(ASN1Set set)