added support for getInstanceStrong()
// unfortunately new SecureRandom() can cause a regress and it's the only reliable way of getting access
// to the JVM's seed generator.
private static SecureRandom createInitialEntropySource()
+ {
+ boolean hasGetInstanceStrong = AccessController.doPrivileged(new PrivilegedAction<Boolean>()
+ {
+ public Boolean run()
+ {
+ try
+ {
+ Class def = SecureRandom.class;
+
+ return def.getMethod("getInstanceStrong") != null;
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+ }
+ });
+
+ if (hasGetInstanceStrong)
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<SecureRandom>()
+ {
+ public SecureRandom run()
+ {
+ try
+ {
+ return (SecureRandom)SecureRandom.class.getMethod("getInstanceStrong").invoke(null);
+ }
+ catch (Exception e)
+ {
+ return createCoreSecureRandom();
+ }
+ }
+ });
+ }
+ else
+ {
+ return createCoreSecureRandom();
+ }
+ }
+
+ private static SecureRandom createCoreSecureRandom()
{
if (initialEntropySourceAndSpi != null)
{
