Signature.update() slow speed in JDK 1.1.6 final

Charlie Lai (charlie@angeles.eng.sun.com)
Tue, 14 Jul 1998 15:50:49 -0800 (PDT)

From: charlie@angeles.eng.sun.com (Charlie Lai)
Message-Id: <199807142250.PAA28461@angeles.eng.sun.com>
Subject: Signature.update() slow speed in JDK 1.1.6 final
To: npomereu@ns1.paloalto.fr
Date: Tue, 14 Jul 1998 15:50:49 -0800 (PDT)

hi,

> I am using the Signature.update() method on a Pentium Pro 200Mhz PC with
> Windows NT, 64Mo main memory and JDK 1.1.6.
>
> It takes 6 (six) seconds to run the Signature.update(data) method, this
> speed does not change if I use a short Private Key (512) or a very short
> message (data).

are you sure it's the Signature.update method, and not the Signature.sign
method that takes 6 seconds?? because Signature.update should be very fast.
however, the sign method might very likely take 6 seconds.

this is because the sign method relies on generating random numbers.
our pseudo random number generator attempts to seed itself by
looking around the system for random input. this process makes up
the bulk of the 6-second delay, and unfortunately at this time
there's little we can do to speed that up.

> NB : I use PGPi 5.5 on the same PC and the signature check process takes
> less than a second...

it's been a while since i've used PGP, but i remember
when generating your RSA keys (which also requires a PRNG),
the user had to hit the keyboard for a few seconds so the PRNG could
properly seed itself. that's basically what the Signature.sign
method is doing, only it's looking for random input on your behalf.

and PGP's RSA sign procedure won't take long because
RSA doesn't need to generate additional random numbers when
generating signatures. it's basically some simple math.

however, the JDK uses DSA, which does require random number
generation during the sign process.

also, note that the delay you encountered should occur
only the first time you sign some data. ensuing attempts to
sign should be fast, since the PRNG has already been seeded.

thanks,
charlie