Hi,

I asked on this list a while back for info on keytool.  I had some
private replies and have finally come up with an answer - I'm posting
here to make leave a public record to help others in my position, in
case anyone knows better and can correct me, and to warn of apparent
insecurities.

Most importantly, as far as I can tell, keytool does not generate "fully
random" keys when used "naively".

Although keytool appears as a standalone app in the JDK/JRE, it is
implemented as Java code which can be inspected by getting the full JDK
source via the Sun/Java Community Download process.  Checking this code
shows that:

- Unless other crypto/security providers are registered, the source of
random numbers is the Java SecureRandom class.

- The Java SecureRandom class contains only 20 bytes of random state and
these are initialised by some kind of thread contention process (which
may not generate "really random" values either).

To use keytool securely, it seems that you must configure Java to use a
different provider for the SecureRandom class.  The procedure for doing
this is described in the docs that come with the JDK.

I tried to get info from Sun/Java by emailing various addresses and
posting a question to the security forum; I did not ask on the
java-security list as I couldn't register (no response from the LISTSERV
password register).  Although all the above is standard Java info (the
internal state for SecureRandom is documented in the API docs) it was
not clear that keytool is implemented in Java and, therefore, uses the
standard Java security code.

Cheers,
Andrew


Andrew Cooke wrote:
> Does anyone know the size of the internal state for the random number
> generator in Java's keytool?  A pointer to appropriate Java docs would
> be sufficient.
> 
> (This seems to be pretty critical info for deciding how reliable the
> keys are - the default random number generator in Java does not have
> much state and to get sufficient state by seeding multiple instances
> using Java's thread race mechanism - even if that is reliable - takes
> longer in  my own Java code than the time keytool takes to generate new
> keys!)
> 
> I've looked through all the docs I can find, and also checked this
> list's archives (I could only search titles (subjects) for keytool, and
> only did the last 6 months, so if it's under a different title or
> earlier, could you give me the title and/or date?).  I've also posted a
> question on the Sun Java discussion foums, but had no reply.


Reply via email to