Skip to content

Add javadoc at constructors. #9518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down