Class AcmeNonceService
java.lang.Object
zeroecho.pki.server.acme.AcmeNonceService
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 Summary
ConstructorsConstructorDescriptionAcmeNonceService(String listenerId, Duration lifetime, int maximumOutstanding, Clock clock, SecureRandom random) Creates a bounded nonce service for one exact ACME listener. -
Method Summary
Modifier and TypeMethodDescriptionbooleanConsumes one nonce exactly once for the bound listener and canonical alias scope.Issues one canonical unpadded Base64url nonce with 256 bits of entropy.intReturns the current bounded outstanding nonce count for diagnostics.
-
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 commitmentslifetime- positive nonce lifetime, no greater than one hourmaximumOutstanding- maximum retained nonces, from 16 through 1,000,000clock- authoritative time sourcerandom- cryptographically secure entropy source- Throws:
IllegalArgumentException- if the listener identity, lifetime, or capacity is invalidNullPointerException- ifclockorrandomisnull
-
-
Method Details
-
issue
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- ifnonceScopeis not a canonical DNS labelIllegalStateException- if nonce capacity is exhausted
-
consume
Consumes one nonce exactly once for the bound listener and canonical alias scope.- Parameters:
nonce- canonical unpadded Base64url nonce, or malformed input to rejectnonceScope- listener alias scope expected by the request- Returns:
trueonly 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
-