diff --git a/Gruntfile.js b/Gruntfile.js index 9cd136bb..2e08483e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = function(grunt) { var lintFiles = [ diff --git a/src/cleartext.js b/src/cleartext.js index 94f49862..dd93f49f 100644 --- a/src/cleartext.js +++ b/src/cleartext.js @@ -24,8 +24,6 @@ * @module cleartext */ -'use strict'; - import config from './config'; import armor from './encoding/armor'; import enums from './enums'; diff --git a/src/config/config.js b/src/config/config.js index b2645463..1a9fccf8 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -21,8 +21,6 @@ * @module config/config */ -'use strict'; - import enums from '../enums.js'; export default { diff --git a/src/config/index.js b/src/config/index.js index 0de7718f..2beddebb 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -3,6 +3,4 @@ * @module config */ -'use strict'; - export { default } from './config.js'; \ No newline at end of file diff --git a/src/config/localStorage.js b/src/config/localStorage.js index 5718a036..000c2cec 100644 --- a/src/config/localStorage.js +++ b/src/config/localStorage.js @@ -3,8 +3,6 @@ * @module config/localStorage */ -'use strict'; - /** * @constructor */ diff --git a/src/crypto/cfb.js b/src/crypto/cfb.js index 1e2d8b00..d9ffbe55 100644 --- a/src/crypto/cfb.js +++ b/src/crypto/cfb.js @@ -22,8 +22,6 @@ * @module crypto/cfb */ -'use strict'; - import cipher from './cipher'; export default { diff --git a/src/crypto/cipher/aes.js b/src/crypto/cipher/aes.js index 8fc9c2e6..6197ace0 100644 --- a/src/crypto/cipher/aes.js +++ b/src/crypto/cipher/aes.js @@ -2,8 +2,6 @@ * @module crypto/cipher/aes */ -'use strict'; - import asmCrypto from 'asmcrypto-lite'; // TODO use webCrypto or nodeCrypto when possible. diff --git a/src/crypto/cipher/blowfish.js b/src/crypto/cipher/blowfish.js index 279e4497..f2404a16 100644 --- a/src/crypto/cipher/blowfish.js +++ b/src/crypto/cipher/blowfish.js @@ -7,8 +7,6 @@ * @module crypto/cipher/blowfish */ -'use strict'; - /* * Javascript implementation based on Bruce Schneier's reference implementation. * diff --git a/src/crypto/cipher/cast5.js b/src/crypto/cipher/cast5.js index 3a4a2d0c..19efcc93 100644 --- a/src/crypto/cipher/cast5.js +++ b/src/crypto/cipher/cast5.js @@ -16,8 +16,6 @@ /** @module crypto/cipher/cast5 */ -'use strict'; - function OpenpgpSymencCast5() { this.BlockSize = 8; this.KeySize = 16; diff --git a/src/crypto/cipher/des.js b/src/crypto/cipher/des.js index 321f3bce..300e71ed 100644 --- a/src/crypto/cipher/des.js +++ b/src/crypto/cipher/des.js @@ -25,8 +25,6 @@ * @module crypto/cipher/des */ -'use strict'; - function des(keys, message, encrypt, mode, iv, padding) { //declaring this locally speeds things up a bit var spfunction1 = new Array(0x1010400, 0, 0x10000, 0x1010404, 0x1010004, 0x10404, 0x4, 0x10000, 0x400, 0x1010400, diff --git a/src/crypto/cipher/index.js b/src/crypto/cipher/index.js index 3f1274a6..1cf71cff 100644 --- a/src/crypto/cipher/index.js +++ b/src/crypto/cipher/index.js @@ -6,8 +6,6 @@ * @module crypto/cipher */ -'use strict'; - import aes from './aes.js'; import desModule from './des.js'; import cast5 from './cast5.js'; diff --git a/src/crypto/crypto.js b/src/crypto/crypto.js index 9bccc5ec..a8c1348e 100644 --- a/src/crypto/crypto.js +++ b/src/crypto/crypto.js @@ -28,8 +28,6 @@ * @module crypto/crypto */ -'use strict'; - import random from './random.js'; import cipher from './cipher'; import publicKey from './public_key'; diff --git a/src/crypto/gcm.js b/src/crypto/gcm.js index 39786cc8..e577a90f 100644 --- a/src/crypto/gcm.js +++ b/src/crypto/gcm.js @@ -20,8 +20,6 @@ * the WebCrypto api as well as node.js' crypto api. */ -'use strict'; - import asmCrypto from 'asmcrypto-lite'; import util from '../util.js'; import config from '../config'; diff --git a/src/crypto/hash/index.js b/src/crypto/hash/index.js index 1b6173e1..ce1a5918 100644 --- a/src/crypto/hash/index.js +++ b/src/crypto/hash/index.js @@ -5,8 +5,6 @@ * @module crypto/hash */ -'use strict'; - import Rusha from 'rusha'; import RIPEMD160 from 'ripemd160'; import asmCrypto from 'asmcrypto-lite'; diff --git a/src/crypto/hash/md5.js b/src/crypto/hash/md5.js index 3fd6c4e9..eb5a799b 100644 --- a/src/crypto/hash/md5.js +++ b/src/crypto/hash/md5.js @@ -17,8 +17,6 @@ * @module crypto/hash/md5 */ -'use strict'; - import util from '../../util.js'; /** diff --git a/src/crypto/hash/sha.js b/src/crypto/hash/sha.js index eb39c368..864b7924 100644 --- a/src/crypto/hash/sha.js +++ b/src/crypto/hash/sha.js @@ -19,8 +19,6 @@ * 1 = SHA-1, 2 = SHA-224/SHA-256, 4 = SHA-384/SHA-512 */ -"use strict"; - var SUPPORTED_ALGS = 4 | 2 | 1; /** diff --git a/src/crypto/index.js b/src/crypto/index.js index c1530db2..4b2cbe1f 100644 --- a/src/crypto/index.js +++ b/src/crypto/index.js @@ -3,8 +3,6 @@ * @module crypto */ -'use strict'; - import cipher from './cipher'; import hash from './hash'; import cfb from './cfb'; diff --git a/src/crypto/pkcs1.js b/src/crypto/pkcs1.js index a15d62d9..4ba3e1d1 100644 --- a/src/crypto/pkcs1.js +++ b/src/crypto/pkcs1.js @@ -25,8 +25,6 @@ * @module crypto/pkcs1 */ -'use strict'; - import random from './random.js'; import util from '../util.js'; import BigInteger from './public_key/jsbn.js'; diff --git a/src/crypto/public_key/dsa.js b/src/crypto/public_key/dsa.js index d9c20eed..3d6ec237 100644 --- a/src/crypto/public_key/dsa.js +++ b/src/crypto/public_key/dsa.js @@ -25,8 +25,6 @@ * @module crypto/public_key/dsa */ -'use strict'; - import BigInteger from './jsbn.js'; import random from '../random.js'; import hashModule from '../hash'; diff --git a/src/crypto/public_key/elgamal.js b/src/crypto/public_key/elgamal.js index 14b39016..f7a4175f 100644 --- a/src/crypto/public_key/elgamal.js +++ b/src/crypto/public_key/elgamal.js @@ -24,8 +24,6 @@ * @module crypto/public_key/elgamal */ -'use strict'; - import BigInteger from './jsbn.js'; import random from '../random.js'; import util from '../../util.js'; diff --git a/src/crypto/public_key/elliptic/curves.js b/src/crypto/public_key/elliptic/curves.js index 9b7cf974..b26e4de3 100644 --- a/src/crypto/public_key/elliptic/curves.js +++ b/src/crypto/public_key/elliptic/curves.js @@ -25,8 +25,6 @@ * @module crypto/public_key/elliptic/curve */ -'use strict'; - import { ec as EC, eddsa as EdDSA } from 'elliptic'; import { KeyPair } from './key'; import BigInteger from '../jsbn'; diff --git a/src/crypto/public_key/elliptic/ecdh.js b/src/crypto/public_key/elliptic/ecdh.js index ff5d3f4e..fdc97336 100644 --- a/src/crypto/public_key/elliptic/ecdh.js +++ b/src/crypto/public_key/elliptic/ecdh.js @@ -30,8 +30,6 @@ * @module crypto/public_key/elliptic/ecdh */ -'use strict'; - import curves from './curves'; import BigInteger from '../jsbn'; import cipher from '../../cipher'; diff --git a/src/crypto/public_key/elliptic/ecdsa.js b/src/crypto/public_key/elliptic/ecdsa.js index 0e2dd6e3..b64d2c69 100644 --- a/src/crypto/public_key/elliptic/ecdsa.js +++ b/src/crypto/public_key/elliptic/ecdsa.js @@ -24,8 +24,6 @@ * @module crypto/public_key/elliptic/ecdsa */ -'use strict'; - import hash from '../../hash'; import curves from './curves'; import BigInteger from '../jsbn'; diff --git a/src/crypto/public_key/elliptic/eddsa.js b/src/crypto/public_key/elliptic/eddsa.js index 4cf1e85b..485aff27 100644 --- a/src/crypto/public_key/elliptic/eddsa.js +++ b/src/crypto/public_key/elliptic/eddsa.js @@ -24,8 +24,6 @@ * @module crypto/public_key/elliptic/eddsa */ -'use strict'; - import BN from 'bn.js'; import hash from '../../hash'; import curves from './curves'; diff --git a/src/crypto/public_key/elliptic/index.js b/src/crypto/public_key/elliptic/index.js index 39108f0a..c250d594 100644 --- a/src/crypto/public_key/elliptic/index.js +++ b/src/crypto/public_key/elliptic/index.js @@ -25,8 +25,6 @@ * @module crypto/public_key/elliptic */ -'use strict'; - import {get, generate, getPreferredHashAlgo} from './curves'; import ecdsa from './ecdsa'; import eddsa from './eddsa'; diff --git a/src/crypto/public_key/elliptic/key.js b/src/crypto/public_key/elliptic/key.js index cc9d7404..b9fe25e4 100644 --- a/src/crypto/public_key/elliptic/key.js +++ b/src/crypto/public_key/elliptic/key.js @@ -30,8 +30,6 @@ * @module crypto/public_key/elliptic/key */ -'use strict'; - import curves from './curves'; import BigInteger from '../jsbn'; import hash from '../../hash'; diff --git a/src/crypto/public_key/index.js b/src/crypto/public_key/index.js index ed29c250..ae4aac89 100644 --- a/src/crypto/public_key/index.js +++ b/src/crypto/public_key/index.js @@ -6,8 +6,6 @@ * @module crypto/public_key */ -'use strict'; - /** @see module:crypto/public_key/rsa */ import rsa from './rsa.js'; /** @see module:crypto/public_key/elgamal */ diff --git a/src/crypto/public_key/rsa.js b/src/crypto/public_key/rsa.js index e87eb904..477530d9 100644 --- a/src/crypto/public_key/rsa.js +++ b/src/crypto/public_key/rsa.js @@ -24,8 +24,6 @@ * @module crypto/public_key/rsa */ -'use strict'; - import BigInteger from './jsbn.js'; import util from '../../util.js'; import random from '../random.js'; diff --git a/src/crypto/random.js b/src/crypto/random.js index dafa16b7..04166dea 100644 --- a/src/crypto/random.js +++ b/src/crypto/random.js @@ -23,8 +23,6 @@ * @module crypto/random */ -'use strict'; - import type_mpi from '../type/mpi.js'; import util from '../util.js'; diff --git a/src/crypto/signature.js b/src/crypto/signature.js index 07310966..96e86623 100644 --- a/src/crypto/signature.js +++ b/src/crypto/signature.js @@ -5,8 +5,6 @@ * @requires crypto/public_key * @module crypto/signature */ -'use strict'; - import util from '../util'; import publicKey from './public_key'; import pkcs1 from './pkcs1.js'; diff --git a/src/encoding/armor.js b/src/encoding/armor.js index 4c854910..eda28d86 100644 --- a/src/encoding/armor.js +++ b/src/encoding/armor.js @@ -22,8 +22,6 @@ * @module encoding/armor */ -'use strict'; - import base64 from './base64.js'; import enums from '../enums.js'; import config from '../config'; diff --git a/src/encoding/base64.js b/src/encoding/base64.js index e4d22cfe..b1d7bb9b 100644 --- a/src/encoding/base64.js +++ b/src/encoding/base64.js @@ -15,8 +15,6 @@ * @module encoding/base64 */ -'use strict'; - var b64s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; // Standard radix-64 var b64u = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'; // URL-safe radix-64 diff --git a/src/enums.js b/src/enums.js index 00040ea9..607b0e53 100644 --- a/src/enums.js +++ b/src/enums.js @@ -1,5 +1,3 @@ -'use strict'; - /** * @module enums */ diff --git a/src/hkp.js b/src/hkp.js index 5c967c8d..c4725c14 100644 --- a/src/hkp.js +++ b/src/hkp.js @@ -20,8 +20,6 @@ * in order to lookup and upload keys on standard public key servers. */ -'use strict'; - import config from './config'; /** diff --git a/src/index.js b/src/index.js index 1b242b87..0b771afe 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,5 @@ /* eslint-disable import/newline-after-import, import/first */ -'use strict'; - /** * Export high level api as default. * Usage: diff --git a/src/key.js b/src/key.js index a929729c..35e4b0d5 100644 --- a/src/key.js +++ b/src/key.js @@ -25,8 +25,6 @@ * @module key */ -'use strict'; - import config from './config'; import crypto from './crypto'; import armor from './encoding/armor'; diff --git a/src/keyring/index.js b/src/keyring/index.js index 430e4caa..1279a644 100644 --- a/src/keyring/index.js +++ b/src/keyring/index.js @@ -1,5 +1,3 @@ -'use strict'; - /** * @see module:keyring/keyring * @module keyring diff --git a/src/keyring/keyring.js b/src/keyring/keyring.js index 7bb89ba9..8226ebe4 100644 --- a/src/keyring/keyring.js +++ b/src/keyring/keyring.js @@ -23,8 +23,6 @@ * @param {keyring/localstore} [storeHandler] class implementing loadPublic(), loadPrivate(), storePublic(), and storePrivate() methods */ -'use strict'; - import { readArmored } from '../key'; import LocalStore from './localstore'; diff --git a/src/keyring/localstore.js b/src/keyring/localstore.js index 4bbc8588..3a6532f8 100644 --- a/src/keyring/localstore.js +++ b/src/keyring/localstore.js @@ -24,8 +24,6 @@ * @param {String} prefix prefix for itemnames in localstore */ -'use strict'; - import config from '../config'; import { readArmored } from '../key'; import util from '../util'; diff --git a/src/message.js b/src/message.js index dfd60da3..1f7002da 100644 --- a/src/message.js +++ b/src/message.js @@ -27,8 +27,6 @@ * @module message */ -'use strict'; - import config from './config'; import crypto from './crypto'; import armor from './encoding/armor'; diff --git a/src/openpgp.js b/src/openpgp.js index 8181351e..a82fc255 100644 --- a/src/openpgp.js +++ b/src/openpgp.js @@ -32,8 +32,6 @@ * for extending and developing on top of the base library. */ -'use strict'; - import * as messageLib from './message'; import { CleartextMessage } from './cleartext'; import { generate, reformat } from './key'; diff --git a/src/packet/all_packets.js b/src/packet/all_packets.js index 093e8770..e16c41c9 100644 --- a/src/packet/all_packets.js +++ b/src/packet/all_packets.js @@ -3,8 +3,6 @@ * @module packet */ -'use strict'; - import enums from '../enums.js'; import * as packets from './all_packets.js'; // re-import module to parse packets from tag diff --git a/src/packet/clone.js b/src/packet/clone.js index 8c7bff7d..8cd3f56e 100644 --- a/src/packet/clone.js +++ b/src/packet/clone.js @@ -21,8 +21,6 @@ * the structured cloning algorithm. */ -'use strict'; - import { Key } from '../key'; import { Message } from '../message'; import { CleartextMessage } from '../cleartext'; diff --git a/src/packet/compressed.js b/src/packet/compressed.js index b63ef6a7..991b7c97 100644 --- a/src/packet/compressed.js +++ b/src/packet/compressed.js @@ -29,8 +29,6 @@ * @module packet/compressed */ -'use strict'; - import enums from '../enums.js'; import util from '../util.js'; import Zlib from '../compression/zlib.min.js'; diff --git a/src/packet/index.js b/src/packet/index.js index 629a4b7f..81fedb82 100644 --- a/src/packet/index.js +++ b/src/packet/index.js @@ -1,5 +1,3 @@ -'use strict'; - import * as packets from './all_packets.js'; import * as clone from './clone.js'; import List from './packetlist.js'; diff --git a/src/packet/literal.js b/src/packet/literal.js index 4205b6df..4d6c29d8 100644 --- a/src/packet/literal.js +++ b/src/packet/literal.js @@ -25,8 +25,6 @@ * @module packet/literal */ -'use strict'; - import util from '../util.js'; import enums from '../enums.js'; diff --git a/src/packet/marker.js b/src/packet/marker.js index c3da0558..1c008a38 100644 --- a/src/packet/marker.js +++ b/src/packet/marker.js @@ -29,8 +29,6 @@ * @module packet/marker */ -'use strict'; - import enums from '../enums.js'; /** diff --git a/src/packet/one_pass_signature.js b/src/packet/one_pass_signature.js index bf80c33f..fa7fd2bd 100644 --- a/src/packet/one_pass_signature.js +++ b/src/packet/one_pass_signature.js @@ -29,8 +29,6 @@ * @module packet/one_pass_signature */ -'use strict'; - import util from '../util.js'; import enums from '../enums.js'; import type_keyid from '../type/keyid.js'; diff --git a/src/packet/packet.js b/src/packet/packet.js index 866e6524..7accc016 100644 --- a/src/packet/packet.js +++ b/src/packet/packet.js @@ -21,8 +21,6 @@ * @module packet/packet */ -'use strict'; - import util from '../util.js'; export default { diff --git a/src/packet/packetlist.js b/src/packet/packetlist.js index d671206a..63aff6e7 100644 --- a/src/packet/packetlist.js +++ b/src/packet/packetlist.js @@ -10,8 +10,6 @@ * @module packet/packetlist */ -'use strict'; - import util from '../util'; import packetParser from './packet.js'; import * as packets from './all_packets.js'; diff --git a/src/packet/public_key.js b/src/packet/public_key.js index 13ef9b7e..e250b0d0 100644 --- a/src/packet/public_key.js +++ b/src/packet/public_key.js @@ -29,8 +29,6 @@ * @module packet/public_key */ -'use strict'; - import crypto from '../crypto'; import enums from '../enums'; import util from '../util'; diff --git a/src/packet/public_key_encrypted_session_key.js b/src/packet/public_key_encrypted_session_key.js index 9d86e2e0..e6eebc9e 100644 --- a/src/packet/public_key_encrypted_session_key.js +++ b/src/packet/public_key_encrypted_session_key.js @@ -38,8 +38,6 @@ * @module packet/public_key_encrypted_session_key */ -'use strict'; - import type_keyid from '../type/keyid.js'; import util from '../util.js'; import type_ecdh_symkey from '../type/ecdh_symkey.js'; diff --git a/src/packet/public_subkey.js b/src/packet/public_subkey.js index 45b8523c..1c71a77a 100644 --- a/src/packet/public_subkey.js +++ b/src/packet/public_subkey.js @@ -21,8 +21,6 @@ * @module packet/public_subkey */ -'use strict'; - import publicKey from './public_key.js'; import enums from '../enums.js'; diff --git a/src/packet/secret_key.js b/src/packet/secret_key.js index 8c54d5db..f21880f4 100644 --- a/src/packet/secret_key.js +++ b/src/packet/secret_key.js @@ -31,8 +31,6 @@ * @module packet/secret_key */ -'use strict'; - import publicKey from './public_key.js'; import enums from '../enums.js'; import util from '../util.js'; diff --git a/src/packet/secret_subkey.js b/src/packet/secret_subkey.js index 45cc2563..2439cf7b 100644 --- a/src/packet/secret_subkey.js +++ b/src/packet/secret_subkey.js @@ -21,8 +21,6 @@ * @module packet/secret_subkey */ -'use strict'; - import secretKey from './secret_key.js'; import enums from '../enums.js'; diff --git a/src/packet/sym_encrypted_aead_protected.js b/src/packet/sym_encrypted_aead_protected.js index 36284b13..631ea56a 100644 --- a/src/packet/sym_encrypted_aead_protected.js +++ b/src/packet/sym_encrypted_aead_protected.js @@ -20,8 +20,6 @@ * {@link https://tools.ietf.org/html/draft-ford-openpgp-format-00#section-2.1}: AEAD Protected Data Packet */ -'use strict'; - import util from '../util.js'; import crypto from '../crypto'; import enums from '../enums.js'; diff --git a/src/packet/sym_encrypted_integrity_protected.js b/src/packet/sym_encrypted_integrity_protected.js index c7f6cfca..c236b44d 100644 --- a/src/packet/sym_encrypted_integrity_protected.js +++ b/src/packet/sym_encrypted_integrity_protected.js @@ -32,8 +32,6 @@ * @module packet/sym_encrypted_integrity_protected */ -'use strict'; - import asmCrypto from 'asmcrypto-lite'; import util from '../util.js'; import crypto from '../crypto'; diff --git a/src/packet/sym_encrypted_session_key.js b/src/packet/sym_encrypted_session_key.js index 63e8f698..f7603af0 100644 --- a/src/packet/sym_encrypted_session_key.js +++ b/src/packet/sym_encrypted_session_key.js @@ -36,8 +36,6 @@ * @module packet/sym_encrypted_session_key */ -'use strict'; - import util from '../util.js'; import type_s2k from '../type/s2k.js'; import enums from '../enums.js'; diff --git a/src/packet/symmetrically_encrypted.js b/src/packet/symmetrically_encrypted.js index 25a469c8..c1f6a356 100644 --- a/src/packet/symmetrically_encrypted.js +++ b/src/packet/symmetrically_encrypted.js @@ -28,8 +28,6 @@ * @module packet/symmetrically_encrypted */ -'use strict'; - import crypto from '../crypto'; import enums from '../enums.js'; import config from '../config'; diff --git a/src/packet/trust.js b/src/packet/trust.js index c4617da5..8eeed343 100644 --- a/src/packet/trust.js +++ b/src/packet/trust.js @@ -3,8 +3,6 @@ * @module packet/trust */ -'use strict'; - import enums from '../enums.js'; /** diff --git a/src/packet/user_attribute.js b/src/packet/user_attribute.js index 00689898..efd57f99 100644 --- a/src/packet/user_attribute.js +++ b/src/packet/user_attribute.js @@ -36,8 +36,6 @@ * @module packet/user_attribute */ -'use strict'; - import util from '../util.js'; import packet from './packet.js'; import enums from '../enums.js'; diff --git a/src/packet/userid.js b/src/packet/userid.js index 5c5f4580..68ff8958 100644 --- a/src/packet/userid.js +++ b/src/packet/userid.js @@ -28,8 +28,6 @@ * @module packet/userid */ -'use strict'; - import util from '../util.js'; import enums from '../enums.js'; diff --git a/src/signature.js b/src/signature.js index 276201a0..368809b6 100644 --- a/src/signature.js +++ b/src/signature.js @@ -24,8 +24,6 @@ * @module signature */ -'use strict'; - import packet from './packet'; import enums from './enums.js'; import armor from './encoding/armor.js'; diff --git a/src/type/ecdh_symkey.js b/src/type/ecdh_symkey.js index e49cd155..ced69679 100644 --- a/src/type/ecdh_symkey.js +++ b/src/type/ecdh_symkey.js @@ -22,8 +22,6 @@ * @module type/ecdh_symkey */ -'use strict'; - import util from '../util'; module.exports = ECDHSymmetricKey; diff --git a/src/type/kdf_params.js b/src/type/kdf_params.js index 8a33a026..30bcf469 100644 --- a/src/type/kdf_params.js +++ b/src/type/kdf_params.js @@ -22,8 +22,6 @@ * @module type/kdf_params */ -'use strict'; - import enums from '../enums.js'; module.exports = KDFParams; diff --git a/src/type/keyid.js b/src/type/keyid.js index ed2b20a8..9d404324 100644 --- a/src/type/keyid.js +++ b/src/type/keyid.js @@ -26,8 +26,6 @@ * @module type/keyid */ -'use strict'; - import util from '../util.js'; /** diff --git a/src/type/mpi.js b/src/type/mpi.js index 18750b96..d8da6d0f 100644 --- a/src/type/mpi.js +++ b/src/type/mpi.js @@ -34,8 +34,6 @@ * @module type/mpi */ -'use strict'; - import BigInteger from '../crypto/public_key/jsbn'; import util from '../util'; diff --git a/src/type/oid.js b/src/type/oid.js index be633321..d46f306a 100644 --- a/src/type/oid.js +++ b/src/type/oid.js @@ -23,8 +23,6 @@ * @module type/oid */ -'use strict'; - import util from '../util.js'; module.exports = OID; diff --git a/src/type/s2k.js b/src/type/s2k.js index 0a54bf9b..bcb8228f 100644 --- a/src/type/s2k.js +++ b/src/type/s2k.js @@ -29,8 +29,6 @@ * @module type/s2k */ -'use strict'; - import enums from '../enums.js'; import util from '../util.js'; import crypto from '../crypto'; diff --git a/src/util.js b/src/util.js index 4b3f977c..712184a8 100644 --- a/src/util.js +++ b/src/util.js @@ -21,8 +21,6 @@ * @module util */ -'use strict'; - import config from './config'; export default { diff --git a/src/worker/async_proxy.js b/src/worker/async_proxy.js index 99d56554..0453db13 100644 --- a/src/worker/async_proxy.js +++ b/src/worker/async_proxy.js @@ -15,8 +15,6 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -'use strict'; - import util from '../util.js'; import crypto from '../crypto'; import packet from '../packet'; diff --git a/test/crypto/aes_kw.js b/test/crypto/aes_kw.js index 9500711d..9c6085df 100644 --- a/test/crypto/aes_kw.js +++ b/test/crypto/aes_kw.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var expect = require('chai').expect; diff --git a/test/crypto/cipher/aes.js b/test/crypto/cipher/aes.js index 231c2af5..fbc345f7 100644 --- a/test/crypto/cipher/aes.js +++ b/test/crypto/cipher/aes.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../dist/openpgp'); var util = openpgp.util, @@ -30,7 +28,7 @@ describe('AES Rijndael cipher test with test vectors from ecb_tbl.txt', function [[0xF0,0xF1,0xF2,0xF3,0xF5,0xF6,0xF7,0xF8,0xFA,0xFB,0xFC,0xFD,0xFE,0x01,0x00,0x02],[0x12,0xA8,0xCF,0xA2,0x3E,0xA7,0x64,0xFD,0x87,0x62,0x32,0xB4,0xE8,0x42,0xBC,0x44],[0x31,0x6F,0xB6,0x8E,0xDB,0xA7,0x36,0xC5,0x3E,0x78,0x47,0x7B,0xF9,0x13,0x72,0x5C]], [[0x04,0x05,0x06,0x07,0x09,0x0A,0x0B,0x0C,0x0E,0x0F,0x10,0x11,0x13,0x14,0x15,0x16],[0xBC,0xAF,0x32,0x41,0x5E,0x83,0x08,0xB3,0x72,0x3E,0x5F,0xDD,0x85,0x3C,0xCC,0x80],[0x69,0x36,0xF2,0xB9,0x3A,0xF8,0x39,0x7F,0xD3,0xA7,0x71,0xFC,0x01,0x1C,0x8C,0x37]], [[0x2C,0x2D,0x2E,0x2F,0x31,0x32,0x33,0x34,0x36,0x37,0x38,0x39,0x3B,0x3C,0x3D,0x3E],[0x89,0xAF,0xAE,0x68,0x5D,0x80,0x1A,0xD7,0x47,0xAC,0xE9,0x1F,0xC4,0x9A,0xDD,0xE0],[0xF3,0xF9,0x2F,0x7A,0x9C,0x59,0x17,0x9C,0x1F,0xCC,0x2C,0x2B,0xA0,0xB0,0x82,0xCD]]]; - + var testvectors192 = [[[0x00,0x01,0x02,0x03,0x05,0x06,0x07,0x08,0x0A,0x0B,0x0C,0x0D,0x0F,0x10,0x11,0x12,0x14,0x15,0x16,0x17,0x19,0x1A,0x1B,0x1C],[0x2D,0x33,0xEE,0xF2,0xC0,0x43,0x0A,0x8A,0x9E,0xBF,0x45,0xE8,0x09,0xC4,0x0B,0xB6],[0xDF,0xF4,0x94,0x5E,0x03,0x36,0xDF,0x4C,0x1C,0x56,0xBC,0x70,0x0E,0xFF,0x83,0x7F]], [[0x1E,0x1F,0x20,0x21,0x23,0x24,0x25,0x26,0x28,0x29,0x2A,0x2B,0x2D,0x2E,0x2F,0x30,0x32,0x33,0x34,0x35,0x37,0x38,0x39,0x3A],[0x6A,0xA3,0x75,0xD1,0xFA,0x15,0x5A,0x61,0xFB,0x72,0x35,0x3E,0x0A,0x5A,0x87,0x56],[0xB6,0xFD,0xDE,0xF4,0x75,0x27,0x65,0xE3,0x47,0xD5,0xD2,0xDC,0x19,0x6D,0x12,0x52]], [[0x3C,0x3D,0x3E,0x3F,0x41,0x42,0x43,0x44,0x46,0x47,0x48,0x49,0x4B,0x4C,0x4D,0x4E,0x50,0x51,0x52,0x53,0x55,0x56,0x57,0x58],[0xBC,0x37,0x36,0x51,0x8B,0x94,0x90,0xDC,0xB8,0xED,0x60,0xEB,0x26,0x75,0x8E,0xD4],[0xD2,0x36,0x84,0xE3,0xD9,0x63,0xB3,0xAF,0xCF,0x1A,0x11,0x4A,0xCA,0x90,0xCB,0xD6]], @@ -46,7 +44,7 @@ describe('AES Rijndael cipher test with test vectors from ecb_tbl.txt', function [[0x68,0x69,0x6A,0x6B,0x6D,0x6E,0x6F,0x70,0x72,0x73,0x74,0x75,0x77,0x78,0x79,0x7A,0x7C,0x7D,0x7E,0x7F,0x81,0x82,0x83,0x84],[0x32,0xDF,0x99,0xB4,0x31,0xED,0x5D,0xC5,0xAC,0xF8,0xCA,0xF6,0xDC,0x6C,0xE4,0x75],[0x07,0x80,0x5A,0xA0,0x43,0x98,0x6E,0xB2,0x36,0x93,0xE2,0x3B,0xEF,0x8F,0x34,0x38]], [[0x86,0x87,0x88,0x89,0x8B,0x8C,0x8D,0x8E,0x90,0x91,0x92,0x93,0x95,0x96,0x97,0x98,0x9A,0x9B,0x9C,0x9D,0x9F,0xA0,0xA1,0xA2],[0x7F,0xDC,0x2B,0x74,0x6F,0x3F,0x66,0x52,0x96,0x94,0x3B,0x83,0x71,0x0D,0x1F,0x82],[0xDF,0x0B,0x49,0x31,0x03,0x8B,0xAD,0xE8,0x48,0xDE,0xE3,0xB4,0xB8,0x5A,0xA4,0x4B]], [[0xA4,0xA5,0xA6,0xA7,0xA9,0xAA,0xAB,0xAC,0xAE,0xAF,0xB0,0xB1,0xB3,0xB4,0xB5,0xB6,0xB8,0xB9,0xBA,0xBB,0xBD,0xBE,0xBF,0xC0],[0x8F,0xBA,0x15,0x10,0xA3,0xC5,0xB8,0x7E,0x2E,0xAA,0x3F,0x7A,0x91,0x45,0x5C,0xA2],[0x59,0x2D,0x5F,0xDE,0xD7,0x65,0x82,0xE4,0x14,0x3C,0x65,0x09,0x93,0x09,0x47,0x7C]]]; - + var testvectors256 = [[[0x00,0x01,0x02,0x03,0x05,0x06,0x07,0x08,0x0A,0x0B,0x0C,0x0D,0x0F,0x10,0x11,0x12,0x14,0x15,0x16,0x17,0x19,0x1A,0x1B,0x1C,0x1E,0x1F,0x20,0x21,0x23,0x24,0x25,0x26],[0x83,0x4E,0xAD,0xFC,0xCA,0xC7,0xE1,0xB3,0x06,0x64,0xB1,0xAB,0xA4,0x48,0x15,0xAB],[0x19,0x46,0xDA,0xBF,0x6A,0x03,0xA2,0xA2,0xC3,0xD0,0xB0,0x50,0x80,0xAE,0xD6,0xFC]], [[0x28,0x29,0x2A,0x2B,0x2D,0x2E,0x2F,0x30,0x32,0x33,0x34,0x35,0x37,0x38,0x39,0x3A,0x3C,0x3D,0x3E,0x3F,0x41,0x42,0x43,0x44,0x46,0x47,0x48,0x49,0x4B,0x4C,0x4D,0x4E],[0xD9,0xDC,0x4D,0xBA,0x30,0x21,0xB0,0x5D,0x67,0xC0,0x51,0x8F,0x72,0xB6,0x2B,0xF1],[0x5E,0xD3,0x01,0xD7,0x47,0xD3,0xCC,0x71,0x54,0x45,0xEB,0xDE,0xC6,0x2F,0x2F,0xB4]], [[0x50,0x51,0x52,0x53,0x55,0x56,0x57,0x58,0x5A,0x5B,0x5C,0x5D,0x5F,0x60,0x61,0x62,0x64,0x65,0x66,0x67,0x69,0x6A,0x6B,0x6C,0x6E,0x6F,0x70,0x71,0x73,0x74,0x75,0x76],[0xA2,0x91,0xD8,0x63,0x01,0xA4,0xA7,0x39,0xF7,0x39,0x21,0x73,0xAA,0x3C,0x60,0x4C],[0x65,0x85,0xC8,0xF4,0x3D,0x13,0xA6,0xBE,0xAB,0x64,0x19,0xFC,0x59,0x35,0xB9,0xD0]], diff --git a/test/crypto/cipher/blowfish.js b/test/crypto/cipher/blowfish.js index fa02e280..b35c0b72 100644 --- a/test/crypto/cipher/blowfish.js +++ b/test/crypto/cipher/blowfish.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../dist/openpgp'); var util = openpgp.util, diff --git a/test/crypto/cipher/cast5.js b/test/crypto/cipher/cast5.js index 5a59de84..1f8e61c9 100644 --- a/test/crypto/cipher/cast5.js +++ b/test/crypto/cipher/cast5.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../dist/openpgp'); var util = openpgp.util, @@ -13,7 +11,7 @@ it('CAST-128 cipher test with test vectors from RFC2144', function (done) { return util.hexstrdump(result) == util.hexstrdump(util.bin2str(output)); } - + var testvectors = [[[0x01,0x23,0x45,0x67,0x12,0x34,0x56,0x78,0x23,0x45,0x67,0x89,0x34,0x56,0x78,0x9A],[0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF],[0x23,0x8B,0x4F,0xE5,0x84,0x7E,0x44,0xB2]]]; for (var i = 0; i < testvectors.length; i++) { diff --git a/test/crypto/cipher/des.js b/test/crypto/cipher/des.js index ea5b2509..0c80366d 100644 --- a/test/crypto/cipher/des.js +++ b/test/crypto/cipher/des.js @@ -1,144 +1,142 @@ -'use strict'; - -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../dist/openpgp'); - -var util = openpgp.util, - chai = require('chai'), - expect = chai.expect; - -describe('TripleDES (EDE) cipher test with test vectors from NIST SP 800-20', function() { - // see https://csrc.nist.gov/publications/nistpubs/800-20/800-20.pdf - var key = new Uint8Array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]); - var testvectors = [[[0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x95,0xF8,0xA5,0xE5,0xDD,0x31,0xD9,0x00]], - [[0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0xDD,0x7F,0x12,0x1C,0xA5,0x01,0x56,0x19]], - [[0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x2E,0x86,0x53,0x10,0x4F,0x38,0x34,0xEA]], - [[0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x4B,0xD3,0x88,0xFF,0x6C,0xD8,0x1D,0x4F]], - [[0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x20,0xB9,0xE7,0x67,0xB2,0xFB,0x14,0x56]], - [[0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x55,0x57,0x93,0x80,0xD7,0x71,0x38,0xEF]], - [[0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x6C,0xC5,0xDE,0xFA,0xAF,0x04,0x51,0x2F]], - [[0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x0D,0x9F,0x27,0x9B,0xA5,0xD8,0x72,0x60]], - [[0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00],[0xD9,0x03,0x1B,0x02,0x71,0xBD,0x5A,0x0A]], - [[0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00],[0x42,0x42,0x50,0xB3,0x7C,0x3D,0xD9,0x51]], - [[0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00],[0xB8,0x06,0x1B,0x7E,0xCD,0x9A,0x21,0xE5]], - [[0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00],[0xF1,0x5D,0x0F,0x28,0x6B,0x65,0xBD,0x28]], - [[0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00],[0xAD,0xD0,0xCC,0x8D,0x6E,0x5D,0xEB,0xA1]], - [[0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00],[0xE6,0xD5,0xF8,0x27,0x52,0xAD,0x63,0xD1]], - [[0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00],[0xEC,0xBF,0xE3,0xBD,0x3F,0x59,0x1A,0x5E]], - [[0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00],[0xF3,0x56,0x83,0x43,0x79,0xD1,0x65,0xCD]], - [[0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00],[0x2B,0x9F,0x98,0x2F,0x20,0x03,0x7F,0xA9]], - [[0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00],[0x88,0x9D,0xE0,0x68,0xA1,0x6F,0x0B,0xE6]], - [[0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00],[0xE1,0x9E,0x27,0x5D,0x84,0x6A,0x12,0x98]], - [[0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00],[0x32,0x9A,0x8E,0xD5,0x23,0xD7,0x1A,0xEC]], - [[0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00],[0xE7,0xFC,0xE2,0x25,0x57,0xD2,0x3C,0x97]], - [[0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00],[0x12,0xA9,0xF5,0x81,0x7F,0xF2,0xD6,0x5D]], - [[0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00],[0xA4,0x84,0xC3,0xAD,0x38,0xDC,0x9C,0x19]], - [[0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00],[0xFB,0xE0,0x0A,0x8A,0x1E,0xF8,0xAD,0x72]], - [[0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00],[0x75,0x0D,0x07,0x94,0x07,0x52,0x13,0x63]], - [[0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00],[0x64,0xFE,0xED,0x9C,0x72,0x4C,0x2F,0xAF]], - [[0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00],[0xF0,0x2B,0x26,0x3B,0x32,0x8E,0x2B,0x60]], - [[0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00],[0x9D,0x64,0x55,0x5A,0x9A,0x10,0xB8,0x52]], - [[0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00],[0xD1,0x06,0xFF,0x0B,0xED,0x52,0x55,0xD7]], - [[0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00],[0xE1,0x65,0x2C,0x6B,0x13,0x8C,0x64,0xA5]], - [[0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00],[0xE4,0x28,0x58,0x11,0x86,0xEC,0x8F,0x46]], - [[0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00],[0xAE,0xB5,0xF5,0xED,0xE2,0x2D,0x1A,0x36]], - [[0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00],[0xE9,0x43,0xD7,0x56,0x8A,0xEC,0x0C,0x5C]], - [[0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00],[0xDF,0x98,0xC8,0x27,0x6F,0x54,0xB0,0x4B]], - [[0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00],[0xB1,0x60,0xE4,0x68,0x0F,0x6C,0x69,0x6F]], - [[0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00],[0xFA,0x07,0x52,0xB0,0x7D,0x9C,0x4A,0xB8]], - [[0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00],[0xCA,0x3A,0x2B,0x03,0x6D,0xBC,0x85,0x02]], - [[0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00],[0x5E,0x09,0x05,0x51,0x7B,0xB5,0x9B,0xCF]], - [[0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00],[0x81,0x4E,0xEB,0x3B,0x91,0xD9,0x07,0x26]], - [[0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00],[0x4D,0x49,0xDB,0x15,0x32,0x91,0x9C,0x9F]], - [[0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00],[0x25,0xEB,0x5F,0xC3,0xF8,0xCF,0x06,0x21]], - [[0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00],[0xAB,0x6A,0x20,0xC0,0x62,0x0D,0x1C,0x6F]], - [[0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00],[0x79,0xE9,0x0D,0xBC,0x98,0xF9,0x2C,0xCA]], - [[0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00],[0x86,0x6E,0xCE,0xDD,0x80,0x72,0xBB,0x0E]], - [[0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00],[0x8B,0x54,0x53,0x6F,0x2F,0x3E,0x64,0xA8]], - [[0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00],[0xEA,0x51,0xD3,0x97,0x55,0x95,0xB8,0x6B]], - [[0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00],[0xCA,0xFF,0xC6,0xAC,0x45,0x42,0xDE,0x31]], - [[0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00],[0x8D,0xD4,0x5A,0x2D,0xDF,0x90,0x79,0x6C]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00],[0x10,0x29,0xD5,0x5E,0x88,0x0E,0xC2,0xD0]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00],[0x5D,0x86,0xCB,0x23,0x63,0x9D,0xBE,0xA9]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00],[0x1D,0x1C,0xA8,0x53,0xAE,0x7C,0x0C,0x5F]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00],[0xCE,0x33,0x23,0x29,0x24,0x8F,0x32,0x28]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00],[0x84,0x05,0xD1,0xAB,0xE2,0x4F,0xB9,0x42]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00],[0xE6,0x43,0xD7,0x80,0x90,0xCA,0x42,0x07]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00],[0x48,0x22,0x1B,0x99,0x37,0x74,0x8A,0x23]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00],[0xDD,0x7C,0x0B,0xBD,0x61,0xFA,0xFD,0x54]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80],[0x2F,0xBC,0x29,0x1A,0x57,0x0D,0xB5,0xC4]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40],[0xE0,0x7C,0x30,0xD7,0xE4,0xE2,0x6E,0x12]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20],[0x09,0x53,0xE2,0x25,0x8E,0x8E,0x90,0xA1]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10],[0x5B,0x71,0x1B,0xC4,0xCE,0xEB,0xF2,0xEE]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08],[0xCC,0x08,0x3F,0x1E,0x6D,0x9E,0x85,0xF6]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04],[0xD2,0xFD,0x88,0x67,0xD5,0x0D,0x2D,0xFE]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02],[0x06,0xE7,0xEA,0x22,0xCE,0x92,0x70,0x8F]], - [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01],[0x16,0x6B,0x40,0xB4,0x4A,0xBA,0x4B,0xD6]]]; - - it('3DES EDE test vectors', function (done) { - for (var i = 0; i < testvectors.length; i++) { - var des = new openpgp.crypto.cipher.tripledes(key); - - var encr = util.bin2str(des.encrypt(testvectors[i][0], key)); - - expect(encr, 'vector with block ' + util.hexidump(testvectors[i][0]) + - ' and key ' + util.hexstrdump(util.Uint8Array2str(key)) + - ' should be ' + util.hexidump(testvectors[i][1]) + - ' != ' + util.hexidump(encr)).to.be.equal(util.bin2str(testvectors[i][1])); - } - done(); - }); - - it('DES encrypt/decrypt padding tests', function (done) { - var key = new Uint8Array([0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF]); - var testvectors = new Array(); - testvectors[0] = [[[0x01], [0x24, 0xC7, 0x4A, 0x9A, 0x79, 0x75, 0x4B, 0xC7]], - [[0x02, 0x03], [0xA7, 0x7A, 0x9A, 0x59, 0x8A, 0x86, 0x85, 0xC5]], - [[0x03, 0x04, 0x05], [0x01, 0xCF, 0xEB, 0x6A, 0x74, 0x60, 0xF5, 0x02]], - [[0x04, 0x05, 0x06, 0x07], [0xA8, 0xF0, 0x3D, 0x59, 0xBA, 0x6B, 0x0E, 0x76]], - [[0x05, 0x06, 0x07, 0x08, 0x09], [0x86, 0x40, 0x33, 0x61, 0x3F, 0x55, 0x73, 0x49]], - [[0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B], [0x13, 0x21, 0x3E, 0x0E, 0xCE, 0x2C, 0x94, 0x01]], - [[0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D], [0x30, 0x49, 0x97, 0xC1, 0xDA, 0xD5, 0x59, 0xA5]], - [[0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F], [0x83, 0x25, 0x79, 0x06, 0x54, 0xA4, 0x44, 0xD9]]]; - testvectors[1] = [[[0x01], [0xF2, 0xAB, 0x1C, 0x9E, 0x70, 0x7D, 0xCC, 0x92]], - [[0x02, 0x03], [0x6B, 0x4C, 0x67, 0x24, 0x9F, 0xB7, 0x4D, 0xAC]], - [[0x03, 0x04, 0x05], [0x68, 0x95, 0xAB, 0xA8, 0xEA, 0x53, 0x13, 0x23]], - [[0x04, 0x05, 0x06, 0x07], [0xC8, 0xDE, 0x60, 0x8F, 0xF6, 0x09, 0x90, 0xB5]], - [[0x05, 0x06, 0x07, 0x08, 0x09], [0x19, 0x13, 0x50, 0x20, 0x70, 0x40, 0x2E, 0x09]], - [[0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B], [0xA8, 0x23, 0x40, 0xC6, 0x17, 0xA6, 0x31, 0x4A]], - [[0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D], [0x36, 0x62, 0xF2, 0x99, 0x68, 0xD4, 0xBF, 0x7C]], - [[0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F], [0x83, 0x25, 0x79, 0x06, 0x54, 0xA4, 0x44, 0xD9, 0x08, 0x6F, 0x9A, 0x1D, 0x74, 0xC9, 0x4D, 0x4E]]]; - testvectors[2] = [[[0x01], [0x83, 0x68, 0xE4, 0x9C, 0x84, 0xCC, 0xCB, 0xF0]], - [[0x02, 0x03], [0xBB, 0xA8, 0x0B, 0x66, 0x1B, 0x62, 0xC4, 0xC8]], - [[0x03, 0x04, 0x05], [0x9A, 0xD7, 0x5A, 0x24, 0xFD, 0x3F, 0xBF, 0x22]], - [[0x04, 0x05, 0x06, 0x07], [0x14, 0x4E, 0x68, 0x6D, 0x2E, 0xC1, 0xB7, 0x52]], - [[0x05, 0x06, 0x07, 0x08, 0x09], [0x12, 0x0A, 0x51, 0x08, 0xF9, 0xA3, 0x03, 0x74]], - [[0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B], [0xB2, 0x07, 0xD1, 0x05, 0xF6, 0x67, 0xAF, 0xBA]], - [[0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D], [0xCA, 0x59, 0x61, 0x3A, 0x83, 0x23, 0x26, 0xDD]], - [[0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F], [0x83, 0x25, 0x79, 0x06, 0x54, 0xA4, 0x44, 0xD9]]]; - - var des = new openpgp.crypto.cipher.des(key); - - for (var padding = 0; padding < 3; padding++) { - var thisVectorSet = testvectors[padding]; - - for (var i = 0; i < thisVectorSet.length; i++) { - var encrypted = des.encrypt(thisVectorSet[i][0], padding); - var decrypted = des.decrypt(encrypted, padding); - - expect(util.bin2str(encrypted), 'vector with block [' + util.hexidump(thisVectorSet[i][0]) + - '] and key [' + util.hexstrdump(util.Uint8Array2str(key)) + - '] and padding [' + padding + - '] should be ' + util.hexidump(thisVectorSet[i][1]) + - ' - Actually [' + util.hexidump(encrypted) + - ']').to.equal(util.bin2str(thisVectorSet[i][1])); - expect(util.bin2str(decrypted), 'vector with block [' + util.hexidump(thisVectorSet[i][0]) + - '] and key [' + util.hexstrdump(util.Uint8Array2str(key)) + - '] and padding [' + padding + - '] should be ' + util.hexidump(thisVectorSet[i][0]) + - ' - Actually [' + util.hexidump(decrypted) + - ']').to.equal(util.bin2str(thisVectorSet[i][0])); - } - } - done(); - }); -}); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../dist/openpgp'); + +var util = openpgp.util, + chai = require('chai'), + expect = chai.expect; + +describe('TripleDES (EDE) cipher test with test vectors from NIST SP 800-20', function() { + // see https://csrc.nist.gov/publications/nistpubs/800-20/800-20.pdf + var key = new Uint8Array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]); + var testvectors = [[[0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x95,0xF8,0xA5,0xE5,0xDD,0x31,0xD9,0x00]], + [[0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0xDD,0x7F,0x12,0x1C,0xA5,0x01,0x56,0x19]], + [[0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x2E,0x86,0x53,0x10,0x4F,0x38,0x34,0xEA]], + [[0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x4B,0xD3,0x88,0xFF,0x6C,0xD8,0x1D,0x4F]], + [[0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x20,0xB9,0xE7,0x67,0xB2,0xFB,0x14,0x56]], + [[0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x55,0x57,0x93,0x80,0xD7,0x71,0x38,0xEF]], + [[0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x6C,0xC5,0xDE,0xFA,0xAF,0x04,0x51,0x2F]], + [[0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00],[0x0D,0x9F,0x27,0x9B,0xA5,0xD8,0x72,0x60]], + [[0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00],[0xD9,0x03,0x1B,0x02,0x71,0xBD,0x5A,0x0A]], + [[0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00],[0x42,0x42,0x50,0xB3,0x7C,0x3D,0xD9,0x51]], + [[0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00],[0xB8,0x06,0x1B,0x7E,0xCD,0x9A,0x21,0xE5]], + [[0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00],[0xF1,0x5D,0x0F,0x28,0x6B,0x65,0xBD,0x28]], + [[0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00],[0xAD,0xD0,0xCC,0x8D,0x6E,0x5D,0xEB,0xA1]], + [[0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00],[0xE6,0xD5,0xF8,0x27,0x52,0xAD,0x63,0xD1]], + [[0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00],[0xEC,0xBF,0xE3,0xBD,0x3F,0x59,0x1A,0x5E]], + [[0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00],[0xF3,0x56,0x83,0x43,0x79,0xD1,0x65,0xCD]], + [[0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00],[0x2B,0x9F,0x98,0x2F,0x20,0x03,0x7F,0xA9]], + [[0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00],[0x88,0x9D,0xE0,0x68,0xA1,0x6F,0x0B,0xE6]], + [[0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00],[0xE1,0x9E,0x27,0x5D,0x84,0x6A,0x12,0x98]], + [[0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00],[0x32,0x9A,0x8E,0xD5,0x23,0xD7,0x1A,0xEC]], + [[0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00],[0xE7,0xFC,0xE2,0x25,0x57,0xD2,0x3C,0x97]], + [[0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00],[0x12,0xA9,0xF5,0x81,0x7F,0xF2,0xD6,0x5D]], + [[0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00],[0xA4,0x84,0xC3,0xAD,0x38,0xDC,0x9C,0x19]], + [[0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00],[0xFB,0xE0,0x0A,0x8A,0x1E,0xF8,0xAD,0x72]], + [[0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00],[0x75,0x0D,0x07,0x94,0x07,0x52,0x13,0x63]], + [[0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00],[0x64,0xFE,0xED,0x9C,0x72,0x4C,0x2F,0xAF]], + [[0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00],[0xF0,0x2B,0x26,0x3B,0x32,0x8E,0x2B,0x60]], + [[0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00],[0x9D,0x64,0x55,0x5A,0x9A,0x10,0xB8,0x52]], + [[0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00],[0xD1,0x06,0xFF,0x0B,0xED,0x52,0x55,0xD7]], + [[0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00],[0xE1,0x65,0x2C,0x6B,0x13,0x8C,0x64,0xA5]], + [[0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00],[0xE4,0x28,0x58,0x11,0x86,0xEC,0x8F,0x46]], + [[0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00],[0xAE,0xB5,0xF5,0xED,0xE2,0x2D,0x1A,0x36]], + [[0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00],[0xE9,0x43,0xD7,0x56,0x8A,0xEC,0x0C,0x5C]], + [[0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00],[0xDF,0x98,0xC8,0x27,0x6F,0x54,0xB0,0x4B]], + [[0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00],[0xB1,0x60,0xE4,0x68,0x0F,0x6C,0x69,0x6F]], + [[0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00],[0xFA,0x07,0x52,0xB0,0x7D,0x9C,0x4A,0xB8]], + [[0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00],[0xCA,0x3A,0x2B,0x03,0x6D,0xBC,0x85,0x02]], + [[0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00],[0x5E,0x09,0x05,0x51,0x7B,0xB5,0x9B,0xCF]], + [[0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00],[0x81,0x4E,0xEB,0x3B,0x91,0xD9,0x07,0x26]], + [[0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00],[0x4D,0x49,0xDB,0x15,0x32,0x91,0x9C,0x9F]], + [[0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00],[0x25,0xEB,0x5F,0xC3,0xF8,0xCF,0x06,0x21]], + [[0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00],[0xAB,0x6A,0x20,0xC0,0x62,0x0D,0x1C,0x6F]], + [[0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00],[0x79,0xE9,0x0D,0xBC,0x98,0xF9,0x2C,0xCA]], + [[0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00],[0x86,0x6E,0xCE,0xDD,0x80,0x72,0xBB,0x0E]], + [[0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00],[0x8B,0x54,0x53,0x6F,0x2F,0x3E,0x64,0xA8]], + [[0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00],[0xEA,0x51,0xD3,0x97,0x55,0x95,0xB8,0x6B]], + [[0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00],[0xCA,0xFF,0xC6,0xAC,0x45,0x42,0xDE,0x31]], + [[0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00],[0x8D,0xD4,0x5A,0x2D,0xDF,0x90,0x79,0x6C]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00],[0x10,0x29,0xD5,0x5E,0x88,0x0E,0xC2,0xD0]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00],[0x5D,0x86,0xCB,0x23,0x63,0x9D,0xBE,0xA9]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00],[0x1D,0x1C,0xA8,0x53,0xAE,0x7C,0x0C,0x5F]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00],[0xCE,0x33,0x23,0x29,0x24,0x8F,0x32,0x28]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00],[0x84,0x05,0xD1,0xAB,0xE2,0x4F,0xB9,0x42]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00],[0xE6,0x43,0xD7,0x80,0x90,0xCA,0x42,0x07]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00],[0x48,0x22,0x1B,0x99,0x37,0x74,0x8A,0x23]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00],[0xDD,0x7C,0x0B,0xBD,0x61,0xFA,0xFD,0x54]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80],[0x2F,0xBC,0x29,0x1A,0x57,0x0D,0xB5,0xC4]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40],[0xE0,0x7C,0x30,0xD7,0xE4,0xE2,0x6E,0x12]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20],[0x09,0x53,0xE2,0x25,0x8E,0x8E,0x90,0xA1]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10],[0x5B,0x71,0x1B,0xC4,0xCE,0xEB,0xF2,0xEE]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08],[0xCC,0x08,0x3F,0x1E,0x6D,0x9E,0x85,0xF6]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04],[0xD2,0xFD,0x88,0x67,0xD5,0x0D,0x2D,0xFE]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02],[0x06,0xE7,0xEA,0x22,0xCE,0x92,0x70,0x8F]], + [[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01],[0x16,0x6B,0x40,0xB4,0x4A,0xBA,0x4B,0xD6]]]; + + it('3DES EDE test vectors', function (done) { + for (var i = 0; i < testvectors.length; i++) { + var des = new openpgp.crypto.cipher.tripledes(key); + + var encr = util.bin2str(des.encrypt(testvectors[i][0], key)); + + expect(encr, 'vector with block ' + util.hexidump(testvectors[i][0]) + + ' and key ' + util.hexstrdump(util.Uint8Array2str(key)) + + ' should be ' + util.hexidump(testvectors[i][1]) + + ' != ' + util.hexidump(encr)).to.be.equal(util.bin2str(testvectors[i][1])); + } + done(); + }); + + it('DES encrypt/decrypt padding tests', function (done) { + var key = new Uint8Array([0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF]); + var testvectors = new Array(); + testvectors[0] = [[[0x01], [0x24, 0xC7, 0x4A, 0x9A, 0x79, 0x75, 0x4B, 0xC7]], + [[0x02, 0x03], [0xA7, 0x7A, 0x9A, 0x59, 0x8A, 0x86, 0x85, 0xC5]], + [[0x03, 0x04, 0x05], [0x01, 0xCF, 0xEB, 0x6A, 0x74, 0x60, 0xF5, 0x02]], + [[0x04, 0x05, 0x06, 0x07], [0xA8, 0xF0, 0x3D, 0x59, 0xBA, 0x6B, 0x0E, 0x76]], + [[0x05, 0x06, 0x07, 0x08, 0x09], [0x86, 0x40, 0x33, 0x61, 0x3F, 0x55, 0x73, 0x49]], + [[0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B], [0x13, 0x21, 0x3E, 0x0E, 0xCE, 0x2C, 0x94, 0x01]], + [[0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D], [0x30, 0x49, 0x97, 0xC1, 0xDA, 0xD5, 0x59, 0xA5]], + [[0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F], [0x83, 0x25, 0x79, 0x06, 0x54, 0xA4, 0x44, 0xD9]]]; + testvectors[1] = [[[0x01], [0xF2, 0xAB, 0x1C, 0x9E, 0x70, 0x7D, 0xCC, 0x92]], + [[0x02, 0x03], [0x6B, 0x4C, 0x67, 0x24, 0x9F, 0xB7, 0x4D, 0xAC]], + [[0x03, 0x04, 0x05], [0x68, 0x95, 0xAB, 0xA8, 0xEA, 0x53, 0x13, 0x23]], + [[0x04, 0x05, 0x06, 0x07], [0xC8, 0xDE, 0x60, 0x8F, 0xF6, 0x09, 0x90, 0xB5]], + [[0x05, 0x06, 0x07, 0x08, 0x09], [0x19, 0x13, 0x50, 0x20, 0x70, 0x40, 0x2E, 0x09]], + [[0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B], [0xA8, 0x23, 0x40, 0xC6, 0x17, 0xA6, 0x31, 0x4A]], + [[0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D], [0x36, 0x62, 0xF2, 0x99, 0x68, 0xD4, 0xBF, 0x7C]], + [[0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F], [0x83, 0x25, 0x79, 0x06, 0x54, 0xA4, 0x44, 0xD9, 0x08, 0x6F, 0x9A, 0x1D, 0x74, 0xC9, 0x4D, 0x4E]]]; + testvectors[2] = [[[0x01], [0x83, 0x68, 0xE4, 0x9C, 0x84, 0xCC, 0xCB, 0xF0]], + [[0x02, 0x03], [0xBB, 0xA8, 0x0B, 0x66, 0x1B, 0x62, 0xC4, 0xC8]], + [[0x03, 0x04, 0x05], [0x9A, 0xD7, 0x5A, 0x24, 0xFD, 0x3F, 0xBF, 0x22]], + [[0x04, 0x05, 0x06, 0x07], [0x14, 0x4E, 0x68, 0x6D, 0x2E, 0xC1, 0xB7, 0x52]], + [[0x05, 0x06, 0x07, 0x08, 0x09], [0x12, 0x0A, 0x51, 0x08, 0xF9, 0xA3, 0x03, 0x74]], + [[0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B], [0xB2, 0x07, 0xD1, 0x05, 0xF6, 0x67, 0xAF, 0xBA]], + [[0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D], [0xCA, 0x59, 0x61, 0x3A, 0x83, 0x23, 0x26, 0xDD]], + [[0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F], [0x83, 0x25, 0x79, 0x06, 0x54, 0xA4, 0x44, 0xD9]]]; + + var des = new openpgp.crypto.cipher.des(key); + + for (var padding = 0; padding < 3; padding++) { + var thisVectorSet = testvectors[padding]; + + for (var i = 0; i < thisVectorSet.length; i++) { + var encrypted = des.encrypt(thisVectorSet[i][0], padding); + var decrypted = des.decrypt(encrypted, padding); + + expect(util.bin2str(encrypted), 'vector with block [' + util.hexidump(thisVectorSet[i][0]) + + '] and key [' + util.hexstrdump(util.Uint8Array2str(key)) + + '] and padding [' + padding + + '] should be ' + util.hexidump(thisVectorSet[i][1]) + + ' - Actually [' + util.hexidump(encrypted) + + ']').to.equal(util.bin2str(thisVectorSet[i][1])); + expect(util.bin2str(decrypted), 'vector with block [' + util.hexidump(thisVectorSet[i][0]) + + '] and key [' + util.hexstrdump(util.Uint8Array2str(key)) + + '] and padding [' + padding + + '] should be ' + util.hexidump(thisVectorSet[i][0]) + + ' - Actually [' + util.hexidump(decrypted) + + ']').to.equal(util.bin2str(thisVectorSet[i][0])); + } + } + done(); + }); +}); diff --git a/test/crypto/cipher/twofish.js b/test/crypto/cipher/twofish.js index 15bb95ee..723d4aa4 100644 --- a/test/crypto/cipher/twofish.js +++ b/test/crypto/cipher/twofish.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../dist/openpgp'); var util = openpgp.util, diff --git a/test/crypto/crypto.js b/test/crypto/crypto.js index ee1e852f..e9ad19d9 100644 --- a/test/crypto/crypto.js +++ b/test/crypto/crypto.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var chai = require('chai'); diff --git a/test/crypto/elliptic.js b/test/crypto/elliptic.js index 2c9ed482..70f8465f 100644 --- a/test/crypto/elliptic.js +++ b/test/crypto/elliptic.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var chai = require('chai'); diff --git a/test/crypto/hash/md5.js b/test/crypto/hash/md5.js index e5cace62..54e9dc42 100644 --- a/test/crypto/hash/md5.js +++ b/test/crypto/hash/md5.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../dist/openpgp'); var util = openpgp.util, diff --git a/test/crypto/hash/ripemd.js b/test/crypto/hash/ripemd.js index eca1afbb..8db2ba63 100644 --- a/test/crypto/hash/ripemd.js +++ b/test/crypto/hash/ripemd.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../dist/openpgp'); var util = openpgp.util, diff --git a/test/crypto/hash/sha.js b/test/crypto/hash/sha.js index e8647818..3d1cba29 100644 --- a/test/crypto/hash/sha.js +++ b/test/crypto/hash/sha.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../dist/openpgp'); var util = openpgp.util, diff --git a/test/crypto/pkcs5.js b/test/crypto/pkcs5.js index 2e078ffa..b2562c5f 100644 --- a/test/crypto/pkcs5.js +++ b/test/crypto/pkcs5.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var expect = require('chai').expect; diff --git a/test/crypto/random.js b/test/crypto/random.js index 4de1a9a9..e10bc3df 100644 --- a/test/crypto/random.js +++ b/test/crypto/random.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var chai = require('chai'), diff --git a/test/general/armor.js b/test/general/armor.js index 6aef929d..9f56b684 100644 --- a/test/general/armor.js +++ b/test/general/armor.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var chai = require('chai'), @@ -338,4 +336,4 @@ describe("ASCII armor", function() { }); - + diff --git a/test/general/ecc_nist.js b/test/general/ecc_nist.js index 59cc26e4..fa4adbbc 100644 --- a/test/general/ecc_nist.js +++ b/test/general/ecc_nist.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var chai = require('chai'); diff --git a/test/general/hkp.js b/test/general/hkp.js index 4d0df07f..2e2ce2f5 100644 --- a/test/general/hkp.js +++ b/test/general/hkp.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var chai = require('chai'), diff --git a/test/general/key.js b/test/general/key.js index 22a7afd8..38ccfd98 100644 --- a/test/general/key.js +++ b/test/general/key.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var chai = require('chai'); diff --git a/test/general/keyring.js b/test/general/keyring.js index 67394380..e135ce83 100644 --- a/test/general/keyring.js +++ b/test/general/keyring.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var keyring = new openpgp.Keyring(), diff --git a/test/general/oid.js b/test/general/oid.js index b4f4e68a..fe0fe85b 100644 --- a/test/general/oid.js +++ b/test/general/oid.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var expect = require('chai').expect; diff --git a/test/general/openpgp.js b/test/general/openpgp.js index 0990f3b3..b9943d9b 100644 --- a/test/general/openpgp.js +++ b/test/general/openpgp.js @@ -1,7 +1,5 @@ /* globals tryTests: true */ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var sinon = require('sinon'), diff --git a/test/general/packet.js b/test/general/packet.js index e5637348..37c692f4 100644 --- a/test/general/packet.js +++ b/test/general/packet.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var chai = require('chai'); @@ -307,7 +305,7 @@ describe("Packet", function() { var msg = new openpgp.packet.List(); msg.read(openpgp.armor.decode(armored_msg).data); - msg[0].decrypt(key).then(() => { + msg[0].decrypt(key).then(() => { msg[1].decrypt(msg[0].sessionKeyAlgorithm, msg[0].sessionKey); var text = stringify(msg[1].packets[0].packets[0].data); diff --git a/test/general/signature.js b/test/general/signature.js index b8126c99..0c399121 100644 --- a/test/general/signature.js +++ b/test/general/signature.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var chai = require('chai'); diff --git a/test/general/util.js b/test/general/util.js index b3b6a72d..3db13100 100644 --- a/test/general/util.js +++ b/test/general/util.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var chai = require('chai'), diff --git a/test/general/x25519.js b/test/general/x25519.js index da89aa2e..1419d69b 100644 --- a/test/general/x25519.js +++ b/test/general/x25519.js @@ -1,5 +1,3 @@ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var elliptic = openpgp.crypto.publicKey.elliptic; diff --git a/test/worker/async_proxy.js b/test/worker/async_proxy.js index 8968658d..5e781bcf 100644 --- a/test/worker/async_proxy.js +++ b/test/worker/async_proxy.js @@ -1,7 +1,5 @@ /* globals tryTests: true */ -'use strict'; - var openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); var chai = require('chai'),