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

org.bouncycastle.asn1.x509.sigi

## Class NameOrPseudonym

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.x509.sigi.NameOrPseudonym

- All Implemented Interfaces:
    ASN1Choice, ASN1Encodable, Encodable

      public class NameOrPseudonym
      extends ASN1Object
      implements ASN1Choice

  Structure for a name or pseudonym.

             NameOrPseudonym ::= CHOICE {
                  surAndGivenName SEQUENCE {
                    surName DirectoryString,
                    givenName SEQUENCE OF DirectoryString
               },
                  pseudonym DirectoryString
             }

  See Also:
    `PersonalData`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NameOrPseudonym(DirectoryString pseudonym)` Constructor from DirectoryString.
    `NameOrPseudonym(DirectoryString surname, ASN1Sequence givenName)` Constructor from a given details.
    `NameOrPseudonym(java.lang.String pseudonym)` Constructor from a given details.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `DirectoryString[]` | `getGivenName()`
    `static NameOrPseudonym` | `getInstance(java.lang.Object obj)`
    `DirectoryString` | `getPseudonym()`
    `DirectoryString` | `getSurname()`
    `ASN1Primitive` | `toASN1Primitive()` Produce an object suitable for an ASN1OutputStream.

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

    - #### NameOrPseudonym

          public NameOrPseudonym(DirectoryString pseudonym)

      Constructor from DirectoryString.

      The sequence is of type NameOrPseudonym:

                 NameOrPseudonym ::= CHOICE {
                      surAndGivenName SEQUENCE {
                        surName DirectoryString,
                        givenName SEQUENCE OF DirectoryString
                   },
                      pseudonym DirectoryString
                 }

      Parameters:
        `pseudonym` - pseudonym value to use.

    - #### NameOrPseudonym

          public NameOrPseudonym(java.lang.String pseudonym)

      Constructor from a given details.
      Parameters:
        `pseudonym` - The pseudonym.

    - #### NameOrPseudonym

          public NameOrPseudonym(DirectoryString surname,
                                 ASN1Sequence givenName)

      Constructor from a given details.
      Parameters:
        `surname` - The surname.
        `givenName` - A sequence of directory strings making up the givenName

  - ### Method Detail

    - #### getInstance

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

    - #### getPseudonym

          public DirectoryString getPseudonym()

    - #### getSurname

          public DirectoryString getSurname()

    - #### getGivenName

          public DirectoryString[] getGivenName()

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      Produce an object suitable for an ASN1OutputStream.

      Returns:

                 NameOrPseudonym ::= CHOICE {
                      surAndGivenName SEQUENCE {
                        surName DirectoryString,
                        givenName SEQUENCE OF DirectoryString
                   },
                      pseudonym DirectoryString
                 }

      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a DERObject