org.bouncycastle.asn1.est

## Class OtpChallenge

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.est.OtpChallenge

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class OtpChallenge
      extends ASN1Object

  RFC 7894 §3.1 `otpChallenge` attribute: a one-time password value conveyed as part of a CSR request. The companion OTP generation and verification mechanisms (e.g. RFC 4226 HOTP, RFC 6238 TOTP) are out of scope.

       otpChallenge ATTRIBUTE ::= {
           WITH SYNTAX DirectoryString {ub-aa-otpChallenge}
           EQUALITY MATCHING RULE caseExactMatch
           SINGLE VALUE TRUE
           ID id-aa-otpChallenge
       }
       ub-aa-otpChallenge INTEGER ::= 255

  Identified by `PKCSObjectIdentifiers.id_aa_otpChallenge`.

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static OtpChallenge` | `fromAttribute(Attribute attribute)` Extract the `otpChallenge` value carried by a PKCS#9 `Attribute`.
    `protected ASN1ObjectIdentifier` | `getAttrType()` The attribute-type OID for this RFC 7894 attribute.
    `static OtpChallenge` | `getInstance(java.lang.Object obj)`
    `java.lang.String` | `getString()` Return the value as a Java `String`, decoded from whichever underlying `DirectoryString` encoding was used.
    `DirectoryString` | `getValue()` Return the value as a `DirectoryString`.
    `ASN1Primitive` | `toASN1Primitive()` Method providing a primitive representation of this object suitable for encoding.
    `Attribute` | `toAttribute()` Wrap this value in a PKCS#9 `Attribute` carrying the RFC 7894 OID, ready for inclusion in a `CertificationRequest`'s `attributes` set (or in a CSR-Attributes response).

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

    - #### OtpChallenge

          public OtpChallenge(java.lang.String value)

    - #### OtpChallenge

          public OtpChallenge(DirectoryString value)

  - ### Method Detail

    - #### getInstance

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

    - #### fromAttribute

          public static OtpChallenge fromAttribute(Attribute attribute)

      Extract the `otpChallenge` value carried by a PKCS#9 `Attribute`.
      Throws:
        `java.lang.IllegalArgumentException` - if the attribute is not `PKCSObjectIdentifiers.id_aa_otpChallenge` or does not carry exactly one value.

    - #### getAttrType

          protected ASN1ObjectIdentifier getAttrType()

      The attribute-type OID for this RFC 7894 attribute. Used by `toAttribute()` to wrap the value in a PKCS#9 `Attribute`.

    - #### getValue

          public DirectoryString getValue()

      Return the value as a `DirectoryString`.

    - #### getString

          public java.lang.String getString()

      Return the value as a Java `String`, decoded from whichever underlying `DirectoryString` encoding was used.

    - #### toAttribute

          public Attribute toAttribute()

      Wrap this value in a PKCS#9 `Attribute` carrying the RFC 7894 OID, ready for inclusion in a `CertificationRequest`'s `attributes` set (or in a CSR-Attributes response).
      Returns:
        an `Attribute` of the form `(oid, {value})`.

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