mirror of https://github.com/apache/nifi.git
NIFI-1240 removing explicit reference to SUN provider. Not necessary for our use and ties us to Sun or JREs with Sun JCE available. Favoring no-args constructor instantiation of SecureRandom for greater flexibility in choosing from available CSPs. Deprecating the associated public constant for the PRNG.
Signed-off-by: Aldrin Piri <aldrin@apache.org>
This commit is contained in:
parent
6bdcd3913f
commit
3656c883c7
|
@ -41,6 +41,7 @@ public class PasswordBasedEncryptor implements Encryptor {
|
||||||
private int saltSize;
|
private int saltSize;
|
||||||
private SecretKey secretKey;
|
private SecretKey secretKey;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static final String SECURE_RANDOM_ALGORITHM = "SHA1PRNG";
|
public static final String SECURE_RANDOM_ALGORITHM = "SHA1PRNG";
|
||||||
public static final int DEFAULT_SALT_SIZE = 8;
|
public static final int DEFAULT_SALT_SIZE = 8;
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ public class PasswordBasedEncryptor implements Encryptor {
|
||||||
public StreamCallback getEncryptionCallback() throws ProcessException {
|
public StreamCallback getEncryptionCallback() throws ProcessException {
|
||||||
try {
|
try {
|
||||||
byte[] salt = new byte[saltSize];
|
byte[] salt = new byte[saltSize];
|
||||||
SecureRandom secureRandom = SecureRandom.getInstance(SECURE_RANDOM_ALGORITHM, "SUN");
|
SecureRandom secureRandom = new SecureRandom();
|
||||||
secureRandom.nextBytes(salt);
|
secureRandom.nextBytes(salt);
|
||||||
return new EncryptCallback(salt);
|
return new EncryptCallback(salt);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue