Top Description Inners Fields Constructors Methods
org.bouncycastle.crypto.general

public final Class ChaCha20

extends Object
Class Inheritance
Imports
java.security.SecureRandom, org.bouncycastle.crypto.Algorithm, .IllegalKeyException, .SymmetricKey, .SymmetricSecretKey, org.bouncycastle.crypto.internal.CipherParameters, .KeyGenerationParameters, .StreamCipher, .ValidatedSymmetricKey, org.bouncycastle.crypto.internal.params.KeyParameterImpl, .ParametersWithIV, org.bouncycastle.util.Arrays, org.bouncycastle.util.encoders.Hex

Source class for implementations of ChaCha20 based algorithms.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static class
ChaCha20.KeyGenerator

ChaCha20 key generator.

public static class
ChaCha20.OperatorFactory

Factory for basic ChaCha20 encryption/decryption operators.

public static class
ChaCha20.Parameters

Parameters for ChaCha20 cipher.

Field Summary

Modifier and TypeField and Description
public static final GeneralAlgorithm
ALGORITHM

Raw ChaCha20 algorithm, can be used for creating general purpose ChaCha20 keys.

private static final ChaCha20.EngineProvider
public static final ChaCha20.Parameters

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static boolean
invalidKeySize(int keyLength)

private static ValidatedSymmetricKey
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALGORITHMback to summary
public static final GeneralAlgorithm ALGORITHM

Raw ChaCha20 algorithm, can be used for creating general purpose ChaCha20 keys.

ENGINE_PROVIDERback to summary
private static final ChaCha20.EngineProvider ENGINE_PROVIDER
STREAMback to summary
public static final ChaCha20.Parameters STREAM

Constructor Detail

ChaCha20back to summary
private ChaCha20()

Method Detail

invalidKeySizeback to summary
private static boolean invalidKeySize(int keyLength)
validateKeyback to summary
private static ValidatedSymmetricKey validateKey(SymmetricKey key, Algorithm algorithm)
org.bouncycastle.crypto.general back to summary

private final Class ChaCha20.EngineProvider

extends Object
implements EngineProvider<StreamCipher>
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.internal.EngineProvider

Field Summary

Modifier and TypeField and Description
pack-priv static final byte[]
pack-priv static final byte[]
pack-priv static final byte[]
pack-priv static final byte[]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public StreamCipher
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

inputback to summary
pack-priv static final byte[] input
ivback to summary
pack-priv static final byte[] iv
keyback to summary
pack-priv static final byte[] key
outputback to summary
pack-priv static final byte[] output

Constructor Detail

EngineProviderback to summary
private EngineProvider()

Method Detail

createEngineback to summary
public StreamCipher createEngine()

Implements org.bouncycastle.crypto.internal.EngineProvider.createEngine.

org.bouncycastle.crypto.general back to summary

public final Class ChaCha20.KeyGenerator

extends GuardedSymmetricKeyGenerator
Class Inheritance

ChaCha20 key generator.

Field Summary

Modifier and TypeField and Description
private final GeneralAlgorithm
private static final int
private final SecureRandom

Constructor Summary

AccessConstructor and Description
public
public
KeyGenerator(GeneralParameters<T extends Algorithm> parameterSet, SecureRandom random)

private

Method Summary

Modifier and TypeMethod and Description
public SymmetricKey
Inherited from org.bouncycastle.crypto.general.GuardedSymmetricKeyGenerator:
generateKey

Field Detail

algorithmback to summary
private final GeneralAlgorithm algorithm
keySizeInBitsback to summary
private static final int keySizeInBits
randomback to summary
private final SecureRandom random

Constructor Detail

KeyGeneratorback to summary
public KeyGenerator(SecureRandom random)
KeyGeneratorback to summary
public KeyGenerator(GeneralParameters<T extends Algorithm> parameterSet, SecureRandom random)
KeyGeneratorback to summary
private KeyGenerator(GeneralAlgorithm algorithm, SecureRandom random)

Method Detail

doGenerateKeyback to summary
public SymmetricKey doGenerateKey()

Implements abstract org.bouncycastle.crypto.general.GuardedSymmetricKeyGenerator.doGenerateKey.

org.bouncycastle.crypto.general back to summary

public final Class ChaCha20.OperatorFactory

extends GuardedSymmetricStreamOperatorFactory<ChaCha20.Parameters>
Class Inheritance

Factory for basic ChaCha20 encryption/decryption operators.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected StreamCipher
Inherited from org.bouncycastle.crypto.general.GuardedSymmetricStreamOperatorFactory:
createInputDecryptorcreateOutputDecryptorcreateOutputEncryptor

Constructor Detail

OperatorFactoryback to summary
public OperatorFactory()

Method Detail

createCipherback to summary
protected StreamCipher createCipher(boolean forEncryption, SymmetricKey key, ChaCha20.Parameters parameters, SecureRandom random)

Implements abstract org.bouncycastle.crypto.general.GuardedSymmetricStreamOperatorFactory.createCipher.

Annotations
@Override
org.bouncycastle.crypto.general back to summary

public final Class ChaCha20.Parameters

extends GeneralParametersWithIV<ChaCha20.Parameters>
Class Inheritance

Parameters for ChaCha20 cipher.

Field Summary

Inherited from org.bouncycastle.crypto.general.GeneralParametersWithIV:
blockSizeiv

Constructor Summary

AccessConstructor and Description
private
Parameters(GeneralAlgorithm algorithm, byte[] iv)

pack-priv

Method Summary

Modifier and TypeMethod and Description
protected ChaCha20.Parameters
public ChaCha20.Parameters
withIV(SecureRandom
the SecureRandom to use as the source of IV data.
random
)

Overrides org.bouncycastle.crypto.general.GeneralParametersWithIV.withIV.

Implements org.bouncycastle.crypto.ParametersWithIV.withIV.

Return an implementation of our parameterized type with an IV constructed from the passed in SecureRandom.
Inherited from org.bouncycastle.crypto.general.GeneralParametersWithIV:
getIVwithIV

Constructor Detail

Parametersback to summary
private Parameters(GeneralAlgorithm algorithm, byte[] iv)
Parametersback to summary
pack-priv Parameters(GeneralAlgorithm algorithm)

Method Detail

createback to summary
protected ChaCha20.Parameters create(GeneralAlgorithm algorithm, byte[] iv)

Implements abstract org.bouncycastle.crypto.general.GeneralParametersWithIV.create.

withIVback to summary
public ChaCha20.Parameters withIV(SecureRandom random)

Overrides org.bouncycastle.crypto.general.GeneralParametersWithIV.withIV.

Implements org.bouncycastle.crypto.ParametersWithIV.withIV.

Doc from org.bouncycastle.crypto.general.GeneralParametersWithIV.withIV.

Return an implementation of our parameterized type with an IV constructed from the passed in SecureRandom.

Parameters
random:SecureRandom

the SecureRandom to use as the source of IV data.

Returns:ChaCha20.Parameters

a new instance of our parameterized type with a new IV.