From 3656c883c7ed35f0dcda73ebb89ee83b0bc2f1b1 Mon Sep 17 00:00:00 2001 From: joewitt <joewitt@apache.org> Date: Wed, 2 Dec 2015 20:47:51 -0500 Subject: [PATCH] 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> --- .../nifi/processors/standard/util/PasswordBasedEncryptor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/PasswordBasedEncryptor.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/PasswordBasedEncryptor.java index c3b0cd42b5..1f45d6f504 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/PasswordBasedEncryptor.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/PasswordBasedEncryptor.java @@ -41,6 +41,7 @@ public class PasswordBasedEncryptor implements Encryptor { private int saltSize; private SecretKey secretKey; + @Deprecated public static final String SECURE_RANDOM_ALGORITHM = "SHA1PRNG"; public static final int DEFAULT_SALT_SIZE = 8; @@ -65,7 +66,7 @@ public class PasswordBasedEncryptor implements Encryptor { public StreamCallback getEncryptionCallback() throws ProcessException { try { byte[] salt = new byte[saltSize]; - SecureRandom secureRandom = SecureRandom.getInstance(SECURE_RANDOM_ALGORITHM, "SUN"); + SecureRandom secureRandom = new SecureRandom(); secureRandom.nextBytes(salt); return new EncryptCallback(salt); } catch (Exception e) {