Update of /cvsroot/mahogany/M/src/modules/viewflt
In directory sc8-pr-cvs1:/tmp/cvs-serv23985/src/modules/viewflt

Modified Files:
        PGP.cpp 
Log Message:
Don't try to verify/decrypt a PGP PUBLIC KEY BLOCK

Index: PGP.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/viewflt/PGP.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -b -u -2 -r1.15 -r1.16
--- PGP.cpp     17 Jun 2003 08:22:20 -0000      1.15
+++ PGP.cpp     9 Jul 2003 13:15:28 -0000       1.16
@@ -169,4 +169,5 @@
       // is the message just signed or encrypted?
       const char *tail = start + strlen(PGP_BEGIN_PREFIX);
+      bool isKey = false;
       bool isSigned = strncmp(tail, "SIGNED ", 7 /* strlen("SIGNED ") */) == 0;
       if ( isSigned )
@@ -174,9 +175,17 @@
          tail += 7;
       }
+      else
+      {
+         isKey = strncmp(tail, "PUBLIC KEY ", 11 /* strlen("PUBLIC KEY ") */) == 0;
+      }
 
       // this flag tells us if everything is ok so far -- as soon as it becomes
       // false, we skip all subsequent steps
-      bool ok = true;
-      if ( strncmp(tail, PGP_BEGIN_SUFFIX, strlen(PGP_BEGIN_SUFFIX)) != 0 )
+      // We do not know (yet) what to do with public key blocks, so let's consider
+      // that they're not ok.
+      // TODO: propose to import it into the keyring?
+      bool ok = !isKey;
+
+      if ( ok && strncmp(tail, PGP_BEGIN_SUFFIX, strlen(PGP_BEGIN_SUFFIX)) != 0 )
       {
          wxLogWarning(_("The BEGIN line doesn't end with expected suffix."));
@@ -329,7 +338,10 @@
       }
 
-      // give a warning and display the message normally
+      // give a warning (unless this is a KEY blok and display the message normally
+      if ( !isKey )
+      {
       wxLogWarning(_("This message seems to be PGP signed or encrypted "
                      "but in fact is not."));
+      }
    }
 



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to