[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] Problems with SHA1Random and RandomSeedGenerator




Heya,

I seem to have a problem with some part of the RandomSeenGenerator when
using SUNS 1.1.7B JRe under Windows.

If I use JDK1.1.8 from IBM or SUN i Do not get the problem...

What I do is I try and perform thhe seed generation in a trhead at
startup, so that I do not have to wait when I try and connect the 1st
time that the user tries to connect using https.

Here is a test class that I wrote that tested it:
import java.util.Random;
import iaik.security.random.SHA1Random;
import iaik.security.random.MetaSeedGenerator;
import iaik.security.random.SeedGenerator;

public class R
{     
   static SHA1Random rAll;
   
   static void debug(String s)
   {                         
      System.out.println(s);
   }
   
   static public void main(String args[])
   {                                                         
      // Add provider...
      iaik.security.provider.IAIK.addAsProvider(true);
                        
      // Try Initing the random
      try 
      {     
         debug("Initing SHA1 Random....");
         rAll = new  SHA1Random();
         debug("Got Random");
         rAll.setSeed();
         debug("Seed Set....");
         SeedGenerator.setDefault(MetaSeedGenerator.class);
         debug("SHA1 Random Inited....");
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }
   }
}

When I run this under IBMs JRE 1.1.8 I get:
=================
Java version number: 1.1.8
Java compiler: ibmjitc
Java vendor-specific string: IBM Corporation
Java vendor URL: http://www.ibm.com/
Java installation directory: c:\java\jre118
Java class format version number: 45.3
Java class path:
.;\java\https.jar;c:\java\jre118\lib\math.jar;c:\java\jre118\li
b\rt.jar;c:\java\jre118\lib\i18n.jar;c:\java\jre118\lib\classes.zip;c:\java\jre1
18\classes
Operating system name: Windows 95
Operating system architecture: x86
Operating system version: 4.10

Installed security providers providers:

Provider 1: IAIK  version: 2.5100000000000002
Provider 2: SUN  version: 1.0
Initing SHA1 Random....
Got Random
Seed Set....
SHA1 Random Inited....
=================

When I run using Suns 1.1.7B I get:

=================
Java version number: 1.1.7B
Java compiler: symcjit
Java vendor-specific string: Sun Microsystems Inc.
Java vendor URL: http://www.sun.com/
Java installation directory: c:\java\jre117i
Java class format version number: 45.3
Java class path:
.;\java\https.jar;c:\java\jre117i\lib\rt.jar;c:\java\jre117i\li
b\i18n.jar;c:\java\jre117i\lib\classes.zip;c:\java\jre117i\classes
Operating system name: Windows 95
Operating system architecture: x86
Operating system version: 4.10

Installed security providers providers:

Provider 1: IAIK  version: 2.5100000000000002
Provider 2: SUN  version: 1.0
Initing SHA1 Random....
Got Random
=================

and it sits there forever and a day.

I turned on Verbose and found that with the IBM JRE, I get:
======[Snipped to show the end only]========
Got Random
[Loaded iaik/security/random/SeedGenerator.class from \java\https.jar]
[Loaded iaik/security/random/JDKSeedGenerator.class from
\java\https.jar]
[Loaded java/security/SeedGenerator.class from
c:\java\jre118\lib\rt.jar]
[Loaded java/security/SeedGenerator$BogusThread.class from
c:\java\jre118\lib\rt.jar]
[Loaded iaik/security/random/MetaSeedGenerator.class from
\java\https.jar]
Seed Set....
SHA1 Random Inited....
============================================

But when I use the Sun JRE, It loads an Extra couple of Exception
classes:

======[Snipped to show the end only]========
Got Random
[Loaded java/io/InterruptedIOException.class from
c:\java\jre117i\lib\rt.jar]
[Loaded iaik/security/random/SeedGenerator.class from \java\https.jar]
[Loaded iaik/security/random/JDKSeedGenerator.class from
\java\https.jar]
[Loaded java/security/SeedGenerator.class from
c:\java\jre117i\lib\rt.jar]
[Loaded java/lang/InternalError.class from c:\java\jre117i\lib\rt.jar]
[Loaded java/security/NoSuchAlgorithmException.class from
c:\java\jre117i\lib\rt.jar]
[Loaded java/security/SeedGenerator$BogusThread.class from
c:\java\jre117i\lib\rt.jar]
[Loaded java/lang/IllegalArgumentException.class from
c:\java\jre117i\lib\rt.jar]
[Loaded java/lang/IllegalThreadStateException.class from
c:\java\jre117i\lib\rt.jar]
============================================

And then it sits there...forever.

So it looks like the SeedGenerator$BogusThread may be causing an
expection that the SeedGenerator is not catching.. well at least in the
Sun JRE.

Am I doing something out of the ordinary in my routines?
Or is this something that IAIK can have a look at?
Or should I suggest that all our 50.000 plus customer upgrade to JDK
1.1.8??

Thanks.

Gil Peeters.

-- 
-----------------------------------------------------------------------
Gil Peeters
b.v.b.a CANCAS I.T.
-----------------------------------------------------------------------
--
Mailinglist-archive at http://jcewww.iaik.tu-graz.ac.at/mailarchive/iaik-jce/maillist.html

To unsubscribe send an email to listserv@iaik.tu-graz.ac.at with the folowing content: UNSUBSCRIBE iaik-jce