Class CmpProtectedMessage.Verified

java.lang.Object
zeroecho.pkix.cmp.CmpProtectedMessage.Verified
Enclosing class:
CmpProtectedMessage

public static final class CmpProtectedMessage.Verified extends Object
Immutable proof token constructed only after exact message protection verification. It does not assert certificate trust, CSR proof, requester ownership or permission.
  • Method Details

    • request

      public CmpProtectedMessage 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 tag
      certificateDer - issued certificate, at most one MiB
      implicit - whether the original enrollment explicitly requested implicit confirmation
      confirmationDeadline - 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

      public CmpProtectedMessage.Response 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

      public CmpProtectedMessage.Response poll(int retrySeconds)
      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

      public CmpProtectedMessage.Response 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

      public CmpProtectedMessage.Response confirmed()
      Creates pkiConf after the server has checked and durably recorded certConf.
      Returns:
      immutable confirmation acknowledgement
      Throws:
      IllegalArgumentException - unless this is certConf
    • caCertificates

      public CmpProtectedMessage.Response caCertificates(List<byte[]> chain)
      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

      public CmpProtectedMessage.Response 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 token
      signer - server certificate whose key must match the private key
      privateKey - borrowed private key, never retained
      chain - explicit certificate chain in leaf-to-anchor order
      senderNonce - fresh server nonce, sixteen through thirty-two bytes
      time - 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 token
      sender - explicit authority-scoped server distinguished name
      policy - configured PBM bounds
      secret - caller-owned binary secret, never retained or modified
      freshSalt - fresh random salt satisfying the configured bounds
      senderNonce - fresh response nonce
      time - explicit response time
      cancellation - cooperative derivation cancellation
      Returns:
      protected DER response without extra certificate candidates
      Throws:
      IllegalArgumentException - if bounds, mode or MAC generation fail
    • toString

      public String toString()
      Returns a redacted diagnostic representation.
      Overrides:
      toString in class Object
      Returns:
      a redacted diagnostic representation