Class ConfluxKeys

java.lang.Object
zeroecho.core.ConfluxKeys

public final class ConfluxKeys extends Object
Shared typed keys for ephemeral cryptographic parameters.

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[]> vs Key<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 Type
    Method
    Description
    static Key<byte[]>
    aad(String algoId)
    Returns a typed key for additional authenticated data (AAD).
    static Key<byte[]>
    iv(String algoId)
    Returns a typed key for the initialization vector (IV) of a given algorithm.
    static Key<byte[]>
    nonce(String algoId)
    Returns a typed key for a nonce value of a given algorithm.
    static Key<byte[]>
    tag(String algoId)
    Returns a typed key for the authentication tag of a given algorithm.
    static Key<Integer>
    tagBits(String algoId)
    Returns a typed key for the number of authentication tag bits.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • iv

      public static Key<byte[]> iv(String algoId)
      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

      public static Key<byte[]> aad(String algoId)
      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

      public static Key<byte[]> nonce(String algoId)
      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

      public static Key<byte[]> tag(String algoId)
      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

      public static Key<Integer> tagBits(String algoId)
      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