From 4df5717012d5de386d39de391dbabbfd3d7d56a5 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 26 Jun 2019 09:27:51 -0400 Subject: Speed up CryptoUtilsTest CryptoUtilsTest runs slowly because the SecureRandom that CryptoUtils uses to generate an "iv" takes a while to create enough randomness. However, as the "iv" is only used as a "salt", it is not necessary to use SecureRandom; the values generated by Random are sufficient. Change-Id: I1f3b03b85d28852a7969d3a83802a2691308caa5 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn --- .../java/org/onap/policy/common/utils/security/CryptoUtilsTest.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'utils/src/test/java/org/onap/policy') diff --git a/utils/src/test/java/org/onap/policy/common/utils/security/CryptoUtilsTest.java b/utils/src/test/java/org/onap/policy/common/utils/security/CryptoUtilsTest.java index 9a88918d..a9924152 100644 --- a/utils/src/test/java/org/onap/policy/common/utils/security/CryptoUtilsTest.java +++ b/utils/src/test/java/org/onap/policy/common/utils/security/CryptoUtilsTest.java @@ -22,6 +22,7 @@ package org.onap.policy.common.utils.security; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.security.GeneralSecurityException; import org.junit.Test; @@ -46,6 +47,7 @@ public class CryptoUtilsTest { CryptoUtils cryptoUtils = new CryptoUtils(SECRET_KEY); String encryptedValue = cryptoUtils.encrypt(PASS); logger.info(ENCRYPTED_MSG, PASS, encryptedValue); + assertTrue(encryptedValue.startsWith("enc:")); String decryptedValue = cryptoUtils.decrypt(encryptedValue); logger.info(DECRYPTED_MSG, encryptedValue, decryptedValue); -- cgit 1.2.3-korg