public class AESBuilder extends SymmetricAlgorithmBuilder
By default, PBKDF2 is used for key derivation. You can provide salt and iterations count for it.
If you want custom encryption key derivation, you can use AESBuilder(CryptoKeyFactory)
constructor to specify custom factory for the key.
EncryptionAlgorithm aes = new AESBuilder("secret")
.keySalt("saltForKeyDerivation") // optional
.iterations(4096) // optional
.build();
Note that this builder is mutable but built instances are immutable and thus thread safe.
For more information about the implementation (e.g. about initialization vectors), see SymmetricAlgorithm.
SymmetricAlgorithm| Constructor and Description |
|---|
AESBuilder(byte[] keyPassword)
Creates a new builder for AES encryption algorithm.
|
AESBuilder(CryptoKeyFactory customKeyFactory)
Crates a new builder for AES encryption algorithm.
|
AESBuilder(String keyPassword)
Creates a new builder for AES encryption algorithm.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
getAlgorithm()
Gets a name of algorithm supported by crypto.
|
protected int |
getBlockSize()
Gets a block size of cipher (for CBC).
|
protected int |
getKeySize()
Gets size of the key.
|
protected String |
getShortAlgorithm()
Gets a short name of algorithm supported by crypto keys.
|
build, combineAlgorithm, encoding, keyHashIterations, keySalt, keySaltpublic AESBuilder(byte[] keyPassword)
keyPassword - password for key derivationpublic AESBuilder(String keyPassword)
keyPassword - password for key derivationpublic AESBuilder(CryptoKeyFactory customKeyFactory)
customKeyFactory - custom factory for encryption keyprotected String getAlgorithm()
SymmetricAlgorithmBuildergetAlgorithm in class SymmetricAlgorithmBuilderprotected String getShortAlgorithm()
SymmetricAlgorithmBuildergetShortAlgorithm in class SymmetricAlgorithmBuilderprotected int getKeySize()
SymmetricAlgorithmBuildergetKeySize in class SymmetricAlgorithmBuilderprotected int getBlockSize()
SymmetricAlgorithmBuildergetBlockSize in class SymmetricAlgorithmBuilderCopyright © 2014. All rights reserved.