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

org.bouncycastle.asn1.cmp

## Class CMPCertificate

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.cmp.CMPCertificate

- All Implemented Interfaces:
    ASN1Choice, ASN1Encodable, Encodable
  Direct Known Subclasses:
    CertAnnContent, OOBCert

      public class CMPCertificate
      extends ASN1Object
      implements ASN1Choice

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CMPCertificate(AttributeCertificate x509v2AttrCert)` Deprecated. use (type, otherCert) constructor
    `CMPCertificate(Certificate x509v3PKCert)`
    `CMPCertificate(int type, ASN1Object otherCert)` Note: the addition of other certificates is a BC extension.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static CMPCertificate` | `getInstance(ASN1TaggedObject ato, boolean isExplicit)`
    `static CMPCertificate` | `getInstance(java.lang.Object o)`
    `ASN1Object` | `getOtherCert()`
    `int` | `getOtherCertTag()`
    `AttributeCertificate` | `getX509v2AttrCert()` Deprecated. use getOtherCert and getOtherTag to make sure message is really what it should be.
    `Certificate` | `getX509v3PKCert()`
    `boolean` | `isX509v3PKCert()`
    `ASN1Primitive` | `toASN1Primitive()` CMPCertificate ::= CHOICE { x509v3PKCert Certificate otherCert [tag] EXPLICIT ANY DEFINED BY tag } Note: the addition of the explicit tagging is a BC extension.

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

    - #### CMPCertificate

          public CMPCertificate(AttributeCertificate x509v2AttrCert)

      Deprecated. use (type, otherCert) constructor
      Note: the addition of attribute certificates is a BC extension. If you use this constructor they will be added with a tag value of 1.

    - #### CMPCertificate

          public CMPCertificate(int type,
                                ASN1Object otherCert)

      Note: the addition of other certificates is a BC extension. If you use this constructor they will be added with an explicit tag value of type.
      Parameters:
        `type` - the type of the certificate (used as a tag value).
        `otherCert` - the object representing the certificate

    - #### CMPCertificate

          public CMPCertificate(Certificate x509v3PKCert)

  - ### Method Detail

    - #### getInstance

          public static CMPCertificate getInstance(ASN1TaggedObject ato,
                                                   boolean isExplicit)

    - #### getInstance

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

    - #### isX509v3PKCert

          public boolean isX509v3PKCert()

    - #### getX509v3PKCert

          public Certificate getX509v3PKCert()

    - #### getX509v2AttrCert

          public AttributeCertificate getX509v2AttrCert()

      Deprecated. use getOtherCert and getOtherTag to make sure message is really what it should be.
      Return an AttributeCertificate interpretation of otherCert.
      Returns:
        an AttributeCertificate

    - #### getOtherCertTag

          public int getOtherCertTag()

    - #### getOtherCert

          public ASN1Object getOtherCert()

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

           CMPCertificate ::= CHOICE {
                      x509v3PKCert    Certificate
                      otherCert      [tag] EXPLICIT ANY DEFINED BY tag
            }

      Note: the addition of the explicit tagging is a BC extension. We apologise for the warped syntax, but hopefully you get the idea.
      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a basic ASN.1 object representation.