Class ChaCha20Poly1305Algorithm


public final class ChaCha20Poly1305Algorithm extends AbstractCryptoAlgorithm

ChaCha20-Poly1305 (AEAD) algorithm

Registers the ChaCha20-Poly1305 AEAD cipher within the ZeroEcho framework. Extends AbstractChaChaAlgorithm and declares symmetric capabilities for encryption and decryption using either ChaCha20Poly1305Spec or VoidSpec (convenience default mirroring AES-GCM).

Capabilities

Defaults

When used with VoidSpec, a minimal ChaCha20Poly1305Spec is synthesized with no SymmetricHeaderCodec header. Nonces are 12 bytes and managed by the corresponding cipher context.

Example

ZeroEchoSession session = new ZeroEchoSession();
SecretKey key = session.keyBuilders().symmetric()
                       .generate("CHACHA20-POLY1305", ChaChaKeyGenSpec.chacha256());

// Encrypt with explicit spec
ChaCha20Poly1305Spec spec = ChaCha20Poly1305Spec.builder().header(null).build();
EncryptionContext enc = session.createContext(
    "CHACHA20-POLY1305", zeroecho.core.KeyUsage.ENCRYPT, key, spec);

// Decrypt using VoidSpec default
EncryptionContext dec = session.createContext(
    "CHACHA20-POLY1305", zeroecho.core.KeyUsage.DECRYPT, key,
    zeroecho.core.spec.VoidSpec.INSTANCE);
Since:
1.0
  • Constructor Details

    • ChaCha20Poly1305Algorithm

      public ChaCha20Poly1305Algorithm()
      Creates and registers the ChaCha20-Poly1305 AEAD algorithm with encryption/decryption capabilities for ChaCha20Poly1305Spec and VoidSpec defaults.