Add more OCB tests

This commit is contained in:
Daniel Huigens
2018-04-10 17:55:12 +02:00
parent 28dbbadcff
commit e44fbbccab
2 changed files with 41 additions and 0 deletions

View File

@@ -598,6 +598,7 @@ describe('OpenPGP.js public api tests', function() {
let use_nativeVal;
let aead_protectVal;
let aead_protect_versionVal;
let aead_modeVal;
beforeEach(function(done) {
publicKey = openpgp.key.readArmored(pub_key);
@@ -622,6 +623,7 @@ describe('OpenPGP.js public api tests', function() {
use_nativeVal = openpgp.config.use_native;
aead_protectVal = openpgp.config.aead_protect;
aead_protect_versionVal = openpgp.config.aead_protect_version;
aead_modeVal = openpgp.config.aead_mode;
done();
});
@@ -630,6 +632,7 @@ describe('OpenPGP.js public api tests', function() {
openpgp.config.use_native = use_nativeVal;
openpgp.config.aead_protect = aead_protectVal;
openpgp.config.aead_protect_version = aead_protect_versionVal;
openpgp.config.aead_mode = aead_modeVal;
});
it('Decrypting key with wrong passphrase rejected', async function () {
@@ -688,6 +691,15 @@ describe('OpenPGP.js public api tests', function() {
}
});
tryTests('OCB mode', tests, {
if: true,
beforeEach: function() {
openpgp.config.aead_protect = true;
openpgp.config.aead_protect_version = 4;
openpgp.config.aead_mode = openpgp.enums.aead.ocb;
}
});
function tests() {
it('Configuration', function() {
openpgp.config.show_version = false;