add null string test
This commit is contained in:
parent
18c08c2f0b
commit
3d2c0d784e
|
@ -917,6 +917,27 @@ describe('OpenPGP.js public api tests', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it('should fail to verify decrypted null string with wrong public pgp key', function() {
|
||||
var encOpt = {
|
||||
data: '',
|
||||
publicKeys: publicKey.keys,
|
||||
privateKeys: privateKey.keys
|
||||
};
|
||||
var decOpt = {
|
||||
privateKey: privateKey.keys[0],
|
||||
publicKeys: openpgp.key.readArmored(wrong_pubkey).keys
|
||||
};
|
||||
return openpgp.encrypt(encOpt).then(function(encrypted) {
|
||||
decOpt.message = openpgp.message.readArmored(encrypted.data);
|
||||
return openpgp.decrypt(decOpt);
|
||||
}).then(function(decrypted) {
|
||||
expect(decrypted.data).to.equal('');
|
||||
expect(decrypted.signatures[0].valid).to.be.null;
|
||||
expect(decrypted.signatures[0].keyid.toHex()).to.equal(privateKey.keys[0].getSigningKeyPacket().getKeyId().toHex());
|
||||
expect(decrypted.signatures[0].signature.packets.length).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
it('should successfully decrypt signed message without public keys to verify', function() {
|
||||
var encOpt = {
|
||||
data: plaintext,
|
||||
|
|
Loading…
Reference in New Issue
Block a user