Interface ChaChaBaseSpec

All Superinterfaces:
ContextSpec
All Known Implementing Classes:
ChaCha20Poly1305Spec, ChaChaSpec

public sealed interface ChaChaBaseSpec extends ContextSpec permits ChaChaSpec, ChaCha20Poly1305Spec

ChaCha base specification marker

Common sealed interface for all ChaCha-family specifications. Implemented by ChaChaSpec (raw stream cipher) and ChaCha20Poly1305Spec (AEAD).

Extends ContextSpec to allow binding algorithm-specific parameters into a context.

Header support

  • header() may return a SymmetricHeaderCodec that encodes parameters (e.g., nonce, AAD hash) into the ciphertext stream.
  • If null, no header is used and parameters must be managed via CtxInterface or other out-of-band means.

Example

ChaChaBaseSpec spec = ChaCha20Poly1305Spec.withHeader(
    new ChaCha20Poly1305HeaderCodec()
);
SymmetricHeaderCodec codec = spec.header(); // non-null
Since:
1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the optional header codec used to serialize/deserialize stream headers for this ChaCha mode.
  • Method Details

    • header

      Returns the optional header codec used to serialize/deserialize stream headers for this ChaCha mode.
      Returns:
      SymmetricHeaderCodec instance, or null if no header