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

org.bouncycastle.asn1.x500

## Class X500NameBuilder

- java.lang.Object
- - org.bouncycastle.asn1.x500.X500NameBuilder

-     public class X500NameBuilder
      extends java.lang.Object

  A builder class for making X.500 Name objects.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `X500NameBuilder()` Constructor using the default style (BCStyle).
    `X500NameBuilder(X500NameStyle style)` Constructor using a specified style.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `X500NameBuilder` | `addMultiValuedRDN(ASN1ObjectIdentifier[] oids, ASN1Encodable[] values)` Add a multi-valued RDN made up of the passed in OIDs and associated ASN.1 values.
    `X500NameBuilder` | `addMultiValuedRDN(ASN1ObjectIdentifier[] oids, java.lang.String[] values)` Add a multi-valued RDN made up of the passed in OIDs and associated string values.
    `X500NameBuilder` | `addMultiValuedRDN(AttributeTypeAndValue[] attrTAndVs)` Add an RDN based on the passed in AttributeTypeAndValues.
    `X500NameBuilder` | `addRDN(ASN1ObjectIdentifier oid, ASN1Encodable value)` Add an RDN based on a single OID and an ASN.1 value.
    `X500NameBuilder` | `addRDN(ASN1ObjectIdentifier oid, java.lang.String value)` Add an RDN based on a single OID and a string representation of its value.
    `X500NameBuilder` | `addRDN(AttributeTypeAndValue attrTAndV)` Add an RDN based on the passed in AttributeTypeAndValue.
    `X500Name` | `build()` Build an X.500 name for the current builder state.
    `RDN[]` | `buildRDNs()`
    `X500NameStyle` | `getStyle()`

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

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

- - ### Constructor Detail

    - #### X500NameBuilder

          public X500NameBuilder()

      Constructor using the default style (BCStyle).

    - #### X500NameBuilder

          public X500NameBuilder(X500NameStyle style)

      Constructor using a specified style.
      Parameters:
        `style` - the X500NameStyle for string to DN conversion.

  - ### Method Detail

    - #### getStyle

          public X500NameStyle getStyle()

    - #### addRDN

          public X500NameBuilder addRDN(ASN1ObjectIdentifier oid,
                                        java.lang.String value)

      Add an RDN based on a single OID and a string representation of its value.
      Parameters:
        `oid` - the OID for this RDN.
        `value` - the string representation of the value the OID refers to.
      Returns:
        the current builder instance.

    - #### addRDN

          public X500NameBuilder addRDN(ASN1ObjectIdentifier oid,
                                        ASN1Encodable value)

      Add an RDN based on a single OID and an ASN.1 value.
      Parameters:
        `oid` - the OID for this RDN.
        `value` - the ASN.1 value the OID refers to.
      Returns:
        the current builder instance.

    - #### addRDN

          public X500NameBuilder addRDN(AttributeTypeAndValue attrTAndV)

      Add an RDN based on the passed in AttributeTypeAndValue.
      Parameters:
        `attrTAndV` - the AttributeTypeAndValue to build the RDN from.
      Returns:
        the current builder instance.

    - #### addMultiValuedRDN

          public X500NameBuilder addMultiValuedRDN(ASN1ObjectIdentifier[] oids,
                                                   java.lang.String[] values)

      Add a multi-valued RDN made up of the passed in OIDs and associated string values.
      Parameters:
        `oids` - the OIDs making up the RDN.
        `values` - the string representation of the values the OIDs refer to.
      Returns:
        the current builder instance.

    - #### addMultiValuedRDN

          public X500NameBuilder addMultiValuedRDN(ASN1ObjectIdentifier[] oids,
                                                   ASN1Encodable[] values)

      Add a multi-valued RDN made up of the passed in OIDs and associated ASN.1 values.
      Parameters:
        `oids` - the OIDs making up the RDN.
        `values` - the ASN.1 values the OIDs refer to.
      Returns:
        the current builder instance.

    - #### addMultiValuedRDN

          public X500NameBuilder addMultiValuedRDN(AttributeTypeAndValue[] attrTAndVs)

      Add an RDN based on the passed in AttributeTypeAndValues.
      Parameters:
        `attrTAndVs` - the AttributeTypeAndValues to build the RDN from.
      Returns:
        the current builder instance.

    - #### build

          public X500Name build()

      Build an X.500 name for the current builder state.
      Returns:
        a new X.500 name.

    - #### buildRDNs

          public RDN[] buildRDNs()