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

org.bouncycastle.asn1.x500

## Class DirectoryString

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

- All Implemented Interfaces:
    ASN1Choice, ASN1Encodable, ASN1String, Encodable

      public class DirectoryString
      extends ASN1Object
      implements ASN1Choice, ASN1String

  The DirectoryString CHOICE object.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DirectoryString(java.lang.String string)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static DirectoryString` | `getInstance(ASN1TaggedObject taggedObject, boolean declaredExplicit)`
    `static DirectoryString` | `getInstance(java.lang.Object o)`
    `java.lang.String` | `getString()` Return a Java String representation of this STRING type's content.
    `static DirectoryString` | `getTagged(ASN1TaggedObject taggedObject, boolean declaredExplicit)`
    `ASN1Primitive` | `toASN1Primitive()` DirectoryString ::= CHOICE { teletexString TeletexString (SIZE (1..MAX)), printableString PrintableString (SIZE (1..MAX)), universalString UniversalString (SIZE (1..MAX)), utf8String UTF8String (SIZE (1..MAX)), bmpString BMPString (SIZE (1..MAX)) }
    `java.lang.String` | `toString()`

    - ### 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, wait, wait, wait`

- - ### Constructor Detail

    - #### DirectoryString

          public DirectoryString(java.lang.String string)

  - ### Method Detail

    - #### getInstance

          public static DirectoryString getInstance(java.lang.Object o)

    - #### getInstance

          public static DirectoryString getInstance(ASN1TaggedObject taggedObject,
                                                    boolean declaredExplicit)

    - #### getTagged

          public static DirectoryString getTagged(ASN1TaggedObject taggedObject,
                                                  boolean declaredExplicit)

    - #### getString

          public java.lang.String getString()

      Description copied from interface: `ASN1String`
      Return a Java String representation of this STRING type's content.
      Specified by:
        `getString` in interface `ASN1String`
      Returns:
        a Java String representation of this STRING.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

            DirectoryString ::= CHOICE {
              teletexString               TeletexString (SIZE (1..MAX)),
              printableString             PrintableString (SIZE (1..MAX)),
              universalString             UniversalString (SIZE (1..MAX)),
              utf8String                  UTF8String (SIZE (1..MAX)),
              bmpString                   BMPString (SIZE (1..MAX))  }

      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a primitive representation of this object.