Re: generating keys

Charlie Lai (Charlie.Lai@Eng)
Mon, 12 Jan 1998 16:16:38 -0800 (PST)

From: Charlie.Lai@Eng (Charlie Lai)
Message-Id: <199801130016.QAA02910@angeles.eng.sun.com>
Subject: Re: generating keys
To: dan.ascheman@medtronic.com (Dan Ascheman)
Date: Mon, 12 Jan 1998 16:16:38 -0800 (PST)
In-Reply-To: <s4ba2015.021@mspeos0.corp.medtronic.com> from "Dan Ascheman" at Jan 12, 98 01:51:59 pm

hi,

> I am attempting to generate a public and private key, and my question is
> - how long does it take JVM to generate a pair of keys using this code:
> (I am using the DSA alogorithm with the standard Provider.class.)
> (And I am using SecureRandom() for a random number)
>
> Keypair myPair = keyGen.generateKeyPair();
>
> it seems to take forever - it's like it gets stuck there - how do I know
> it's doing anything?

is it getting stuck at that particular line you noted above?
or could it possibly be getting stuck at the previous line:

keyGen.initialize(1024, new SecureRandom());

the reason why i ask is because there's a known problem with
SecureRandom() and its self-seed generation process on machines
that are heavily loaded. sometimes it hangs. however, we addressed
this problem in the next JDK release.

if it is getting stuck on the initialize() line, the current workaround
is to pass your own seed to the SecureRandom constructor.

thanks,
charlie