Class ASN1Set

All Implemented Interfaces:
Serializable

This class provides an ASN.1 set element, which is used to hold a set of zero or more other elements (potentially including additional "envelope" element types like other sequences and/or sets) in which the order of those elements should not be considered significant.
See Also:
  • Constructor Details

    • ASN1Set

      public ASN1Set()
      Creates a new ASN.1 set with the default BER type and no encapsulated elements.
    • ASN1Set

      public ASN1Set(byte type)
      Creates a new ASN.1 set with the specified BER type and no encapsulated elements.
      Parameters:
      type - The BER type to use for this element.
    • ASN1Set

      public ASN1Set(@Nullable ASN1Element... elements)
      Creates a new ASN.1 set with the default BER type and the provided set of elements.
      Parameters:
      elements - The set of elements to include in this set.
    • ASN1Set

      public ASN1Set(@Nullable Collection<? extends ASN1Element> elements)
      Creates a new ASN.1 set with the default BER type and the provided set of elements.
      Parameters:
      elements - The set of elements to include in this set.
    • ASN1Set

      public ASN1Set(byte type, @Nullable ASN1Element... elements)
      Creates a new ASN.1 set with the specified BER type and the provided set of elements.
      Parameters:
      type - The BER type to use for this element.
      elements - The set of elements to include in this set.
    • ASN1Set

      public ASN1Set(byte type, @Nullable Collection<? extends ASN1Element> elements)
      Creates a new ASN.1 set with the specified BER type and the provided set of elements.
      Parameters:
      type - The BER type to use for this element.
      elements - The set of elements to include in this set.
  • Method Details

    • getValueLength

      public int getValueLength()
      Retrieves the number of bytes contained in the value.
      Overrides:
      getValueLength in class ASN1Element
      Returns:
      The number of bytes contained in the value.
    • getValue

      @NotNull public byte[] getValue()
      Retrieves the encoded value for this element.
      Overrides:
      getValue in class ASN1Element
      Returns:
      The encoded value for this element.
    • encodeTo

      public void encodeTo(@NotNull ByteStringBuffer buffer)
      Appends an encoded representation of this ASN.1 element to the provided buffer.
      Overrides:
      encodeTo in class ASN1Element
      Parameters:
      buffer - The buffer to which the encoded representation should be appended.
    • elements

      Retrieves the set of encapsulated elements held in this set.
      Returns:
      The set of encapsulated elements held in this set.
    • decodeAsSet

      @NotNull public static ASN1Set decodeAsSet(@NotNull byte[] elementBytes) throws ASN1Exception
      Decodes the contents of the provided byte array as a set element.
      Parameters:
      elementBytes - The byte array to decode as an ASN.1 set element.
      Returns:
      The decoded ASN.1 set element.
      Throws:
      ASN1Exception - If the provided array cannot be decoded as a set element.
    • decodeAsSet

      Decodes the provided ASN.1 element as a set element.
      Parameters:
      element - The ASN.1 element to be decoded.
      Returns:
      The decoded ASN.1 set element.
      Throws:
      ASN1Exception - If the provided element cannot be decoded as a set element.
    • toString

      public void toString(@NotNull StringBuilder buffer)
      Appends a string representation of the value for this ASN.1 element to the provided buffer.
      Overrides:
      toString in class ASN1Element
      Parameters:
      buffer - The buffer to which to append the information.