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

org.bouncycastle.asn1.x500

## Class RDN

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.x500.RDN

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class RDN
      extends ASN1Object

  Holding class for a single Relative Distinguished Name (RDN).

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RDN(ASN1ObjectIdentifier oid, ASN1Encodable value)` Create a single valued RDN.
    `RDN(AttributeTypeAndValue attrTAndV)`
    `RDN(AttributeTypeAndValue[] aAndVs)` Create a multi-valued RDN.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AttributeTypeAndValue` | `getFirst()`
    `static RDN` | `getInstance(ASN1TaggedObject taggedObject, boolean declaredExplicit)`
    `static RDN` | `getInstance(java.lang.Object obj)`
    `AttributeTypeAndValue[]` | `getTypesAndValues()`
    `boolean` | `isMultiValued()`
    `int` | `size()` Return the number of AttributeTypeAndValue objects in this RDN,
    `ASN1Primitive` | `toASN1Primitive()` RelativeDistinguishedName ::= SET OF AttributeTypeAndValue AttributeTypeAndValue ::= SEQUENCE { type AttributeType, value AttributeValue }

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

      `encodeTo, encodeTo, equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode`

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

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

- - ### Constructor Detail

    - #### RDN

          public RDN(ASN1ObjectIdentifier oid,
                     ASN1Encodable value)

      Create a single valued RDN.
      Parameters:
        `oid` - RDN type.
        `value` - RDN value.

    - #### RDN

          public RDN(AttributeTypeAndValue attrTAndV)

    - #### RDN

          public RDN(AttributeTypeAndValue[] aAndVs)

      Create a multi-valued RDN.
      Parameters:
        `aAndVs` - attribute type/value pairs making up the RDN

  - ### Method Detail

    - #### getInstance

          public static RDN getInstance(java.lang.Object obj)

    - #### getInstance

          public static RDN getInstance(ASN1TaggedObject taggedObject,
                                        boolean declaredExplicit)

    - #### isMultiValued

          public boolean isMultiValued()

    - #### size

          public int size()

      Return the number of AttributeTypeAndValue objects in this RDN,
      Returns:
        size of RDN, greater than 1 if multi-valued.

    - #### getFirst

          public AttributeTypeAndValue getFirst()

    - #### getTypesAndValues

          public AttributeTypeAndValue[] getTypesAndValues()

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

           RelativeDistinguishedName ::=
                               SET OF AttributeTypeAndValue

           AttributeTypeAndValue ::= SEQUENCE {
                  type     AttributeType,
                  value    AttributeValue }

      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        this object as its ASN1Primitive type