Class ConfluxKeys
ConfluxKeys provides strongly typed, namespaced keys for common
transient values such as IVs, nonces, AAD, and authentication tags. These
keys are typically used with a key–value parameter store (e.g., a
Map<Key<?>,Object> or a dedicated context object) to exchange
per-operation metadata between algorithms and higher layers.
Design goals
- Type safety: each key carries its value type (e.g.,
Key<byte[]>vsKey<Integer>). - Namespacing: all keys include the algorithm identifier in their name, preventing collisions when multiple algorithms share a context.
- Consistency: avoids ad-hoc string constants; discoverable via
CryptoAlgorithm.listCapabilities()and related APIs.
Instances are created via static factories; this class cannot be instantiated.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic Key<byte[]> Returns a typed key for additional authenticated data (AAD).static Key<byte[]> Returns a typed key for the initialization vector (IV) of a given algorithm.static Key<byte[]> Returns a typed key for a nonce value of a given algorithm.static Key<byte[]> Returns a typed key for the authentication tag of a given algorithm.Returns a typed key for the number of authentication tag bits.
-
Method Details
-
iv
Returns a typed key for the initialization vector (IV) of a given algorithm.IVs are required by block cipher modes such as CBC or GCM. Each call produces a key namespaced as
"crypto.<algoId>.iv".- Parameters:
algoId- canonical algorithm identifier- Returns:
- key for IV values, of type
byte[]
-
aad
Returns a typed key for additional authenticated data (AAD).Used in AEAD schemes such as AES-GCM to bind unencrypted headers into the authentication tag. Namespaced as
"crypto.<algoId>.aad".- Parameters:
algoId- canonical algorithm identifier- Returns:
- key for AAD values, of type
byte[]
-
nonce
Returns a typed key for a nonce value of a given algorithm.Nonces are required by stream ciphers and AEAD modes to ensure uniqueness per key. Namespaced as
"crypto.<algoId>.nonce".- Parameters:
algoId- canonical algorithm identifier- Returns:
- key for nonce values, of type
byte[]
-
tag
Returns a typed key for the authentication tag of a given algorithm.AEAD modes output a tag that must be preserved for decryption/verification. Namespaced as
"crypto.<algoId>.tag".- Parameters:
algoId- canonical algorithm identifier- Returns:
- key for authentication tag values, of type
byte[]
-
tagBits
Returns a typed key for the number of authentication tag bits.Some AEAD constructions allow truncated tags (e.g., 96-bit or 64-bit). This key represents the chosen bit-length. Namespaced as
"crypto.<algoId>.tagBits".- Parameters:
algoId- canonical algorithm identifier- Returns:
- key for tag length values, of type
Integer
-