diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 86b9b093..79ae0d5d 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,7 @@
+0.3.3pre [2013-05-30]
+---------------------
+ - added debug info to rsasign-1.2.js
+
0.3.2 [2013-05-30]
------------------
- fixed regex pattern for SDID, Selector and local_part
diff --git a/chrome/content/dkim.js b/chrome/content/dkim.js
index 91c86bf2..7b8d575d 100644
--- a/chrome/content/dkim.js
+++ b/chrome/content/dkim.js
@@ -4,7 +4,7 @@
* Verifies the DKIM-Signatures as specified in RFC 6376
* http://tools.ietf.org/html/rfc6376
*
- * version: 0.3.2 (30 May 2013)
+ * version: 0.3.3pre (30 May 2013)
*
* Copyright (c) 2013 Philippe Lieser
*
@@ -912,7 +912,7 @@ DKIM_Verifier.DKIMVerifier = (function() {
var isValid = rsa.verifyString(headerHashInput, DKIM_Verifier.b64tohex(msg.DKIMSignature.b));
if (!isValid) {
- throw new DKIM_SigError(DKIM_STRINGS.DKIM_SIGERROR_CORRUPT_B);
+ throw new DKIM_SigError(DKIM_STRINGS.DKIM_SIGERROR_BADSIG);
}
// show result
@@ -1113,7 +1113,12 @@ var that = {
Components.utils.reportError(e+"\n"+e.stack);
}
}
- }
+ },
+
+ /*
+ * make function dkimDebugMsg(message) public
+ */
+ dkimDebugMsg : dkimDebugMsg
};
return that;
}()); // the parens here cause the anonymous function to execute and return
diff --git a/chrome/content/rsasign-1.2.js b/chrome/content/rsasign-1.2.js
index a2d12b97..b3744c61 100644
--- a/chrome/content/rsasign-1.2.js
+++ b/chrome/content/rsasign-1.2.js
@@ -1,3 +1,11 @@
+/*
+ * Original version 1.2.1 (08 May 2013)
+ * Modified by Philippe Lieser for "DKIM Verifier" version 0.3.3
+ *
+ * Modifications:
+ * - added debug info to _rsasign_verifyString
+ */
+
/*! rsasign-1.2.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license
*/
//
@@ -267,14 +275,26 @@ function _rsasign_verifyHexSignatureForMessage(hSig, sMsg) {
*/
function _rsasign_verifyString(sMsg, hSig) {
hSig = hSig.replace(_RE_HEXDECONLY, '');
- if (hSig.length != this.n.bitLength() / 4) return 0;
+ // if (hSig.length != this.n.bitLength() / 4) return 0;
+ if (hSig.length != this.n.bitLength() / 4) {
+ DKIMVerifier.dkimDebugMsg("rsasign: hSig has wrong length");
+ return 0;
+ // throw new Error("rsasign Error: hSig has wrong length");
+ }
hSig = hSig.replace(/[ \n]+/g, "");
var biSig = parseBigInt(hSig, 16);
var biDecryptedSig = this.doPublic(biSig);
var hDigestInfo = biDecryptedSig.toString(16).replace(/^1f+00/, '');
var digestInfoAry = _rsasign_getAlgNameAndHashFromHexDisgestInfo(hDigestInfo);
- if (digestInfoAry.length == 0) return false;
+ // if (digestInfoAry.length == 0) return false;
+ if (digestInfoAry.length == 0) {
+ DKIMVerifier.dkimDebugMsg("rsasign: biDecryptedSig (hex): " + biDecryptedSig.toString(16));
+ DKIMVerifier.dkimDebugMsg("rsasign: n (hex): " + this.n.toString(16));
+ DKIMVerifier.dkimDebugMsg("rsasign: e: " + this.e);
+ DKIMVerifier.dkimDebugMsg("rsasign: digestInfoAry.length == 0");
+ return false;
+ }
var algName = digestInfoAry[0];
var diHashValue = digestInfoAry[1];
var ff = _RSASIGN_HASHHEXFUNC[algName];
diff --git a/chrome/locale/en-US/dkim.js b/chrome/locale/en-US/dkim.js
index 0ce00245..06bccdb5 100644
--- a/chrome/locale/en-US/dkim.js
+++ b/chrome/locale/en-US/dkim.js
@@ -21,7 +21,8 @@ DKIM_STRINGS.DKIM_SIGERROR_MISSING_V = "DKIM version missing";
DKIM_STRINGS.DKIM_SIGERROR_MISSING_A = "Missing signature algorithm";
DKIM_STRINGS.DKIM_SIGERROR_UNKNOWN_A = "Unsupported Signature algorithm";
DKIM_STRINGS.DKIM_SIGERROR_MISSING_B = "Missing signature";
-DKIM_STRINGS.DKIM_SIGERROR_CORRUPT_B = "Signature wrong";
+// DKIM_STRINGS.DKIM_SIGERROR_CORRUPT_B = "Signature wrong";
+DKIM_STRINGS.DKIM_SIGERROR_BADSIG = "Signature wrong";
DKIM_STRINGS.DKIM_SIGERROR_MISSING_BH = "Missing body hash";
DKIM_STRINGS.DKIM_SIGERROR_CORRUPT_BH = "Wrong body hash";
DKIM_STRINGS.DKIM_SIGERROR_UNKNOWN_C_H = "Unsupported canonicalization algorithm for header";
diff --git a/install.rdf b/install.rdf
index 537559d5..f6535fce 100644
--- a/install.rdf
+++ b/install.rdf
@@ -10,7 +10,7 @@
DKIM Verifier
Verifies the DKIM-Signature of an e-mail.
- 0.3.2
+ 0.3.3pre
Philippe Lieser