NetscapeCertRequest (Bouncy Castle Library 1.52 API Specification)

org.bouncycastle.jce.netscape

## Class NetscapeCertRequest

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.jce.netscape.NetscapeCertRequest

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class NetscapeCertRequest
      extends ASN1Object

  Handles NetScape certificate request (KEYGEN), these are constructed as:

         SignedPublicKeyAndChallenge ::= SEQUENCE {
           publicKeyAndChallenge    PublicKeyAndChallenge,
           signatureAlgorithm       AlgorithmIdentifier,
           signature                BIT STRING
         }

  PublicKey's encoded-format has to be X.509.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NetscapeCertRequest(ASN1Sequence spkac)`
    `NetscapeCertRequest(byte[] req)`
    `NetscapeCertRequest(java.lang.String challenge, AlgorithmIdentifier signing_alg, java.security.PublicKey pub_key)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getChallenge()`
    `AlgorithmIdentifier` | `getKeyAlgorithm()`
    `java.security.PublicKey` | `getPublicKey()`
    `AlgorithmIdentifier` | `getSigningAlgorithm()`
    `void` | `setChallenge(java.lang.String value)`
    `void` | `setKeyAlgorithm(AlgorithmIdentifier value)`
    `void` | `setPublicKey(java.security.PublicKey value)`
    `void` | `setSigningAlgorithm(AlgorithmIdentifier value)`
    `void` | `sign(java.security.PrivateKey priv_key)`
    `void` | `sign(java.security.PrivateKey priv_key, java.security.SecureRandom rand)`
    `ASN1Primitive` | `toASN1Primitive()` Method providing a primitive representation of this object suitable for encoding.
    `boolean` | `verify(java.lang.String challenge)`

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Object

      `equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode, toASN1Object`

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

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

- - ### Constructor Detail

    - #### NetscapeCertRequest

          public NetscapeCertRequest(byte[] req)
                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### NetscapeCertRequest

          public NetscapeCertRequest(ASN1Sequence spkac)

    - #### NetscapeCertRequest

          public NetscapeCertRequest(java.lang.String challenge,
                             AlgorithmIdentifier signing_alg,
                             java.security.PublicKey pub_key)
                              throws java.security.NoSuchAlgorithmException,
                                     java.security.spec.InvalidKeySpecException,
                                     java.security.NoSuchProviderException

      Throws:
        `java.security.NoSuchAlgorithmException`
        `java.security.spec.InvalidKeySpecException`
        `java.security.NoSuchProviderException`

  - ### Method Detail

    - #### getChallenge

          public java.lang.String getChallenge()

    - #### setChallenge

          public void setChallenge(java.lang.String value)

    - #### getSigningAlgorithm

          public AlgorithmIdentifier getSigningAlgorithm()

    - #### setSigningAlgorithm

          public void setSigningAlgorithm(AlgorithmIdentifier value)

    - #### getKeyAlgorithm

          public AlgorithmIdentifier getKeyAlgorithm()

    - #### setKeyAlgorithm

          public void setKeyAlgorithm(AlgorithmIdentifier value)

    - #### getPublicKey

          public java.security.PublicKey getPublicKey()

    - #### setPublicKey

          public void setPublicKey(java.security.PublicKey value)

    - #### verify

          public boolean verify(java.lang.String challenge)
                         throws java.security.NoSuchAlgorithmException,
                                java.security.InvalidKeyException,
                                java.security.SignatureException,
                                java.security.NoSuchProviderException

      Throws:
        `java.security.NoSuchAlgorithmException`
        `java.security.InvalidKeyException`
        `java.security.SignatureException`
        `java.security.NoSuchProviderException`

    - #### sign

          public void sign(java.security.PrivateKey priv_key)
                    throws java.security.NoSuchAlgorithmException,
                           java.security.InvalidKeyException,
                           java.security.SignatureException,
                           java.security.NoSuchProviderException,
                           java.security.spec.InvalidKeySpecException

      Throws:
        `java.security.NoSuchAlgorithmException`
        `java.security.InvalidKeyException`
        `java.security.SignatureException`
        `java.security.NoSuchProviderException`
        `java.security.spec.InvalidKeySpecException`

    - #### sign

          public void sign(java.security.PrivateKey priv_key,
                  java.security.SecureRandom rand)
                    throws java.security.NoSuchAlgorithmException,
                           java.security.InvalidKeyException,
                           java.security.SignatureException,
                           java.security.NoSuchProviderException,
                           java.security.spec.InvalidKeySpecException

      Throws:
        `java.security.NoSuchAlgorithmException`
        `java.security.InvalidKeyException`
        `java.security.SignatureException`
        `java.security.NoSuchProviderException`
        `java.security.spec.InvalidKeySpecException`

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