开发者

OpenJDK 1.6 and SecureRandom/KeyGenerator (what is available?)

All of the following result in "java.security.NoSuchAlgorithmException: SHA not SecureRandom available" (or开发者_运维知识库 similar).

SecureRandom prng = SecureRandom.getInstance("SHA256");
SecureRandom prng = SecureRandom.getInstance("SHA-256");
SecureRandom prng = SecureRandom.getInstance("SHA1");
SecureRandom prng = SecureRandom.getInstance("SHA-1");
SecureRandom prng = SecureRandom.getInstance("SHA");

Similar for the following ("java.security.NoSuchAlgorithmException: SHA KeyGenerator not available"):

KeyGenerator kgen = KeyGenerator.getInstance("SHA256");
KeyGenerator kgen = KeyGenerator.getInstance("SHA-256");
KeyGenerator kgen = KeyGenerator.getInstance("SHA1");
KeyGenerator kgen = KeyGenerator.getInstance("SHA-1");
KeyGenerator kgen = KeyGenerator.getInstance("SHA");

What generators are available in OpenJDK? According to Standard Algorithm Names, it looks like the SHA family should be available (at least for SecureRandom).

Sorry for the lame Java question. I'm a Crypto++ and OpenSSL kind of guy, and Google is returning a lot of noise. I'm working in Eclipse if it matters.

Jeff


I think this should help you

http://www.java2s.com/Code/Java/Security/ListAllProviderAndItsAlgorithms.htm

Check it. Best of luck!


KeyGenerator has documentation. SHA* is a hash, not an encryption algorihtm. Using SHA* in the context of KeyGenerator makes little to no sense.

For SecureRandom (which, by the way, also has documentation) you are better off not specifying an algorithm unless you have specific requirements and you know what you are doing (like you know the provider you are trying to use)

The only connection I can come up with is the fact that the Sun JCE SecureRandom actually uses SHA1PRNG underneath.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