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:
parent
2b1ff2347c
commit
1b8e662769
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user