· 7 years ago · Oct 18, 2018, 09:34 PM
1[ERROR] Null/empty securerandom.strongAlgorithms Security Property
2[ERROR] at com.test.cipher.AesGcmCipher.generate(AesGcmCipher.java:72)
3[ERROR] at com.test.scheme.Version1CryptoSchemeAesGcmTest$1.getDefaultCipher(Version1CryptoSchemeAesGcmTest.java:27)
4[ERROR] at com.test.scheme.Version1CryptoSchemeAesGcmTest$1.getDefaultCipher(Version1CryptoSchemeAesGcmTest.java:24)
5[ERROR] at com.test.CachingCryptoCipherProvider.<init>(CachingCryptoCipherProvider.java:43)
6[ERROR] at com.test.CryptoCipherProvider.asCachingProvider(CryptoCipherProvider.java:28)
7[ERROR] at com.test.scheme.Version1CryptoSchemeAesGcmTest.createAesGcmProvider(Version1CryptoSchemeAesGcmTest.java:35)
8[ERROR] at com.test.scheme.Version1CryptoSchemeAesGcmTest.<init>(Version1CryptoSchemeAesGcmTest.java:20)
9[ERROR] ... 28 more
10[ERROR] Caused by: java.security.NoSuchAlgorithmException: Null/empty securerandom.strongAlgorithms Security Property
11[ERROR] at java.security.SecureRandom.getInstanceStrong(SecureRandom.java:627)
12[ERROR] at com.test.cipher.AesGcmCipher.generate(AesGcmCipher.java:62)
13[ERROR] ... 34 more`
14
15public class AesGcmCipher {
16 public static AesGcmCipher generate(BiConsumer<AesGcmCipher, SecretKey> consumer) {
17 try {
18 UUID cipherId = UUID.randomUUID();
19 SecureRandom random = SecureRandom.getInstanceStrong();
20 KeyGenerator keyGen = KeyGenerator.getInstance(AES);
21 AesGcmCipher cipher = new AesGcmCipher(cipherId, secretKey, new Date());
22 return cipher;
23 } catch (NoSuchAlgorithmException ex) {
24 LOGGER.error(msg);
25 throw new CryptoException(msg, ex);
26 }
27 }
28}