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

org.bouncycastle.asn1.cmp

## Class PKIBody

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

- All Implemented Interfaces:
    ASN1Choice, ASN1Encodable, Encodable

      public class PKIBody
      extends ASN1Object
      implements ASN1Choice

  PKIBody ::= CHOICE { -- message-specific body elements ir [0] CertReqMessages, --Initialization Request ip [1] CertRepMessage, --Initialization Response cr [2] CertReqMessages, --Certification Request cp [3] CertRepMessage, --Certification Response p10cr [4] CertificationRequest, --imported from [PKCS10] popdecc [5] POPODecKeyChallContent, --pop Challenge popdecr [6] POPODecKeyRespContent, --pop Response kur [7] CertReqMessages, --Key Update Request kup [8] CertRepMessage, --Key Update Response krr [9] CertReqMessages, --Key Recovery Request krp [10] KeyRecRepContent, --Key Recovery Response rr [11] RevReqContent, --Revocation Request rp [12] RevRepContent, --Revocation Response ccr [13] CertReqMessages, --Cross-Cert. Request ccp [14] CertRepMessage, --Cross-Cert. Response ckuann [15] CAKeyUpdAnnContent, --CA Key Update Ann. cann [16] CertAnnContent, --Certificate Ann. rann [17] RevAnnContent, --Revocation Ann. crlann [18] CRLAnnContent, --CRL Announcement pkiconf [19] PKIConfirmContent, --Confirmation nested [20] NestedMessageContent, --Nested Message genm [21] GenMsgContent, --General Message genp [22] GenRepContent, --General Response error [23] ErrorMsgContent, --Error Message certConf [24] CertConfirmContent, --Certificate confirm pollReq [25] PollReqContent, --Polling request pollRep [26] PollRepContent --Polling response }

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `TYPE_CA_KEY_UPDATE_ANN`
    `static int` | `TYPE_CERT_ANN`
    `static int` | `TYPE_CERT_CONFIRM`
    `static int` | `TYPE_CERT_REP`
    `static int` | `TYPE_CERT_REQ`
    `static int` | `TYPE_CONFIRM`
    `static int` | `TYPE_CRL_ANN`
    `static int` | `TYPE_CROSS_CERT_REP`
    `static int` | `TYPE_CROSS_CERT_REQ`
    `static int` | `TYPE_ERROR`
    `static int` | `TYPE_GEN_MSG`
    `static int` | `TYPE_GEN_REP`
    `static int` | `TYPE_INIT_REP`
    `static int` | `TYPE_INIT_REQ`
    `static int` | `TYPE_KEY_RECOVERY_REP`
    `static int` | `TYPE_KEY_RECOVERY_REQ`
    `static int` | `TYPE_KEY_UPDATE_REP`
    `static int` | `TYPE_KEY_UPDATE_REQ`
    `static int` | `TYPE_NESTED`
    `static int` | `TYPE_P10_CERT_REQ`
    `static int` | `TYPE_POLL_REP`
    `static int` | `TYPE_POLL_REQ`
    `static int` | `TYPE_POPO_CHALL`
    `static int` | `TYPE_POPO_REP`
    `static int` | `TYPE_REVOCATION_ANN`
    `static int` | `TYPE_REVOCATION_REP`
    `static int` | `TYPE_REVOCATION_REQ`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PKIBody(int type, ASN1Encodable content)` Creates a new PKIBody.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ASN1Encodable` | `getContent()`
    `static PKIBody` | `getInstance(java.lang.Object o)`
    `int` | `getType()`
    `ASN1Primitive` | `toASN1Primitive()` PKIBody ::= CHOICE { -- message-specific body elements ir [0] CertReqMessages, --Initialization Request ip [1] CertRepMessage, --Initialization Response cr [2] CertReqMessages, --Certification Request cp [3] CertRepMessage, --Certification Response p10cr [4] CertificationRequest, --imported from [PKCS10] popdecc [5] POPODecKeyChallContent, --pop Challenge popdecr [6] POPODecKeyRespContent, --pop Response kur [7] CertReqMessages, --Key Update Request kup [8] CertRepMessage, --Key Update Response krr [9] CertReqMessages, --Key Recovery Request krp [10] KeyRecRepContent, --Key Recovery Response rr [11] RevReqContent, --Revocation Request rp [12] RevRepContent, --Revocation Response ccr [13] CertReqMessages, --Cross-Cert.

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

- - ### Field Detail

    - #### TYPE_INIT_REQ

          public static final int TYPE_INIT_REQ

      See Also:
        Constant Field Values

    - #### TYPE_INIT_REP

          public static final int TYPE_INIT_REP

      See Also:
        Constant Field Values

    - #### TYPE_CERT_REQ

          public static final int TYPE_CERT_REQ

      See Also:
        Constant Field Values

    - #### TYPE_CERT_REP

          public static final int TYPE_CERT_REP

      See Also:
        Constant Field Values

    - #### TYPE_P10_CERT_REQ

          public static final int TYPE_P10_CERT_REQ

      See Also:
        Constant Field Values

    - #### TYPE_POPO_CHALL

          public static final int TYPE_POPO_CHALL

      See Also:
        Constant Field Values

    - #### TYPE_POPO_REP

          public static final int TYPE_POPO_REP

      See Also:
        Constant Field Values

    - #### TYPE_KEY_UPDATE_REQ

          public static final int TYPE_KEY_UPDATE_REQ

      See Also:
        Constant Field Values

    - #### TYPE_KEY_UPDATE_REP

          public static final int TYPE_KEY_UPDATE_REP

      See Also:
        Constant Field Values

    - #### TYPE_KEY_RECOVERY_REQ

          public static final int TYPE_KEY_RECOVERY_REQ

      See Also:
        Constant Field Values

    - #### TYPE_KEY_RECOVERY_REP

          public static final int TYPE_KEY_RECOVERY_REP

      See Also:
        Constant Field Values

    - #### TYPE_REVOCATION_REQ

          public static final int TYPE_REVOCATION_REQ

      See Also:
        Constant Field Values

    - #### TYPE_REVOCATION_REP

          public static final int TYPE_REVOCATION_REP

      See Also:
        Constant Field Values

    - #### TYPE_CROSS_CERT_REQ

          public static final int TYPE_CROSS_CERT_REQ

      See Also:
        Constant Field Values

    - #### TYPE_CROSS_CERT_REP

          public static final int TYPE_CROSS_CERT_REP

      See Also:
        Constant Field Values

    - #### TYPE_CA_KEY_UPDATE_ANN

          public static final int TYPE_CA_KEY_UPDATE_ANN

      See Also:
        Constant Field Values

    - #### TYPE_CERT_ANN

          public static final int TYPE_CERT_ANN

      See Also:
        Constant Field Values

    - #### TYPE_REVOCATION_ANN

          public static final int TYPE_REVOCATION_ANN

      See Also:
        Constant Field Values

    - #### TYPE_CRL_ANN

          public static final int TYPE_CRL_ANN

      See Also:
        Constant Field Values

    - #### TYPE_CONFIRM

          public static final int TYPE_CONFIRM

      See Also:
        Constant Field Values

    - #### TYPE_NESTED

          public static final int TYPE_NESTED

      See Also:
        Constant Field Values

    - #### TYPE_GEN_MSG

          public static final int TYPE_GEN_MSG

      See Also:
        Constant Field Values

    - #### TYPE_GEN_REP

          public static final int TYPE_GEN_REP

      See Also:
        Constant Field Values

    - #### TYPE_ERROR

          public static final int TYPE_ERROR

      See Also:
        Constant Field Values

    - #### TYPE_CERT_CONFIRM

          public static final int TYPE_CERT_CONFIRM

      See Also:
        Constant Field Values

    - #### TYPE_POLL_REQ

          public static final int TYPE_POLL_REQ

      See Also:
        Constant Field Values

    - #### TYPE_POLL_REP

          public static final int TYPE_POLL_REP

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PKIBody

          public PKIBody(int type,
                         ASN1Encodable content)

      Creates a new PKIBody.
      Parameters:
        `type` - one of the TYPE_* constants
        `content` - message content

  - ### Method Detail

    - #### getInstance

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

    - #### getType

          public int getType()

    - #### getContent

          public ASN1Encodable getContent()

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

           PKIBody ::= CHOICE {       -- message-specific body elements
                  ir       [0]  CertReqMessages,        --Initialization Request
                  ip       [1]  CertRepMessage,         --Initialization Response
                  cr       [2]  CertReqMessages,        --Certification Request
                  cp       [3]  CertRepMessage,         --Certification Response
                  p10cr    [4]  CertificationRequest,   --imported from [PKCS10]
                  popdecc  [5]  POPODecKeyChallContent, --pop Challenge
                  popdecr  [6]  POPODecKeyRespContent,  --pop Response
                  kur      [7]  CertReqMessages,        --Key Update Request
                  kup      [8]  CertRepMessage,         --Key Update Response
                  krr      [9]  CertReqMessages,        --Key Recovery Request
                  krp      [10] KeyRecRepContent,       --Key Recovery Response
                  rr       [11] RevReqContent,          --Revocation Request
                  rp       [12] RevRepContent,          --Revocation Response
                  ccr      [13] CertReqMessages,        --Cross-Cert. Request
                  ccp      [14] CertRepMessage,         --Cross-Cert. Response
                  ckuann   [15] CAKeyUpdAnnContent,     --CA Key Update Ann.
                  cann     [16] CertAnnContent,         --Certificate Ann.
                  rann     [17] RevAnnContent,          --Revocation Ann.
                  crlann   [18] CRLAnnContent,          --CRL Announcement
                  pkiconf  [19] PKIConfirmContent,      --Confirmation
                  nested   [20] NestedMessageContent,   --Nested Message
                  genm     [21] GenMsgContent,          --General Message
                  genp     [22] GenRepContent,          --General Response
                  error    [23] ErrorMsgContent,        --Error Message
                  certConf [24] CertConfirmContent,     --Certificate confirm
                  pollReq  [25] PollReqContent,         --Polling request
                  pollRep  [26] PollRepContent          --Polling response
           }

      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a basic ASN.1 object representation.