diff --git a/README_JCE.md b/README_JCE.md index 9bfde157..49cf3582 100644 --- a/README_JCE.md +++ b/README_JCE.md @@ -34,6 +34,7 @@ The JCE provider currently supports the following algorithms: SHA-512 SecureRandom Class + DEFAULT (maps to HashDRBG) HashDRBG Cipher Class diff --git a/src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java b/src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java index 0d502c0f..c38f9cad 100644 --- a/src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java +++ b/src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java @@ -65,6 +65,8 @@ public WolfCryptProvider() { /* SecureRandom */ /* TODO: May need to add "SHA1PRNG" alias, other JCA consumemrs may * explicitly request it? Needs more testing. */ + put("SecureRandom.DEFAULT", + "com.wolfssl.provider.jce.WolfCryptRandom"); put("SecureRandom.HashDRBG", "com.wolfssl.provider.jce.WolfCryptRandom"); diff --git a/src/test/java/com/wolfssl/provider/jce/test/WolfCryptRandomTest.java b/src/test/java/com/wolfssl/provider/jce/test/WolfCryptRandomTest.java index fd93f4fb..b209a5e2 100644 --- a/src/test/java/com/wolfssl/provider/jce/test/WolfCryptRandomTest.java +++ b/src/test/java/com/wolfssl/provider/jce/test/WolfCryptRandomTest.java @@ -57,7 +57,13 @@ public static void testProviderInstallationAtRuntime() { public void testGetRandomFromProvider() throws NoSuchProviderException, NoSuchAlgorithmException { - SecureRandom rand = SecureRandom.getInstance("HashDRBG", "wolfJCE"); + SecureRandom rand = null; + + /* HashDRBG */ + rand = SecureRandom.getInstance("HashDRBG", "wolfJCE"); + + /* DEFAULT */ + rand = SecureRandom.getInstance("DEFAULT", "wolfJCE"); } @Test