1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-22 17:02:17 -05:00

Use same signatures structure openpgp.js for clearSignedSignatures as detached

This commit is contained in:
Tankred Hase 2014-07-07 11:58:41 +02:00
parent 2b1ff2347c
commit 1b8e662769
2 changed files with 16 additions and 9 deletions

View File

@ -92,18 +92,25 @@ CleartextMessage.prototype.verify = function(keys) {
var literalDataPacket = new packet.Literal();
// we assume that cleartext signature is generated based on UTF8 cleartext
literalDataPacket.setText(this.text);
keys.forEach(function(key) {
for (var i = 0; i < signatureList.length; i++) {
var keyPacket = key.getKeyPacket([signatureList[i].issuerKeyId]);
var keyPacket = null;
for (var j = 0; j < keys.length; j++) {
keyPacket = keys[j].getKeyPacket([signatureList[i].issuerKeyId]);
if (keyPacket) {
var verifiedSig = {};
verifiedSig.keyid = signatureList[i].issuerKeyId;
verifiedSig.valid = signatureList[i].verify(keyPacket, literalDataPacket);
result.push(verifiedSig);
break;
}
}
});
var verifiedSig = {};
if (keyPacket) {
verifiedSig.keyid = signatureList[i].issuerKeyId;
verifiedSig.valid = signatureList[i].verify(keyPacket, literalDataPacket);
} else {
verifiedSig.keyid = signatureList[i].issuerKeyId;
verifiedSig.valid = null;
}
result.push(verifiedSig);
}
return result;
};

View File

@ -377,7 +377,7 @@ define(function(require) {
done();
});
});
it.skip('should be null for wrong public key', function(done) {
it('should be null for wrong public key', function(done) {
pgp.verifyClearSignedMessage(clearsigned, wrongPubkey, function(err, signaturesValid) {
expect(err).to.not.exist;
expect(signaturesValid).to.be.null;