diff --git a/src/encoding/armor.js b/src/encoding/armor.js index 70eb8545..14909608 100644 --- a/src/encoding/armor.js +++ b/src/encoding/armor.js @@ -246,10 +246,7 @@ function splitChecksum(text) { if (lastEquals >= 0) { body = text.slice(0, lastEquals); - checksum = text.slice(lastEquals + 1); - if (checksum.substr(0, 6) === '\n-----') { - checksum = ''; // missing armor checksum - } + checksum = text.slice(lastEquals + 1).trim().substr(0, 4); } return { body: body, checksum: checksum }; @@ -271,6 +268,7 @@ function dearmor(text) { var type = getType(text); + text = text.trim() + "\n"; var splittext = text.split(reSplit); // IE has a bug in split with a re. If the pattern matches the beginning of the @@ -312,8 +310,6 @@ function dearmor(text) { checksum = sig_sum.checksum; } - checksum = checksum.substr(0, 4); - if (!verifyCheckSum(result.data, checksum) && (checksum || config.checksum_required)) { // will NOT throw error if checksum is empty AND checksum is not required (GPG compatibility) throw new Error("Ascii armor integrity check on message failed: '" + checksum + "' should be '" +