Class ChaCha20Poly1305Algorithm
java.lang.Object
zeroecho.core.CryptoAlgorithm
zeroecho.core.alg.AbstractCryptoAlgorithm
zeroecho.core.alg.chacha.ChaCha20Poly1305Algorithm
ChaCha20-Poly1305 (AEAD) algorithm
Registers theChaCha20-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
- Encrypt:
- Family:
AlgorithmFamily.SYMMETRIC - Usage:
KeyUsage.ENCRYPT - Context:
EncryptionContext - Key:
SecretKey - Spec:
ChaCha20Poly1305Spec(orVoidSpecdefault)
- Family:
- Decrypt:
- Family:
AlgorithmFamily.SYMMETRIC - Usage:
KeyUsage.DECRYPT - Context:
EncryptionContext - Key:
SecretKey - Spec:
ChaCha20Poly1305Spec(orVoidSpecdefault)
- Family:
Defaults
When used withVoidSpec, 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 Summary
ConstructorsConstructorDescriptionCreates and registers the ChaCha20-Poly1305 AEAD algorithm with encryption/decryption capabilities forChaCha20Poly1305SpecandVoidSpecdefaults. -
Method Summary
Methods inherited from class AbstractCryptoAlgorithm
capabilityMethods inherited from class CryptoAlgorithm
addCapability, asymmetricKeyPairGenerator, bindContext, createContext, displayName, id, keyOperations, listCapabilities, parameterSets, priority, privateKeyImporter, providerName, publicKeyImporter, registerAsymmetricKeyPairGenerator, registerPrivateKeyImporter, registerPublicKeyImporter, registerSymmetricKeyGenerator, registerSymmetricKeyImporter, requiresStatefulSigning, roles, supports, symmetricKeyGenerator, symmetricKeyImporter
-
Constructor Details
-
ChaCha20Poly1305Algorithm
public ChaCha20Poly1305Algorithm()Creates and registers the ChaCha20-Poly1305 AEAD algorithm with encryption/decryption capabilities forChaCha20Poly1305SpecandVoidSpecdefaults.
-