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

org.bouncycastle.asn1.cms

## Class AttributeTable

- java.lang.Object
- - org.bouncycastle.asn1.cms.AttributeTable

-     public class AttributeTable
      extends java.lang.Object

  This is helper tool to construct `Attributes` sets.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AttributeTable(ASN1EncodableVector v)`
    `AttributeTable(ASN1Set s)`
    `AttributeTable(Attribute attr)`
    `AttributeTable(Attributes attrs)`
    `AttributeTable(java.util.Hashtable attrs)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AttributeTable` | `add(ASN1ObjectIdentifier attrType, ASN1Encodable attrValue)` Return a new table with the passed in attribute added.
    `Attribute` | `get(ASN1ObjectIdentifier oid)` Return the first attribute matching the OBJECT IDENTIFIER oid.
    `ASN1EncodableVector` | `getAll(ASN1ObjectIdentifier oid)` Return all the attributes matching the OBJECT IDENTIFIER oid.
    `boolean` | `hasAny(ASN1ObjectIdentifier oid)`
    `AttributeTable` | `remove(ASN1ObjectIdentifier attrType)`
    `int` | `size()`
    `ASN1EncodableVector` | `toASN1EncodableVector()`
    `Attributes` | `toASN1Structure()`
    `java.util.Hashtable` | `toHashtable()`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AttributeTable

          public AttributeTable(java.util.Hashtable attrs)

    - #### AttributeTable

          public AttributeTable(ASN1EncodableVector v)

    - #### AttributeTable

          public AttributeTable(ASN1Set s)

    - #### AttributeTable

          public AttributeTable(Attribute attr)

    - #### AttributeTable

          public AttributeTable(Attributes attrs)

  - ### Method Detail

    - #### get

          public Attribute get(ASN1ObjectIdentifier oid)

      Return the first attribute matching the OBJECT IDENTIFIER oid.
      Parameters:
        `oid` - type of attribute required.
      Returns:
        first attribute found of type oid.

    - #### getAll

          public ASN1EncodableVector getAll(ASN1ObjectIdentifier oid)

      Return all the attributes matching the OBJECT IDENTIFIER oid. The vector will be empty if there are no attributes of the required type present.
      Parameters:
        `oid` - type of attribute required.
      Returns:
        a vector of all the attributes found of type oid.

    - #### hasAny

          public boolean hasAny(ASN1ObjectIdentifier oid)

    - #### size

          public int size()

    - #### toHashtable

          public java.util.Hashtable toHashtable()

    - #### toASN1EncodableVector

          public ASN1EncodableVector toASN1EncodableVector()

    - #### toASN1Structure

          public Attributes toASN1Structure()

    - #### add

          public AttributeTable add(ASN1ObjectIdentifier attrType,
                                    ASN1Encodable attrValue)

      Return a new table with the passed in attribute added.
      Parameters:
        `attrType` - the type of the attribute to add.
        `attrValue` - the value corresponding to the attribute (will be wrapped in a SET).
      Returns:
        a new table with the extra attribute in it.

    - #### remove

          public AttributeTable remove(ASN1ObjectIdentifier attrType)