public class TripleDESBuilder 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 TripleDESBuilder(CryptoKeyFactory)
constructor to specify custom factory for the key.
EncryptionAlgorithm des = new TripleDESBuilder("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 |
|---|
TripleDESBuilder(byte[] keyPassword)
Creates a new builder for 3DES encryption algorithm.
|
TripleDESBuilder(CryptoKeyFactory customKeyFactory)
Crates a new builder for 3DES encryption algorithm.
|
TripleDESBuilder(String keyPassword)
Creates a new builder for 3DES 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, bytesRepresentation, combineAlgorithm, encoding, keyHashIterations, keySalt, keySaltpublic TripleDESBuilder(byte[] keyPassword)
keyPassword - password for key derivationpublic TripleDESBuilder(String keyPassword)
keyPassword - password for key derivationpublic TripleDESBuilder(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.