Class PKIResponseBuilder
java.lang.Object
org.bouncycastle.cmc.PKIResponseBuilder
Builder for a Simple PKI Response (RFC 5272 / RFC 7030 4.2.3 / 4.4.2),
delivered as a
SimplePKIResponse.
Two shapes are supported, selected automatically at build() time:
- Full PKI Response (the error case used by EST server-generated errors): a CMS SignedData with no SignerInfos whose encapsulated content is an id-cct-PKIResponse PKIResponse SEQUENCE. Selected when any control attribute, CMS content or other message has been added.
- Simple PKI Response (the cert-delivery case used by /simpleenroll): a degenerate CMS SignedData with no SignerInfos, no encapsulated content, and the issued certificates in the certificates field. Selected when only certificates have been added.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a certificate to deliver in the response.addCmsContent(org.bouncycastle.asn1.cmc.TaggedContentInfo cmsContent) addControlAttribute(org.bouncycastle.asn1.cmc.TaggedAttribute attr) addOtherMsg(org.bouncycastle.asn1.cmc.OtherMsg otherMsg) addStatusInfoV2(org.bouncycastle.asn1.cmc.BodyPartID bodyPartID, org.bouncycastle.asn1.cmc.CMCStatusInfoV2 statusInfo) Convenience for the EST server-generated error case: wrap the supplied CMCStatusInfoV2 in a TaggedAttribute keyed by id-cmc-statusInfoV2 and append it to the controlSequence.addStatusInfoV2(org.bouncycastle.asn1.cmc.CMCStatusInfoV2 statusInfo) Convenience overload for the simple-error case where the outerTaggedAttribute's bodyPartID can be inherited from the first entry ofstatusInfo.getBodyList().build()
-
Constructor Details
-
PKIResponseBuilder
public PKIResponseBuilder()
-
-
Method Details
-
addControlAttribute
-
addStatusInfoV2
public PKIResponseBuilder addStatusInfoV2(org.bouncycastle.asn1.cmc.BodyPartID bodyPartID, org.bouncycastle.asn1.cmc.CMCStatusInfoV2 statusInfo) Convenience for the EST server-generated error case: wrap the supplied CMCStatusInfoV2 in a TaggedAttribute keyed by id-cmc-statusInfoV2 and append it to the controlSequence. The suppliedbodyPartIDidentifies theTaggedAttributeitself within the controlSequence (per RFC 5272 sec. 3.2.1); it is structurally distinct from thebodyListentries insideCMCStatusInfoV2, which identify which request body parts the status pertains to. -
addStatusInfoV2
Convenience overload for the simple-error case where the outerTaggedAttribute's bodyPartID can be inherited from the first entry ofstatusInfo.getBodyList(). Behaves identically toaddStatusInfoV2(BodyPartID, CMCStatusInfoV2)when the caller doesn't need an independent identifier for the TaggedAttribute.- Throws:
IllegalArgumentException- ifstatusInfo's bodyList is empty.
-
addCmsContent
-
addOtherMsg
-
addCertificate
Add a certificate to deliver in the response. When the builder contains only certificates (no control attributes, no CMS contents, no other messages),build()emits a degenerate SignedData with no encapsulated content and the certificates in the certificates field (the Simple PKI Response shape used by EST /simpleenroll). When other payload has also been added, the certificates are carried alongside the id-cct-PKIResponse encapsulated content. -
build
- Throws:
CMCException
-