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

org.bouncycastle.asn1.x509

## Class DisplayText

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.x509.DisplayText

- All Implemented Interfaces:
    ASN1Choice, ASN1Encodable, Encodable

      public class DisplayText
      extends ASN1Object
      implements ASN1Choice

  `DisplayText` class, used in `CertificatePolicies` X509 V3 extensions (in policy qualifiers).

  It stores a string in a chosen encoding.

       DisplayText ::= CHOICE {
            ia5String        IA5String      (SIZE (1..200)),
            visibleString    VisibleString  (SIZE (1..200)),
            bmpString        BMPString      (SIZE (1..200)),
            utf8String       UTF8String     (SIZE (1..200)) }

  See Also:
    `PolicyQualifierInfo`, `PolicyInformation`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CONTENT_TYPE_BMPSTRING` Constant corresponding to bmpString encoding.
    `static int` | `CONTENT_TYPE_IA5STRING` Constant corresponding to ia5String encoding.
    `static int` | `CONTENT_TYPE_UTF8STRING` Constant corresponding to utf8String encoding.
    `static int` | `CONTENT_TYPE_VISIBLESTRING` Constant corresponding to visibleString encoding.
    `static int` | `DISPLAY_TEXT_MAXIMUM_SIZE` Describe constant `DISPLAY_TEXT_MAXIMUM_SIZE` here.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DisplayText(int type, java.lang.String text)` Creates a new `DisplayText` instance.
    `DisplayText(java.lang.String text)` Creates a new `DisplayText` instance.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static DisplayText` | `getInstance(ASN1TaggedObject obj, boolean explicit)`
    `static DisplayText` | `getInstance(java.lang.Object obj)`
    `java.lang.String` | `getString()` Returns the stored `String` object.
    `ASN1Primitive` | `toASN1Primitive()` Method providing a primitive representation of this object suitable for encoding.

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

- - ### Field Detail

    - #### CONTENT_TYPE_IA5STRING

          public static final int CONTENT_TYPE_IA5STRING

      Constant corresponding to ia5String encoding.
      See Also:
        Constant Field Values

    - #### CONTENT_TYPE_BMPSTRING

          public static final int CONTENT_TYPE_BMPSTRING

      Constant corresponding to bmpString encoding.
      See Also:
        Constant Field Values

    - #### CONTENT_TYPE_UTF8STRING

          public static final int CONTENT_TYPE_UTF8STRING

      Constant corresponding to utf8String encoding.
      See Also:
        Constant Field Values

    - #### CONTENT_TYPE_VISIBLESTRING

          public static final int CONTENT_TYPE_VISIBLESTRING

      Constant corresponding to visibleString encoding.
      See Also:
        Constant Field Values

    - #### DISPLAY_TEXT_MAXIMUM_SIZE

          public static final int DISPLAY_TEXT_MAXIMUM_SIZE

      Describe constant `DISPLAY_TEXT_MAXIMUM_SIZE` here.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DisplayText

          public DisplayText(int type,
                             java.lang.String text)

      Creates a new `DisplayText` instance.
      Parameters:
        `type` - the desired encoding type for the text.
        `text` - the text to store. Strings longer than 200 characters are truncated.

    - #### DisplayText

          public DisplayText(java.lang.String text)

      Creates a new `DisplayText` instance.
      Parameters:
        `text` - the text to encapsulate. Strings longer than 200 characters are truncated.

  - ### Method Detail

    - #### getInstance

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

    - #### getInstance

          public static DisplayText getInstance(ASN1TaggedObject obj,
                                                boolean explicit)

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      Description copied from class: `ASN1Object`
      Method providing a primitive representation of this object suitable for encoding.
      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a primitive representation of this object.

    - #### getString

          public java.lang.String getString()

      Returns the stored `String` object.
      Returns:
        the stored text as a `String`.