Package org.bouncycastle.crypto.engines
Class XChaCha20Engine
- java.lang.Object
-
- org.bouncycastle.crypto.engines.Salsa20Engine
-
- org.bouncycastle.crypto.engines.ChaCha7539Engine
-
- org.bouncycastle.crypto.engines.XChaCha20Engine
-
- All Implemented Interfaces:
SkippingCipher,SkippingStreamCipher,StreamCipher
public class XChaCha20Engine extends ChaCha7539Engine
Implementation of the XChaCha20 stream cipher (extended-nonce ChaCha20) as described in draft-irtf-cfrg-xchacha-03.XChaCha20 takes a 256 bit key and a 192 bit nonce. The first 128 bits of the nonce are used together with the key in HChaCha20 to derive a 256 bit subkey; that subkey, together with the remaining 64 bits of the nonce (prefixed by four zero bytes to form a 96 bit IETF nonce), then drives a standard ChaCha20-IETF stream as defined by RFC 7539.
-
-
Field Summary
-
Fields inherited from class org.bouncycastle.crypto.engines.Salsa20Engine
DEFAULT_ROUNDS, engineState, rounds, sigma, tau, x
-
-
Constructor Summary
Constructors Constructor Description XChaCha20Engine()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAlgorithmName()Return the name of the algorithm the cipher implements.protected intgetNonceSize()protected voidsetKey(byte[] keyBytes, byte[] ivBytes)-
Methods inherited from class org.bouncycastle.crypto.engines.ChaCha7539Engine
advanceCounter, advanceCounter, generateKeyStream, getCounter, resetCounter, retreatCounter, retreatCounter
-
Methods inherited from class org.bouncycastle.crypto.engines.Salsa20Engine
getPosition, init, packTauOrSigma, processBytes, reset, returnByte, salsaCore, seekTo, skip
-
-
-
-
Method Detail
-
getAlgorithmName
public java.lang.String getAlgorithmName()
Description copied from interface:StreamCipherReturn the name of the algorithm the cipher implements.- Specified by:
getAlgorithmNamein interfaceStreamCipher- Overrides:
getAlgorithmNamein classChaCha7539Engine- Returns:
- the name of the algorithm the cipher implements.
-
getNonceSize
protected int getNonceSize()
- Overrides:
getNonceSizein classChaCha7539Engine
-
setKey
protected void setKey(byte[] keyBytes, byte[] ivBytes)- Overrides:
setKeyin classChaCha7539Engine
-
-