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

Jeroen C. van Gelderen gelderen@cypherpunks.ai
Sat, 29 Jul 2000 20:03:48 -0400 (AST)


gelderen    00/07/29 20:03:47

  Modified:    webfunds/sox SimpleIssuer.java
  Log:
  Clean up a bit.

Revision  Changes    Path
1.12      +4 -114    java/webfunds/sox/SimpleIssuer.java

Index: SimpleIssuer.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/SimpleIssuer.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SimpleIssuer.java	2000/07/21 21:31:18	1.11
+++ SimpleIssuer.java	2000/07/30 00:03:47	1.12
@@ -1,5 +1,5 @@
 /*
- * $Id: SimpleIssuer.java,v 1.11 2000/07/21 21:31:18 gelderen Exp $
+ * $Id: SimpleIssuer.java,v 1.12 2000/07/30 00:03:47 gelderen Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -106,77 +106,6 @@
         checkSync();
     }
 
-//    /**
-//     * NOT USED?
-//     * Create a new Issuer object
-//     * This is not a constructor, since we may wish to share
-//     * instances of this object (e.g. we have two accounts
-//     * with the same issuer, and wish to share the communication
-//     * channel to the issuer by sharing this Issuer object).
-//     * This is done by caching the objects.
-//     * However, this feature is not currently implemented,
-//     * due to the lack of weak references and other stuff needed
-//     * to implement caches in Java.
-//     *
-//     * @param name our name for the issuer
-//     * @param signer the certificate which signs this issuers certificate
-//     * @param agent the comms agent that sends requests at the transport layer
-//     * @param store the store containing issuers
-//     * @return An Issuer object, possibly existing one in use by another object
-//     * @excep InvalidKeyException Problems encrypting requests
-//     */
-//    public static Issuer getInstance(String name,
-//                         Certificate signer, CommsAgent agent, ClientStore store)
-//        throws IOException, SOXPacketException,
-//               InvalidKeyException, KeyException
-//        , SOXKeyException
-//    {
-//        System.err.println("Looking for the issuer of the item in the store");
-//
-//        Issuer[] issuers = store.getIssuers();
-//        Issuer issuer = null;
-//        for(int i = 0; i < issuers.length; i++)
-//        {
-//            if (issuers[i].commsAgent.equals(agent))
-//            {
-//                System.err.println("Found the issuer of the item");
-//                issuer = issuers[i];
-//                break;
-//            }
-//        }
-//
-//        if (issuer == null)
-//        {
-//            issuer = new Issuer(name, signer, agent);
-//
-//            System.err.println("Issuer not found in cache - downloading new");
-//
-//            issuer.fetchCertificate();
-//
-//            // Save to store - note that we don't bother saving the comms key
-//            System.err.println("Caching to the store: " + issuer);
-//            store.addIssuer(issuer);
-//        }
-//        else
-//        {
-//            if (!issuer.name.equals(name))
-//                System.err.println("Notice: requested name for issuer is '"
-//                       +name+"', but cache name is '"+issuer.getName()+"'");
-//        }
-//
-//        //
-//        // Look for a comms key
-//        // If not present, fetch it
-//        //
-//        if (issuer.commsCert == null)
-//            issuer.fetchCommsKey();
-//
-//        //
-//        // At this point we are all set to start
-//        // communicating with the server
-//        //
-//        return issuer;
-//    }
 
     /**
      * The name of this issuer
@@ -187,59 +116,20 @@
         return name;
     }
 
-/////////////////////////////////////////
-//
-//    Currently only one layer of authentication,
-//    Comms key must be signed by issuer cert.
-//    Later on, want to add more layers.
-//
-//    /**
-//     * Update the primary certificate for this issuer
-//     * The certificate signatures are verified before assigning.
-//     *
-//     * None of the PKI is done properly yet.
-//     */
-//    private void fetchCertificate()
-//        throws SOXKeyException
-//    {
-//        logmsg("Fetching the primary certificate");
-//
-//        X509Cert cert;
-//        try {
-//            cert = basicAgent.getCertificate();
-//        } catch (Exception ex) { // none of these mean anything except duff key
-//            ex.printStackTrace(err());
-//            throw new SOXKeyException("primary cert: " + ex.getMessage());
-//        }
-//
-//        /*
-//        //
-//        // Verify that the legal issuer has signed this certificate
-//        //
-//        PublicKey key = Crypto.getPublicKeyFromCert(signer);
-//        logmsg("Verifying the signature on the server certificate");
-//        if (Crypto.verifyCertificate(cert, key) == false)
-//            logmsg("Invalid certificate - unsigned!");
-//        else
-//            logmsg("Certificate has a valid signature");
-//        */
-//
-//        // Careful not to set this before validating the signature
-//        this.issuerCert = cert;
-//    }
 
     /**
      * Fetch the current communications certificate for this issuer.
      * The certificate signatures are verified before assigning.
      *
      * None of the PKI is done properly yet.
+     *
+     * This won't do anything if commsKey is already set.
      */
     protected void fetchCommsKey()
         throws SOXIssuerException, SOXLaterException
     {
-
         if (commsKey != null)
-            return ;
+            return;
 
         logmsg("Fetching the SOX Server comms certificate");