public final class SymmetricCryptoAlgorithmBuilder extends Object
SymmetricCryptoAlgorithm.SymmetricCryptoAlgorithm| Constructor and Description |
|---|
SymmetricCryptoAlgorithmBuilder(byte[] keyPassword,
String algorithmName,
String shortAlgorithmName,
int keySize,
int blockSize)
Creates a new builder.
|
SymmetricCryptoAlgorithmBuilder(KeyFactory<Key> keyFactory,
String algorithmName,
String shortAlgorithmName,
int blockSize)
Creates a new builder.
|
| Modifier and Type | Method and Description |
|---|---|
EncryptionAlgorithm |
build()
Builds a new instance of encryption algorithm.
|
SymmetricCryptoAlgorithmBuilder |
bytesRepresentation(BytesRepresentation bytesRepresentation)
Sets how byte arrays will be represented in strings.
|
SymmetricCryptoAlgorithmBuilder |
combineSplitAlgorithm(CombineSplitAlgorithm combineSplitAlgorithm)
Sets algorithm combining IV and cipher text in output during encryption
and splitting from input during decryption.
|
SymmetricCryptoAlgorithmBuilder |
encoding(String encoding)
Sets encoding for strings in input and output.
|
SymmetricCryptoAlgorithmBuilder |
keyHashIterations(int keyHashIterations)
Sets number of keyHashIterations of hashing for key derivation.
|
SymmetricCryptoAlgorithmBuilder |
keySalt(byte[] keySalt)
Sets salt for key derivation.
|
SymmetricCryptoAlgorithmBuilder |
keySalt(String keySalt)
Sets salt for key derivation.
|
public SymmetricCryptoAlgorithmBuilder(byte[] keyPassword,
String algorithmName,
String shortAlgorithmName,
int keySize,
int blockSize)
keyPassword - key passwordalgorithmName - full algorithm name (used for Cipher initialization)shortAlgorithmName - short algorithm name (typically only first part of full name)keySize - size of the key (in bits)blockSize - size of the block (in bits)public SymmetricCryptoAlgorithmBuilder(KeyFactory<Key> keyFactory, String algorithmName, String shortAlgorithmName, int blockSize)
keyFactory - factory for the keysalgorithmName - full algorithm name (used for Cipher initialization)shortAlgorithmName - short algorithm name (typically only first part of full name)blockSize - size of the block (in bits)public SymmetricCryptoAlgorithmBuilder keySalt(byte[] keySalt) throws IllegalArgumentException
keySalt - salt to be setIllegalArgumentException - exception if passed key salt is nullpublic SymmetricCryptoAlgorithmBuilder keySalt(String keySalt) throws IllegalArgumentException
keySalt - salt to be setIllegalArgumentException - exception if passed key salt is nullpublic SymmetricCryptoAlgorithmBuilder keyHashIterations(int keyHashIterations) throws IllegalArgumentException
keyHashIterations - number of keyHashIterationsIllegalArgumentException - exception if passed iterations are lower than 1public SymmetricCryptoAlgorithmBuilder combineSplitAlgorithm(CombineSplitAlgorithm combineSplitAlgorithm) throws IllegalArgumentException
combineSplitAlgorithm - combine/split algorithm for IV and cipher textIllegalArgumentException - exception if passed CombineSplitAlgorithm is nullpublic SymmetricCryptoAlgorithmBuilder bytesRepresentation(BytesRepresentation bytesRepresentation) throws IllegalArgumentException
HexRepresentation is used.bytesRepresentation - byte array representation strategyIllegalArgumentException - exception if passed BytesRepresentation is nullpublic SymmetricCryptoAlgorithmBuilder encoding(String encoding) throws IllegalArgumentException
encoding - encoding to be setIllegalArgumentException - exception if given encoding is null or not supportedpublic EncryptionAlgorithm build() throws IllegalArgumentException
IllegalArgumentExceptionCopyright © 2016. All rights reserved.