I would like to consult with some question about the general myth of SecureRandom in Java, about the trade-off between security and performance.
I searched the Internet for a while, and I collected the following information. I would like people to help me confirm what I have, and I hope to get some ideas on what to actually choose for implementation.
Basically, here are some of the most popular and thorough articles for SecureRandom:
Proper use of Java SecureRandom: http://www.cigital.com/justice-league-blog/2009/08/14/proper-use-of-javas-securerandom/
Problems using Java SecureRandom: http://www.cigital.com/justice-league-blog/2014/01/06/issues-when-using-java-securerandom/
Using the SecureRandom class: http://moi.vonos.net/java/securerandom/
And Sun's official "confession" about the bug / confusion and the proposed release in Java 8: http://openjdk.java.net/jeps/123
Now that Java 8 is missing, I honestly donβt know how best it was fixed just by looking at the documentation: http://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html
So in the end, this is what I got (please help me find out if I am sorted):
People like Amit Networks suggest using specific instances, such as: SecureRandom sr3 = SecureRandom.getInstance ("SHA1PRNG", "SUN"), where in fact Sun tells us that this will always read / dev / random (? ?), which means that it can potentially be blocked for EVERY call. Unlike if you use the new SecureRandom (), it will always read from / dev / urandom if the generateSeed () function is not called. Cm.
http://bugs.java.com/view_bug.do?bug_id=6202721
Does this mean that βnew SecureRandom ()β is still preferable in current Java? Not many other documents that I found have articulated the above point explicitly, so I want to know if this is still true?
Now, if "new SecureRandom ()" is the choice and will result in never blocking the call, then I think I should do for periodic re-entry:
Make SecureRandom a static instance in the class and let another Executor thread periodically call generateSeed () on it, so even though the call is blocked, it does not affect my main request processing thread in my application. Does that sound like a good way to do this?
Encourage Java lovers and cryptanalysts to shed light on this issue. Thanks!
Edit: Another useful thread here seems to confirm my assumptions: https://bugs.openjdk.java.net/browse/JDK-4705093