mirror of
https://github.com/moparisthebest/mail
synced 2024-11-26 10:52: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();
|
var literalDataPacket = new packet.Literal();
|
||||||
// we assume that cleartext signature is generated based on UTF8 cleartext
|
// we assume that cleartext signature is generated based on UTF8 cleartext
|
||||||
literalDataPacket.setText(this.text);
|
literalDataPacket.setText(this.text);
|
||||||
keys.forEach(function(key) {
|
for (var i = 0; i < signatureList.length; i++) {
|
||||||
for (var i = 0; i < signatureList.length; i++) {
|
var keyPacket = null;
|
||||||
var keyPacket = key.getKeyPacket([signatureList[i].issuerKeyId]);
|
for (var j = 0; j < keys.length; j++) {
|
||||||
|
keyPacket = keys[j].getKeyPacket([signatureList[i].issuerKeyId]);
|
||||||
if (keyPacket) {
|
if (keyPacket) {
|
||||||
var verifiedSig = {};
|
|
||||||
verifiedSig.keyid = signatureList[i].issuerKeyId;
|
|
||||||
verifiedSig.valid = signatureList[i].verify(keyPacket, literalDataPacket);
|
|
||||||
result.push(verifiedSig);
|
|
||||||
break;
|
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;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ define(function(require) {
|
|||||||
done();
|
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) {
|
pgp.verifyClearSignedMessage(clearsigned, wrongPubkey, function(err, signaturesValid) {
|
||||||
expect(err).to.not.exist;
|
expect(err).to.not.exist;
|
||||||
expect(signaturesValid).to.be.null;
|
expect(signaturesValid).to.be.null;
|
||||||
|
Loading…
Reference in New Issue
Block a user