Top Inners Constructors Methods
org.bouncycastle.crypto.general

pack-priv abstract Class GuardedSymmetricStreamOperatorFactory<T extends Parameters>

extends Object
implements SymmetricOperatorFactory<T extends Parameters>
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.SymmetricOperatorFactory
Known Direct Subclasses
org.bouncycastle.crypto.general.ARC4.OperatorFactory, org.bouncycastle.crypto.general.ChaCha20.OperatorFactory
Imports
java.io.InputStream, .OutputStream, java.security.SecureRandom, org.bouncycastle.crypto.CipherOutputStream, .CryptoServicesRegistrar, .InputDecryptor, .OperatorUsingSecureRandom, .OutputDecryptor, .OutputEncryptor, .Parameters, .SymmetricKey, .SymmetricOperatorFactory, org.bouncycastle.crypto.fips.FipsStatus, .FipsUnapprovedOperationError, org.bouncycastle.crypto.internal.StreamCipher, org.bouncycastle.crypto.internal.io.CipherInputStream, .CipherOutputStreamImpl

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected abstract StreamCipher
createCipher(boolean forEncryption, SymmetricKey key, T parameters, SecureRandom random)

public final InputDecryptor<T>
createInputDecryptor(SymmetricKey
the key to initialize the encryptor with.
key
,
final T
the parameters to use to initialize the encryptor.
parameters
)

Implements org.bouncycastle.crypto.SymmetricOperatorFactory.createInputDecryptor.

Return a decryptor that operates on an input stream.
public OutputDecryptor<T>
createOutputDecryptor(SymmetricKey
the key to initialize the encryptor with.
key
,
final T
the parameters to use to initialize the encryptor.
parameters
)

Implements org.bouncycastle.crypto.SymmetricOperatorFactory.createOutputDecryptor.

Return a decryptor that operates on an output stream.
public final OutputEncryptor<T>
createOutputEncryptor(SymmetricKey
the key to initialize the encryptor with.
key
,
final T
the parameters to use to initialize the encryptor.
parameters
)

Implements org.bouncycastle.crypto.SymmetricOperatorFactory.createOutputEncryptor.

Return an encryptor that operates on an output stream.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

GuardedSymmetricStreamOperatorFactoryback to summary
pack-priv GuardedSymmetricStreamOperatorFactory()

Method Detail

createCipherback to summary
protected abstract StreamCipher createCipher(boolean forEncryption, SymmetricKey key, T parameters, SecureRandom random)
createInputDecryptorback to summary
public final InputDecryptor<T> createInputDecryptor(SymmetricKey key, final T parameters)

Implements org.bouncycastle.crypto.SymmetricOperatorFactory.createInputDecryptor.

Doc from org.bouncycastle.crypto.SymmetricOperatorFactory.createInputDecryptor.

Return a decryptor that operates on an input stream.

Parameters
key:SymmetricKey

the key to initialize the encryptor with.

parameters:T

the parameters to use to initialize the encryptor.

Returns:InputDecryptor<T>

an InputDecryptor.

createOutputDecryptorback to summary
public OutputDecryptor<T> createOutputDecryptor(SymmetricKey key, final T parameters)

Implements org.bouncycastle.crypto.SymmetricOperatorFactory.createOutputDecryptor.

Doc from org.bouncycastle.crypto.SymmetricOperatorFactory.createOutputDecryptor.

Return a decryptor that operates on an output stream.

Parameters
key:SymmetricKey

the key to initialize the encryptor with.

parameters:T

the parameters to use to initialize the encryptor.

Returns:OutputDecryptor<T>

an OutputDecryptor.

createOutputEncryptorback to summary
public final OutputEncryptor<T> createOutputEncryptor(SymmetricKey key, final T parameters)

Implements org.bouncycastle.crypto.SymmetricOperatorFactory.createOutputEncryptor.

Doc from org.bouncycastle.crypto.SymmetricOperatorFactory.createOutputEncryptor.

Return an encryptor that operates on an output stream.

Parameters
key:SymmetricKey

the key to initialize the encryptor with.

parameters:T

the parameters to use to initialize the encryptor.

Returns:OutputEncryptor<T>

an OutputEncryptor

org.bouncycastle.crypto.general back to summary

private Class GuardedSymmetricStreamOperatorFactory.OutEncryptor

