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

org.bouncycastle.asn1.cmc

## Class CertificationRequest

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.cmc.CertificationRequest

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class CertificationRequest
      extends ASN1Object

         CertificationRequest ::= SEQUENCE {
           certificationRequestInfo  SEQUENCE {
             version                   INTEGER,
             subject                   Name,
             subjectPublicKeyInfo      SEQUENCE {
                algorithm                 AlgorithmIdentifier,
                subjectPublicKey          BIT STRING },
             attributes                [0] IMPLICIT SET OF Attribute },
          signatureAlgorithm        AlgorithmIdentifier,
          signature                 BIT STRING
        }

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CertificationRequest(X500Name subject, AlgorithmIdentifier subjectPublicAlgorithm, ASN1BitString subjectPublicKey, ASN1Set attributes, AlgorithmIdentifier signatureAlgorithm, ASN1BitString signature)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ASN1Set` | `getAttributes()`
    `static CertificationRequest` | `getInstance(java.lang.Object o)`
    `ASN1BitString` | `getSignature()`
    `AlgorithmIdentifier` | `getSignatureAlgorithm()`
    `X500Name` | `getSubject()`
    `ASN1BitString` | `getSubjectPublicKey()`
    `AlgorithmIdentifier` | `getSubjectPublicKeyAlgorithm()`
    `java.math.BigInteger` | `getVersion()`
    `ASN1Primitive` | `parsePublicKey()` If the public key is an encoded object this will return the ASN.1 primitives encoded - if the bitstring can't be decoded this routine throws an IOException.
    `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`

- - ### Constructor Detail

    - #### CertificationRequest

          public CertificationRequest(X500Name subject,
                                      AlgorithmIdentifier subjectPublicAlgorithm,
                                      ASN1BitString subjectPublicKey,
                                      ASN1Set attributes,
                                      AlgorithmIdentifier signatureAlgorithm,
                                      ASN1BitString signature)

  - ### Method Detail

    - #### getInstance

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

    - #### getVersion

          public java.math.BigInteger getVersion()

    - #### getSubject

          public X500Name getSubject()

    - #### getAttributes

          public ASN1Set getAttributes()

    - #### getSubjectPublicKeyAlgorithm

          public AlgorithmIdentifier getSubjectPublicKeyAlgorithm()

    - #### getSubjectPublicKey

          public ASN1BitString getSubjectPublicKey()

    - #### parsePublicKey

          public ASN1Primitive parsePublicKey()
                                       throws java.io.IOException

      If the public key is an encoded object this will return the ASN.1 primitives encoded - if the bitstring can't be decoded this routine throws an IOException.
      Returns:
        the public key as an ASN.1 primitive.
      Throws:
        `java.io.IOException` - - if the bit string doesn't represent a DER encoded object.

    - #### getSignatureAlgorithm

          public AlgorithmIdentifier getSignatureAlgorithm()

    - #### getSignature

          public ASN1BitString getSignature()

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