AbstractSymmetricCipherService

Base abstract class for supporting symmetric key cipher algorithms.

@since 1.0

Constructors

this
this(string algorithmName)
Undocumented in source.

Members

Functions

generateNewKey
Key generateNewKey()

Generates a new {@link java.security.Key Key} suitable for this CipherService's {@link #getAlgorithmName() algorithm} by calling {@link #generateNewKey(int) generateNewKey(128)} (uses a 128 bit size by default).

generateNewKey
Key generateNewKey(int keyBitSize)

Generates a new {@link Key Key} of the specified size suitable for this CipherService (based on the {@link #getAlgorithmName() algorithmName} using the JDK {@link javax.crypto.KeyGenerator KeyGenerator}.

Inherited Members

From JcaCipherService

getAlgorithmName
string getAlgorithmName()

Returns the cipher algorithm name that will be used for all encryption, decryption, and key operations (for example, 'AES', 'Blowfish', 'RSA', 'DSA', 'TripleDES', etc).

getKeySize
int getKeySize()

Returns the size in bits (not bytes) of generated cipher keys.

setKeySize
void setKeySize(int keySize)

Sets the size in bits (not bytes) of generated cipher keys.

isGenerateInitializationVectors
bool isGenerateInitializationVectors()
Undocumented in source. Be warned that the author may not have intended to support it.
setGenerateInitializationVectors
void setGenerateInitializationVectors(bool generateInitializationVectors)
Undocumented in source. Be warned that the author may not have intended to support it.
getInitializationVectorSize
int getInitializationVectorSize()

Returns the algorithm-specific size in bits of generated initialization vectors.

setInitializationVectorSize
void setInitializationVectorSize(int initializationVectorSize)

Sets the algorithm-specific initialization vector size in bits (not bytes!) to be used when generating initialization vectors. The value must be a multiple of {@code 8} to ensure that the IV can be represented as a byte array.

isGenerateInitializationVectors
bool isGenerateInitializationVectors(bool streaming)
Undocumented in source. Be warned that the author may not have intended to support it.
getStreamingBufferSize
int getStreamingBufferSize()

Returns the size in bytes of the internal buffer used to transfer data from one stream to another during stream operations ({@link #encrypt(java.io.InputStream, java.io.OutputStream, byte[])} and {@link #decrypt(java.io.InputStream, java.io.OutputStream, byte[])}). <p/> Default size is {@code 512} bytes.

setStreamingBufferSize
void setStreamingBufferSize(int streamingBufferSize)

Sets the size in bytes of the internal buffer used to transfer data from one stream to another during stream operations ({@link #encrypt(java.io.InputStream, java.io.OutputStream, byte[])} and {@link #decrypt(java.io.InputStream, java.io.OutputStream, byte[])}). <p/> Default size is {@code 512} bytes.

generateInitializationVector
byte[] generateInitializationVector(bool streaming)
Undocumented in source. Be warned that the author may not have intended to support it.
encrypt
ByteSource encrypt(byte[] plaintext, byte[] key)
Undocumented in source. Be warned that the author may not have intended to support it.
decrypt
ByteSource decrypt(byte[] ciphertext, byte[] key)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta