[Webfunds-commits] java/webfunds/openpgp/cert SimpleOpenPGPCertificate.java

Jeroen C. van Gelderen gelderen@cypherpunks.ai
Wed, 16 Aug 2000 17:19:20 -0400 (AST)


gelderen    00/08/16 17:19:19

  Modified:    webfunds/openpgp/cert SimpleOpenPGPCertificate.java
  Log:
  The test in verify(...) was inverted: failed when the sig was good and accept
  when the sig was dud. Invert the check.

Revision  Changes    Path
1.3       +5 -2      java/webfunds/openpgp/cert/SimpleOpenPGPCertificate.java

Index: SimpleOpenPGPCertificate.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/openpgp/cert/SimpleOpenPGPCertificate.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SimpleOpenPGPCertificate.java	2000/08/16 17:13:51	1.2
+++ SimpleOpenPGPCertificate.java	2000/08/16 21:19:19	1.3
@@ -1,4 +1,4 @@
-/* $Id: SimpleOpenPGPCertificate.java,v 1.2 2000/08/16 17:13:51 gelderen Exp $
+/* $Id: SimpleOpenPGPCertificate.java,v 1.3 2000/08/16 21:19:19 gelderen Exp $
  *
  * Copyright (c) Systemics Ltd 2000 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -132,11 +132,14 @@
         boolean anySigned = false; // at least one is signed with the key
 
         Vector userids = ((PGPPublicKey)key).getUserIDs();
+        System.out.println("SOPC: userids.size(): " + userids.size());
         
         for (int i=0; i<userids.size(); i++) {
             PGPUserID userid = (PGPUserID)userids.elementAt(i);
+            System.out.print("  userid: " + userid);
             try {
                 boolean isSigned = userid.isSignedBy((PGPPublicKey)key);
+                System.out.println(", isSigned: " + isSigned);
                 allSigned &= isSigned;
                 anySigned |= isSigned;
             } catch (PGPFatalDataFormatException fdfe) {
@@ -144,7 +147,7 @@
             }
         }
         
-        if (anySigned & allSigned) {
+        if ( !(anySigned && allSigned) ) {
             throw new SignatureException("Not all userIDs are signed with "+
                                          "the given key.");
         }