Class AcmeNonceService

java.lang.Object
zeroecho.pki.server.acme.AcmeNonceService

public final class AcmeNonceService extends Object
Bounded process-local one-time ACME replay-nonce authority.

Only SHA-256 commitments are retained. Restart intentionally invalidates all outstanding nonces. Expiry buckets are removed eagerly on every issue and consume operation, so retained state cannot grow beyond the configured bound.

  • Constructor Details

    • AcmeNonceService

      public AcmeNonceService(String listenerId, Duration lifetime, int maximumOutstanding, Clock clock, SecureRandom random)
      Creates a bounded nonce service for one exact ACME listener.
      Parameters:
      listenerId - stable listener identity included in nonce commitments
      lifetime - positive nonce lifetime, no greater than one hour
      maximumOutstanding - maximum retained nonces, from 16 through 1,000,000
      clock - authoritative time source
      random - cryptographically secure entropy source
      Throws:
      IllegalArgumentException - if the listener identity, lifetime, or capacity is invalid
      NullPointerException - if clock or random is null
  • Method Details

    • issue

      public String issue(String nonceScope)
      Issues one canonical unpadded Base64url nonce with 256 bits of entropy.
      Parameters:
      nonceScope - canonical listener alias scope to bind into the commitment
      Returns:
      the newly issued one-time nonce
      Throws:
      IllegalArgumentException - if nonceScope is not a canonical DNS label
      IllegalStateException - if nonce capacity is exhausted
    • consume

      public boolean consume(String nonce, String nonceScope)
      Consumes one nonce exactly once for the bound listener and canonical alias scope.
      Parameters:
      nonce - canonical unpadded Base64url nonce, or malformed input to reject
      nonceScope - listener alias scope expected by the request
      Returns:
      true only for a live nonce bound to the supplied scope
    • outstanding

      public int outstanding()
      Returns the current bounded outstanding nonce count for diagnostics.
      Returns:
      the count after expired entries have been removed