[Webfunds-commits] java/webfunds/sox SimpleIssuer.java

Ian Grigg iang@cypherpunks.ai
Sun, 24 Sep 2000 19:58:10 -0400 (AST)


iang        00/09/24 19:58:10

  Modified:    .        .cvsignore
               webfunds/client AccountBrowserImpl.java
               webfunds/sox SimpleIssuer.java
  Log:
  tiny clashes cleaned up

Revision  Changes    Path
1.4       +1 -0      java/.cvsignore

Index: .cvsignore
===================================================================
RCS file: /home/webfunds/cvsroot/java/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- .cvsignore	2000/06/18 21:57:16	1.3
+++ .cvsignore	2000/09/24 23:58:08	1.4
@@ -1,3 +1,4 @@
 stderr
 stdout
 user*
+wallets



1.77      +10 -7     java/webfunds/client/AccountBrowserImpl.java

Index: AccountBrowserImpl.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/AccountBrowserImpl.java,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- AccountBrowserImpl.java	2000/09/24 23:19:09	1.76
+++ AccountBrowserImpl.java	2000/09/24 23:58:08	1.77
@@ -1,5 +1,5 @@
 /*
- * $Id: AccountBrowserImpl.java,v 1.76 2000/09/24 23:19:09 iang Exp $
+ * $Id: AccountBrowserImpl.java,v 1.77 2000/09/24 23:58:08 iang Exp $
  *
  * Copyright (c) Systemics Inc 1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -71,7 +71,7 @@
 
     public AccountBrowserImpl(PrintWriter bug)
     {
-        debug(bug, "  AB: ");
+        debug(new PrintWriter(bug, true), "  AB: ");
         init = true;
         wallets = new WalletInterface[0];    // for consistency
         plugins = new PluginInfo[0];
@@ -94,7 +94,11 @@
         logmsg("AccountBrowserImpl ready!");
     }
 
-    public void   setCore(Core core) { if (c == null) c = core; }
+    public void   setCore(Core core) {
+System.err.println("See Spot!");
+if (c == null) c = core;
+System.err.println("See Spot Run: ");
+}
     public String getType()          { return "AccountBrowser"; }
 
     public void wink() 
@@ -1354,11 +1358,10 @@
 
     public String toString()
     {
-        String s = "";
+        String s = "AccountBrowserImpl: ";
 
-        s += "AccountBrowserImpl: ";
-        s += "\n\tWallets = " + wallets.length;
-        s += "\n\tPlugins = " + plugins.length;
+        s += "\n\tWallets = " + ((wallets==null)?"null" : (""+wallets.length));
+        s += "\n\tPlugins = " + ((plugins==null)?"null" : (""+plugins.length));
 
         return s;
     }



1.19      +25 -3     java/webfunds/sox/SimpleIssuer.java

Index: SimpleIssuer.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SimpleIssuer.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- SimpleIssuer.java	2000/09/24 23:49:18	1.18
+++ SimpleIssuer.java	2000/09/24 23:58:09	1.19
@@ -1,5 +1,5 @@
 /*
- * $Id: SimpleIssuer.java,v 1.18 2000/09/24 23:49:18 iang Exp $
+ * $Id: SimpleIssuer.java,v 1.19 2000/09/24 23:58:09 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -178,6 +178,22 @@
         {
             fetchServerCert();
 
+            PublicKey signerKey = Crypto.getPublicKeyFromCert(signer);
+            logmsg("Verifying ServerCert is signed by Server CA certificate");
+            if (!Crypto.verifyCertificate(serverCert, signerKey)) {
+
+byte[] b = signerKey.getEncoded();
+PGPArmoury ok = new PGPArmoury(b, PGPArmoury.TYPE_PUBLIC_KEY);
+b = Crypto.getPublicKeyFromCert(serverCert).getEncoded();
+PGPArmoury sk = new PGPArmoury(b, PGPArmoury.TYPE_PUBLIC_KEY);
+logmsg(
+                    "serverCert (first) not signed by operator Cert (2nd)\n\n"+
+                    sk + "\n\n\n" + ok + "\n\n");
+
+                throw new SOXIssuerException(SOXException.SERVER_CERT,
+                    "serverCert not signed by operator Cert");
+            }
+
             PublicKey serverKey = Crypto.getPublicKeyFromCert(serverCert);
             logmsg("Verifying CommsCert is signed by serverCert");
             if (!Crypto.verifyCertificate(commsCert, serverKey))
@@ -286,7 +302,7 @@
     {
         fetchCommsKey();
 
-logmsg("tafter == " + System.currentTimeMillis() );
+logmsg("after comms key == " + System.currentTimeMillis() );
 
         try
         {
@@ -460,9 +476,15 @@
     {
         long timeNow = System.currentTimeMillis();
         if (timeNow - lastsync > 24 * HOUR)
+        {
+            logmsg("trying timesync, last has expired...");
             timesync();
-        else if (deviation > 10 * SECOND)
+        }
+        else if (deviation > (10*SECOND))
+        {
+            logmsg("trying timesync, last was not quick...");
             timesync();
+        }
     }