Hi List,

this patch enables Enigmail to display the algorithms used
to sign an email in the security info popup (issue #344).

Regards
Kai

---
 package/gpg.jsm                         | 43 +++++++++++++++++++++++++++++++++
 ui/content/enigmailMsgHdrViewOverlay.js | 10 +++++++-
 ui/locale/en-US/enigmail.properties     |  5 ++++
 3 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/package/gpg.jsm b/package/gpg.jsm
index 509af6a..bf20dc4 100644
--- a/package/gpg.jsm
+++ b/package/gpg.jsm
@@ -264,5 +264,48 @@ const EnigmailGpg = {
       EnigmailLog.ERROR("enigmailCommon.jsm: recalcTrustDb: subprocess.call 
failed with '" + ex.toString() + "'\n");
       throw ex;
     }
+  },
+
+  signingAlgIdToString: function(id) {
+    // RFC 4880 Sec. 9.1 and RFC 6637 Sec. 5
+    switch (parseInt(id)) {
+      case 1:
+      case 2:
+      case 3:
+        return "RSA";
+      case 16:
+        return "Elgamal";
+      case 17:
+        return "DSA";
+      case 18:
+        return "ECDH";
+      case 19:
+        return "ECDSA";
+      default:
+        return EnigmailLocale.getString("unknownSigningAlg",[parseInt(id)]);
+    }
+  },
+
+  hashAlgIdToString: function(id) {
+    // RFC 4880 Sec. 9.4
+    switch (parseInt(id)) {
+      case 1:
+        return "MD5";
+      case 2:
+        return "SHA-1";
+      case 3:
+        return "RIPE-MD/160";
+      case 8:
+        return "SHA256";
+      case 9:
+        return "SHA384";
+      case 10:
+        return "SHA512";
+      case 11:
+        return "SHA224";
+      default:
+        return EnigmailLocale.getString("unknownHashAlg",[parseInt(id)]);
+    }
   }
 };
+
diff --git a/ui/content/enigmailMsgHdrViewOverlay.js 
b/ui/content/enigmailMsgHdrViewOverlay.js
index 04345dd..4eb0644 100644
--- a/ui/content/enigmailMsgHdrViewOverlay.js
+++ b/ui/content/enigmailMsgHdrViewOverlay.js
@@ -43,6 +43,7 @@ Components.utils.import("resource://enigmail/locale.jsm");
 Components.utils.import("resource://enigmail/windows.jsm");
 Components.utils.import("resource://enigmail/dialog.jsm");
 Components.utils.import("resource://enigmail/time.jsm");
+Components.utils.import("resource://enigmail/gpg.jsm");
 Components.utils.import("resource://enigmail/key.jsm"); /*global EnigmailKey: 
false */
 Components.utils.import("resource://enigmail/keyRing.jsm"); /*global 
EnigmailKeyRing: false */
 Components.utils.import("resource://enigmail/uris.jsm"); /*global 
EnigmailURIs: false */
@@ -258,6 +259,12 @@ Enigmail.hdrView = {
         if (fpr) {
           statusInfo += "\n" + EnigmailLocale.getString("keyFpr", [fpr]);
         }
+        if (detailArr.length > 7) {
+          var signingAlg = EnigmailGpg.signingAlgIdToString(detailArr[6]);
+          var hashAlg = EnigmailGpg.hashAlgIdToString(detailArr[7]);
+
+          statusInfo += "\n\n" + 
EnigmailLocale.getString("usedAlgorithms",[signingAlg,hashAlg]);
+        }
       }
       fullStatusInfo = statusInfo;
 
@@ -1125,4 +1132,5 @@ if (messageHeaderSink) {
       this.securityInfo = new EnigMimeHeaderSink(innerSMIMEHeaderSink);
     }
   };
-}
\ No newline at end of file
+}
+
diff --git a/ui/locale/en-US/enigmail.properties 
b/ui/locale/en-US/enigmail.properties
index 8cbab6b..b30b04b 100644
--- a/ui/locale/en-US/enigmail.properties
+++ b/ui/locale/en-US/enigmail.properties
@@ -270,6 +270,7 @@ viewInfo=; View > Message security info for details
 decryptedMsg=Decrypted message
 decryptedMsgWithFormatError=Decrypted message (restored broken PGP email 
format probably caused by an old Exchange server, so that the result might not 
be perfect to read)
 
+usedAlgorithms=Used Algorithms: %S and %S
 
 # strings in pref-enigmail.js
 testNoSvc=EnigTest: Failed to access Enigmail service
@@ -607,3 +608,7 @@ converter.decryptBody.failed=Could not decrypt message with 
subject\n"%S".\nDo y
 converter.decryptAtt.failed=Could not decrypt attachment "%1$S"\nof message 
with subject\n"%2$S".\nDo you want to retry with a different passphrase or do 
you want to skip the message?
 
 saveLogFile.title=Save Log File
+
+# strings in gpg.jsm
+unknownSigningAlg=Unknown signing algorithm (ID: %S)
+unknownHashAlg=Unknown cryptographic hash (ID: %S)
-- 
2.3.6


_______________________________________________
enigmail-users mailing list
[email protected]
To unsubscribe or make changes to your subscription click here:
https://admin.hostpoint.ch/mailman/listinfo/enigmail-users_enigmail.net

Reply via email to