[Webfunds-commits] java/webfunds/client Core.java
Jeroen C. van Gelderen
gelderen@cypherpunks.ai
Wed, 31 May 2000 21:07:16 -0400 (AST)
gelderen 00/05/31 21:07:16
Modified: webfunds/client Core.java
Log:
Don't use DevRandom, use webfunds.utils.SecureRandomHack instead.
Revision Changes Path
1.54 +12 -26 java/webfunds/client/Core.java
Index: Core.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/Core.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- Core.java 2000/05/27 00:52:11 1.53
+++ Core.java 2000/06/01 01:07:16 1.54
@@ -1,18 +1,19 @@
-/*
- * $Id: Core.java,v 1.53 2000/05/27 00:52:11 gelderen Exp $
+/* $Id: Core.java,v 1.54 2000/06/01 01:07:16 gelderen Exp $
*
- * Copyright (c) Systemics Ltd 1995-1999 on behalf of
- * the WebFunds Development Team. All Rights Reserved.
+ * Copyright (c) Systemics Inc. 1995-2000 on behalf of
+ * The WebFunds Development Team. All rights reserved.
*/
package webfunds.client;
+
import java.io.*;
import java.beans.*;
import java.security.SecureRandom;
import java.util.*;
-import webfunds.utils.NetWatcher;
import webfunds.utils.Debug;
+import webfunds.utils.NetWatcher;
+import webfunds.utils.SecureRandomHack;
import webfunds.utils.VersionNumbers;
import webfunds.ricardian.ContractStore;
@@ -23,6 +24,7 @@
import webfunds.client.plugins.*;
import webfunds.store.*;
+
public final class Core
extends Debug
{
@@ -55,7 +57,11 @@
public Core()
{
- this.random = obtainSecureRandom();
+ /*
+ * Obtains SecureRandom bypassing Sun's slow seeding process if
+ * possible. (I.e. on UN*X.)
+ */
+ this.random = SecureRandomHack.getInstance();
// read and set Properties
Properties props = System.getProperties();
@@ -242,25 +248,6 @@
}
- /**
- * Obtain a SecureRandom instance as quickly as possible.
- * On UN*X we get our seed from /dev/random, on other platforms we
- * have to go the slow, Java way :-(
- */
- private SecureRandom obtainSecureRandom()
- {
- System.err.println("Initializing SecureRandom...");
-
- byte[] seedBytes = DevRandom.getSeed(20);
- if( seedBytes == null )
- {
- // hmm, no /dev/random here :-(
- seedBytes = SecureRandom.getSeed(20);
- }
- return new SecureRandom(seedBytes);
- }
-
-
// static String sep = System.getProperty("path.separator");
//
// protected void add3rdPartyPlugin(String dir, String name)
@@ -446,7 +433,6 @@
public static void main(String[] arg)
{
-
if (arg.length > 0)
{
if ("-help".equals(arg[0]) || "-?".equals(arg[0]))