Add javadoc at constructors.

Closes gh-9361

Signed-off-by: Manousos Mathioudakis <manoumathioudakis@yahoo.gr>
This commit is contained in:
Manousos Mathioudakis 2021-03-24 16:44:16 +02:00 committed by Rob Winch
parent 8d82ebaa2f
commit d948528b7b
1 changed files with 26 additions and 0 deletions

View File

@ -52,14 +52,40 @@ public final class AesBytesEncryptor implements BytesEncryptor {
private static final String AES_GCM_ALGORITHM = "AES/GCM/NoPadding";
/**
* Constructs an encryptor that uses AES encryption. Example: <code>
* AesBytesEncryptor encryptor = new AesBytesEncryptor(yourPassword, 5c0744940b5c369b);
* </code>
* @param password the password value
* @param salt the hex-encoded salt value
*/
public AesBytesEncryptor(String password, CharSequence salt) {
this(password, salt, null);
}
/**
* Constructs an encryptor that uses AES encryption. Example: <code>
* AesBytesEncryptor encryptor =
* new AesBytesEncryptor(yourPassword, 5c0744940b5c369b, KeyGenerators.secureRandom(16));
* </code>
* @param password the password value
* @param salt the hex-encoded salt value
* @param ivGenerator the generator used to generate the initialization vector
*/
public AesBytesEncryptor(String password, CharSequence salt, BytesKeyGenerator ivGenerator) {
this(password, salt, ivGenerator, CipherAlgorithm.CBC);
}
/**
* Constructs an encryptor that uses AES encryption. Example: <code>
* AesBytesEncryptor encryptor =
* new AesBytesEncryptor(yourPassword, 5c0744940b5c369b, KeyGenerators.secureRandom(16), CipherAlgorithm.GCM);
* </code>
* @param password the password value
* @param salt the hex-encoded salt value
* @param ivGenerator the generator used to generate the initialization vector
* @param alg the {@link CipherAlgorithm} to be used
*/
public AesBytesEncryptor(String password, CharSequence salt, BytesKeyGenerator ivGenerator, CipherAlgorithm alg) {
this(CipherUtils.newSecretKey("PBKDF2WithHmacSHA1",
new PBEKeySpec(password.toCharArray(), Hex.decode(salt), 1024, 256)), ivGenerator, alg);