Class StateSealer.Builder
java.lang.Object
com.revetsec.StateSealer.Builder
- Enclosing class:
StateSealer
Builds a
StateSealer.
build() checks the keys together and runs a self-test: it seals and opens a fixed value with the active
key, checks that an altered copy does not open and that the value does not open under another context, and
checks that a fixed input seals to its known bytes.
- Since:
- 1.0.0
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the sealer.Sets the clock that supplies the current time for sealing and opening.maximumSealedLength(@Nullable Integer maximumSealedLength) Sets the longest sealed value, in characters, thatsealreturns andunsealResultdecodes.verificationKeys(@Nullable List<@NonNull SealingKey> verificationKeys) Sets the keys that open values sealed earlier under other keys, such as the previous active key during a rotation.
-
Method Details
-
verificationKeys
public @NonNull StateSealer.Builder verificationKeys(@Nullable List<@NonNull SealingKey> verificationKeys) Sets the keys that open values sealed earlier under other keys, such as the previous active key during a rotation. They never seal.- Parameters:
verificationKeys- at most 16 keys, each with its own key ID and its own key bytes, none of them the active key;nullrestores the default, none. The list is copied- Returns:
- this builder
- Throws:
NullPointerException- if the list containsnull- Since:
- 1.0.0
-
clock
Sets the clock that supplies the current time for sealing and opening.- Parameters:
clock- the clock;nullrestores the default,Clock.systemUTC()- Returns:
- this builder
- Since:
- 1.0.0
-
maximumSealedLength
Sets the longest sealed value, in characters, thatsealreturns andunsealResultdecodes. Also bounds each newly emitted WebAuthn store-record chunk. Historical WebAuthn framed-record opening retains its fixed 16,384-character chunk ceiling when this emission setting is lowered; authentication, expiry, record framing and admitted-time checks still apply.- Parameters:
maximumSealedLength- from 1,024 to 16,384;nullrestores the default, 3,800.build()checks the range- Returns:
- this builder
- Since:
- 1.0.0
-
build
Builds the sealer.- Returns:
- a new sealer
- Throws:
IllegalArgumentException- if the maximum sealed length is out of range, there are more than 16 verification keys, or two keys share a key ID or key bytesIllegalStateException- if the platform's cryptographic provider refuses HMAC-SHA256 or AES-GCM, cannot supply random bytes, or fails the self-test- Since:
- 1.0.0
-