Class CmpProtectedMessage.Verified
java.lang.Object
zeroecho.pkix.cmp.CmpProtectedMessage.Verified
- Enclosing class:
CmpProtectedMessage
Immutable proof token constructed only after exact message protection verification.
It does not assert certificate trust, CSR proof, requester ownership or permission.
-
Method Summary
Modifier and TypeMethodDescriptioncaCertificates(List<byte[]> chain) Creates the standard caCerts general response, preserving supplied chain order.certificate(int originalType, byte[] certificateDer, boolean implicit, Instant confirmationDeadline) Creates a granted ip/cp/kup response for the retained original request.Creates pkiConf after the server has checked and durably recorded certConf.poll(int retrySeconds) Creates a pollRep using an explicit configured retry interval.byte[]protectPbm(CmpProtectedMessage.Response response, X500Principal sender, CmpPbmPolicy policy, byte[] secret, byte[] freshSalt, byte[] senderNonce, Instant time, CancellationSignal cancellation) Protects a response with the same verified binary PBM mode and parameters, replacing its salt with caller-provided fresh random bytes.rejected()Creates a generic authenticated rejection without caller-controlled diagnostics.request()Returns the immutable message whose protection was verified.revoked()Creates a successful permanent revocation response after caller-authorized revocation.byte[]sign(CmpProtectedMessage.Response response, X509Certificate signer, PrivateKey privateKey, List<byte[]> chain, byte[] senderNonce, Instant time) Signs one response using the supplied retained server credential.toString()Returns a redacted diagnostic representation.waiting()Creates an initial waiting ip/cp/kup response with the exact request ID.
-
Method Details
-
request
Returns the immutable message whose protection was verified.- Returns:
- the immutable message whose protection was verified
-
certificate
public CmpProtectedMessage.Response certificate(int originalType, byte[] certificateDer, boolean implicit, Instant confirmationDeadline) Creates a granted ip/cp/kup response for the retained original request. A poll response supplies that original body type explicitly; its ID must match.- Parameters:
originalType- original ir, cr or kur body tagcertificateDer- issued certificate, at most one MiBimplicit- whether the original enrollment explicitly requested implicit confirmationconfirmationDeadline- explicit confirmation deadline when implicit is false- Returns:
- immutable unsigned body bound to this verified request
- Throws:
IllegalArgumentException- if any field or request type is inconsistent
-
waiting
Creates an initial waiting ip/cp/kup response with the exact request ID.- Returns:
- immutable response body without an invented certificate or signing receipt
- Throws:
IllegalArgumentException- unless the request is ir, cr or kur
-
poll
Creates a pollRep using an explicit configured retry interval.- Parameters:
retrySeconds- positive retry interval, at most thirty days- Returns:
- immutable poll response for the exact request ID
- Throws:
IllegalArgumentException- if the type or interval is invalid
-
revoked
Creates a successful permanent revocation response after caller-authorized revocation.- Returns:
- immutable rp body bound to the verified rr
- Throws:
IllegalArgumentException- unless this is rr
-
confirmed
Creates pkiConf after the server has checked and durably recorded certConf.- Returns:
- immutable confirmation acknowledgement
- Throws:
IllegalArgumentException- unless this is certConf
-
caCertificates
Creates the standard caCerts general response, preserving supplied chain order.- Parameters:
chain- bounded leaf-to-anchor certificate DER list- Returns:
- immutable genp body; no certificate trust is inferred
- Throws:
IllegalArgumentException- if the request or chain is invalid
-
rejected
Creates a generic authenticated rejection without caller-controlled diagnostics.- Returns:
- immutable error response body
-
sign
public byte[] sign(CmpProtectedMessage.Response response, X509Certificate signer, PrivateKey privateKey, List<byte[]> chain, byte[] senderNonce, Instant time) Signs one response using the supplied retained server credential. Response nonce and time are explicit so the caller can commit the exact result before sending. The supplied chain must begin with the signer.- Parameters:
response- body created by this proof tokensigner- server certificate whose key must match the private keyprivateKey- borrowed private key, never retainedchain- explicit certificate chain in leaf-to-anchor ordersenderNonce- fresh server nonce, sixteen through thirty-two bytestime- explicit response time- Returns:
- protected DER response, bounded by the configured chain and leaf sizes
- Throws:
IllegalArgumentException- if the request uses PBM or signing fails
-
protectPbm
public byte[] protectPbm(CmpProtectedMessage.Response response, X500Principal sender, CmpPbmPolicy policy, byte[] secret, byte[] freshSalt, byte[] senderNonce, Instant time, CancellationSignal cancellation) Protects a response with the same verified binary PBM mode and parameters, replacing its salt with caller-provided fresh random bytes.- Parameters:
response- body created by this proof tokensender- explicit authority-scoped server distinguished namepolicy- configured PBM boundssecret- caller-owned binary secret, never retained or modifiedfreshSalt- fresh random salt satisfying the configured boundssenderNonce- fresh response noncetime- explicit response timecancellation- cooperative derivation cancellation- Returns:
- protected DER response without extra certificate candidates
- Throws:
IllegalArgumentException- if bounds, mode or MAC generation fail
-
toString
-