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

Ian Grigg iang@cypherpunks.ai
Fri, 5 Jan 2001 19:45:40 -0400 (AST)


iang        01/01/05 19:45:40

  Modified:    webfunds/sox Crypto.java
  Log:
  both toCryptixKey() can return null, tested both now

Revision  Changes    Path
1.53      +8 -12     java/webfunds/sox/Crypto.java

Index: Crypto.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Crypto.java,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- Crypto.java	2001/01/05 18:44:33	1.52
+++ Crypto.java	2001/01/05 23:45:39	1.53
@@ -1,4 +1,4 @@
-/* $Id: Crypto.java,v 1.52 2001/01/05 18:44:33 iang Exp $
+/* $Id: Crypto.java,v 1.53 2001/01/05 23:45:39 iang Exp $
  *
  * Copyright (c) Systemics Inc. 1995-2000 on behalf of
  * The WebFunds Development Team.  All Rights Reserved.
@@ -60,7 +60,7 @@
  *
  * Centralized crypto methods. Currently being overhauled.
  *
- * @version $Revision: 1.52 $
+ * @version $Revision: 1.53 $
  */
 public final class Crypto
 {
@@ -1104,20 +1104,18 @@
         RSAPublicKeyImpl ll = (RSAPublicKeyImpl) toCryptixKey(left);
         RSAPublicKeyImpl rr = (RSAPublicKeyImpl) toCryptixKey(right);
 
-        if (ll == null)               // toCryptixKey() can return null
+        if (ll == null && rr == null)      // toCryptixKey() can return null
+            return true ;
+        if (ll == null || rr == null)
             return false ;
 
         BigInteger left_n = ll.getModulus();
-//System.err.println("\n" + left_n);
         BigInteger right_n = rr.getModulus();
-//System.err.println("\n" + right_n);
         if (!left_n.equals(right_n))
             return false;
 
         BigInteger left_e = ll.getPublicExponent();
-//System.err.println("\n" + left_e);
         BigInteger right_e = rr.getPublicExponent();
-//System.err.println("\n" + right_e);
         if (!left_e.equals(right_e))
             return false;
 
@@ -1134,20 +1132,18 @@
         RSAPrivateKeyCryptix ll = (RSAPrivateKeyCryptix) toCryptixKey(left);
         RSAPrivateKeyCryptix rr = (RSAPrivateKeyCryptix) toCryptixKey(right);
 
-        if (ll == null)               // toCryptixKey() can return null
+        if (ll == null && rr == null)      // toCryptixKey() can return null
+            return true ;
+        if (ll == null || rr == null)
             return false ;
 
         BigInteger left_n = ll.getModulus();
-//System.err.println("\n" + left_n);
         BigInteger right_n = rr.getModulus();
-//System.err.println("\n" + right_n);
         if (!left_n.equals(right_n))
             return false;
 
         BigInteger left_d = ll.getPrivateExponent();
-//System.err.println("\n" + left_d);
         BigInteger right_d = rr.getPrivateExponent();
-//System.err.println("\n" + right_d);
         if (!left_d.equals(right_d))
             return false;