extends Object
implements OutputEncryptor<T extends Parameters>, OperatorUsingSecureRandom<OutputEncryptor<T extends Parameters>>
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.crypto.general.GuardedSymmetricStreamOperatorFactory.OutEncryptor
All Implemented Interfaces
org.bouncycastle.crypto.OperatorUsingSecureRandom, org.bouncycastle.crypto.OutputEncryptor, org.bouncycastle.crypto.OutputCipher

Field Summary

Modifier and TypeField and Description
private final StreamCipher
private final SymmetricKey
private final T

Constructor Summary

AccessConstructor and Description
public
OutEncryptor(SymmetricKey key, T parameters, SecureRandom random)

Method Summary

Modifier and TypeMethod and Description
public CipherOutputStream
getEncryptingStream(OutputStream
the output stream to collect the encrypted data in.
out
)

Implements org.bouncycastle.crypto.OutputEncryptor.getEncryptingStream.

Return a stream which will encrypt it's input writing the results to out.
public int
getMaxOutputSize(int
the length of the input.
inputLen
)

Implements org.bouncycastle.crypto.OutputCipher.getMaxOutputSize.

Return the size of the output buffer required for a write() plus a close() with the write() being passed inputLen bytes.
public T
getParameters()

Implements org.bouncycastle.crypto.OutputCipher.getParameters.

Return the parameters for this cipher.
public int
getUpdateOutputSize(int
the length of the input.
inputLen
)

Implements org.bouncycastle.crypto.OutputCipher.getUpdateOutputSize.

Return the size of the output buffer required for a write() with the write() being passed inputLen bytes and just updating the cipher output.
public OutputEncryptor<T>
withSecureRandom(SecureRandom
the SecureRandom to use.
random
)

Implements org.bouncycastle.crypto.OperatorUsingSecureRandom.withSecureRandom.

Create a version of T using the SecureRandom random.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cipherback to summary
private final StreamCipher cipher
keyback to summary
private final SymmetricKey key
parametersback to summary
private final T parameters

Constructor Detail

OutEncryptorback to summary
public OutEncryptor(SymmetricKey key, T parameters, SecureRandom random)

Method Detail

getEncryptingStreamback to summary
public CipherOutputStream getEncryptingStream(OutputStream out)

Implements org.bouncycastle.crypto.OutputEncryptor.getEncryptingStream.

Doc from org.bouncycastle.crypto.OutputEncryptor.getEncryptingStream.

Return a stream which will encrypt it's input writing the results to out.

Parameters
out:OutputStream

the output stream to collect the encrypted data in.

Returns:CipherOutputStream

a stream for writing the original plain-text data.

getMaxOutputSizeback to summary
public int getMaxOutputSize(int inputLen)

Implements org.bouncycastle.crypto.OutputCipher.getMaxOutputSize.

Doc from org.bouncycastle.crypto.OutputCipher.getMaxOutputSize.

Return the size of the output buffer required for a write() plus a close() with the write() being passed inputLen bytes.

The returned size may be dependent on the initialisation of this cipher and may not be accurate once subsequent input data is processed as the cipher may add, add or remove padding, as it sees fit.

Parameters
inputLen:int

the length of the input.

Returns:int

the space required to accommodate a call to processBytes and doFinal with inputLen bytes of input.

getParametersback to summary
public T getParameters()

Implements org.bouncycastle.crypto.OutputCipher.getParameters.

Doc from org.bouncycastle.crypto.OutputCipher.getParameters.

Return the parameters for this cipher.

Returns:T

the cipher's parameters.

getUpdateOutputSizeback to summary
public int getUpdateOutputSize(int inputLen)

Implements org.bouncycastle.crypto.OutputCipher.getUpdateOutputSize.

Doc from org.bouncycastle.crypto.OutputCipher.getUpdateOutputSize.

Return the size of the output buffer required for a write() with the write() being passed inputLen bytes and just updating the cipher output.

The returned size may be dependent on the state of this cipher.

Parameters
inputLen:int

the length of the input.

Returns:int

the space required to accommodate a call to processBytes with inputLen bytes of input.

withSecureRandomback to summary
public OutputEncryptor<T> withSecureRandom(SecureRandom random)

Implements org.bouncycastle.crypto.OperatorUsingSecureRandom.withSecureRandom.

Doc from org.bouncycastle.crypto.OperatorUsingSecureRandom.withSecureRandom.

Create a version of T using the SecureRandom random.

Parameters
random:SecureRandom

the SecureRandom to use.

Returns:OutputEncryptor<T>

a new version of T using random.