JDK-4249507 : Java Plug-in 1.1.2 hangs in SecureRandom on Windows 95/98
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Affected Version: 1.1.1
  • Priority: P1
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_7
  • CPU: x86
  • Submitted: 1999-06-24
  • Updated: 1999-06-28
  • Resolved: 1999-06-28
Related Reports
Duplicate :  
Description

Name: cc11364			Date: 06/24/99

When running an applet with Java Plug-in 1.1.2 on Windows 95/98,
SecureRandom() hangs with explicit seeding.  This problem does
not occur with the Plug-in on Windows NT or Solaris clients.
This may be related to bug id 4138234 which was reported against
JDK 1.1.6.

Configuration: Java Plug-in 1.1.2, JRE 1.1.7B, Windows 95/98.

======================================================================

Name: cc11364			Date: 06/28/99

###@###.### 1999-06-28
Additional Information Requested:

private static SecureRandom random;
static {
                System.out.println(&QUOTSetting up secure random number generator");
                random = new SecureRandom();
                random.setSeed(System.currentTimeMillis());
                System.out.println(&QUOTRandom number setup completed");
        };

======================================================================

Comments
EVALUATION Sounds like a race condition in SecureRandom or a supporting class. Java Plug-in has no interaction with this class nor the underlying threading model. thomas.ball@Eng 1999-06-25 charlie.lai@Eng 1999-06-25 if you instantiate SecureRandom with a seed, the code is very straightfoward. a digest is updated. there's nothing going on that could cause a race condition or the VM to hang. there must be some information we're missing the following applet works with plugin 1.1.2, JRE 1.1.7b, win98, and netscape: import java.awt.*; public class SR extends java.applet.Applet { /** * initialize the applet. */ public void init() { } /** * display the "Hello" message. */ public void paint(Graphics g) { g.drawString("Starting SecureRandom(seed)", 50, 25); java.security.SecureRandom sr = new java.security.SecureRandom (new byte[1]); g.drawString("Getting bytes", 50, 35); sr.nextBytes(new byte[1]); g.drawString("Done", 50, 45); } can we get more information as to how SecureRandom is being instantiated (seeded)? a code snipped or a sample applet that hangs would be very useful. charlie.lai@Eng 1999-06-28 thanks for the additional information. by calling the SecureRandom constructor that takes no parameters, you automatically get the default seeding. the problem you reported is a duplicate of 4172030, and (according to the history) the fix was putback in 1.1.8. the fix vastly improves the performance of the SeedGenerator and prevents the hanging behavior you see on win95/98. as a temporary workaround, if you are able to provide your own Seed, invoke the SecureRandom constructor that takes a seed as a parameter (as i did in my example above). this bypasses the SeedGenerator's self-seeding process, and you'll avoid the hanging behavior. note that above i provided an empty 1 byte seed. you'll want to provide a source of random bytes.
11-06-2004

WORK AROUND Name: cc11364 Date: 06/24/99 ======================================================================
11-06-2004