more tests
This commit is contained in:
parent
697eab19cd
commit
cc831cde4a
|
@ -527,7 +527,7 @@ describe("Signature", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Sign text with openpgp.sign and verify with openpgp.verify leads to same string cleartext and valid signatures - armored', function(done) {
|
it('Sign text with openpgp.sign and verify with openpgp.verify leads to same string cleartext and valid signatures', function(done) {
|
||||||
var plaintext = 'short message\nnext line\n한국어/조선말';
|
var plaintext = 'short message\nnext line\n한국어/조선말';
|
||||||
var pubKey = openpgp.key.readArmored(pub_key_arm2).keys[0];
|
var pubKey = openpgp.key.readArmored(pub_key_arm2).keys[0];
|
||||||
var privKey = openpgp.key.readArmored(priv_key_arm2).keys[0];
|
var privKey = openpgp.key.readArmored(priv_key_arm2).keys[0];
|
||||||
|
@ -549,6 +549,28 @@ describe("Signature", function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Sign text with openpgp.sign and verify with openpgp.verify leads to same bytes cleartext and valid signatures - armored', function(done) {
|
||||||
|
var plaintext = openpgp.util.str2Uint8Array('short message\nnext line\n한국어/조선말');
|
||||||
|
var pubKey = openpgp.key.readArmored(pub_key_arm2).keys[0];
|
||||||
|
var privKey = openpgp.key.readArmored(priv_key_arm2).keys[0];
|
||||||
|
privKey.getSigningKeyPacket().decrypt('hello world');
|
||||||
|
|
||||||
|
openpgp.sign({ privateKeys:[privKey], data:plaintext }).then(function(signed) {
|
||||||
|
|
||||||
|
var csMsg = openpgp.cleartext.readArmored(signed.data, true);
|
||||||
|
return openpgp.verify({ publicKeys:[pubKey], message:csMsg });
|
||||||
|
|
||||||
|
}).then(function(cleartextSig) {
|
||||||
|
expect(cleartextSig).to.exist;
|
||||||
|
expect(cleartextSig.data).to.deep.equal(plaintext);
|
||||||
|
expect(cleartextSig.signatures).to.have.length(1);
|
||||||
|
expect(cleartextSig.signatures[0].valid).to.be.true;
|
||||||
|
expect(cleartextSig.signatures[0].signature.packets.length).to.equal(1);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
it('Sign text with openpgp.sign and verify with openpgp.verify leads to same bytes cleartext and valid signatures - not armored', function(done) {
|
it('Sign text with openpgp.sign and verify with openpgp.verify leads to same bytes cleartext and valid signatures - not armored', function(done) {
|
||||||
var plaintext = openpgp.util.str2Uint8Array('short message\nnext line\n한국어/조선말');
|
var plaintext = openpgp.util.str2Uint8Array('short message\nnext line\n한국어/조선말');
|
||||||
var pubKey = openpgp.key.readArmored(pub_key_arm2).keys[0];
|
var pubKey = openpgp.key.readArmored(pub_key_arm2).keys[0];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user