summaryrefslogtreecommitdiff
path: root/school/node_modules/node-forge/nodejs/test
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-02-23 19:34:56 +0100
committerMinteck <contact@minteck.org>2023-02-23 19:34:56 +0100
commit3d1cd02f27518f1a04374c7c8320cd5d82ede6e9 (patch)
tree75be5fba4368472fb11c8015aee026b2b9a71888 /school/node_modules/node-forge/nodejs/test
parent8cc1f13c17fa2fb5a4410542d39e650e02945634 (diff)
downloadpluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.gz
pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.bz2
pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.zip
Updated 40 files, added 37 files, deleted 1103 files and renamed 3905 files (automated)
Diffstat (limited to 'school/node_modules/node-forge/nodejs/test')
-rw-r--r--school/node_modules/node-forge/nodejs/test/aes.js1498
-rw-r--r--school/node_modules/node-forge/nodejs/test/asn1.js262
-rw-r--r--school/node_modules/node-forge/nodejs/test/browser.js41
-rw-r--r--school/node_modules/node-forge/nodejs/test/csr.js148
-rw-r--r--school/node_modules/node-forge/nodejs/test/des.js155
-rw-r--r--school/node_modules/node-forge/nodejs/test/hmac.js85
-rw-r--r--school/node_modules/node-forge/nodejs/test/kem.js198
-rw-r--r--school/node_modules/node-forge/nodejs/test/md5.js117
-rw-r--r--school/node_modules/node-forge/nodejs/test/mgf1.js39
-rw-r--r--school/node_modules/node-forge/nodejs/test/pbkdf2.js140
-rw-r--r--school/node_modules/node-forge/nodejs/test/pem.js104
-rw-r--r--school/node_modules/node-forge/nodejs/test/pkcs1.js1105
-rw-r--r--school/node_modules/node-forge/nodejs/test/pkcs12.js687
-rw-r--r--school/node_modules/node-forge/nodejs/test/pkcs7.js350
-rw-r--r--school/node_modules/node-forge/nodejs/test/random.js70
-rw-r--r--school/node_modules/node-forge/nodejs/test/rc2.js109
-rw-r--r--school/node_modules/node-forge/nodejs/test/rsa.js602
-rw-r--r--school/node_modules/node-forge/nodejs/test/sha1.js75
-rw-r--r--school/node_modules/node-forge/nodejs/test/sha256.js81
-rw-r--r--school/node_modules/node-forge/nodejs/test/sha512.js174
-rw-r--r--school/node_modules/node-forge/nodejs/test/ssh.js193
-rw-r--r--school/node_modules/node-forge/nodejs/test/tls.js191
-rw-r--r--school/node_modules/node-forge/nodejs/test/util.js406
-rw-r--r--school/node_modules/node-forge/nodejs/test/x509.js734
24 files changed, 0 insertions, 7564 deletions
diff --git a/school/node_modules/node-forge/nodejs/test/aes.js b/school/node_modules/node-forge/nodejs/test/aes.js
deleted file mode 100644
index 6d8b221..0000000
--- a/school/node_modules/node-forge/nodejs/test/aes.js
+++ /dev/null
@@ -1,1498 +0,0 @@
-(function() {
-
-function Tests(ASSERT, CIPHER, AES, UTIL) {
- describe('aes', function() {
- it('should encrypt a single block with a 128-bit key', function() {
- var key = [0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f];
- var block = [0x00112233, 0x44556677, 0x8899aabb, 0xccddeeff];
-
- var output = [];
- var w = AES._expandKey(key, false);
- AES._updateBlock(w, block, output, false);
-
- var out = UTIL.createBuffer();
- out.putInt32(output[0]);
- out.putInt32(output[1]);
- out.putInt32(output[2]);
- out.putInt32(output[3]);
-
- ASSERT.equal(out.toHex(), '69c4e0d86a7b0430d8cdb78070b4c55a');
- });
-
- it('should decrypt a single block with a 128-bit key', function() {
- var key = [0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f];
- var block = [0x69c4e0d8, 0x6a7b0430, 0xd8cdb780, 0x70b4c55a];
-
- var output = [];
- var w = AES._expandKey(key, true);
- AES._updateBlock(w, block, output, true);
-
- var out = UTIL.createBuffer();
- out.putInt32(output[0]);
- out.putInt32(output[1]);
- out.putInt32(output[2]);
- out.putInt32(output[3]);
-
- ASSERT.equal(out.toHex(), '00112233445566778899aabbccddeeff');
- });
-
- it('should encrypt a single block with a 192-bit key', function() {
- var key = [
- 0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f,
- 0x10111213, 0x14151617];
- var block = [0x00112233, 0x44556677, 0x8899aabb, 0xccddeeff];
-
- var output = [];
- var w = AES._expandKey(key, false);
- AES._updateBlock(w, block, output, false);
-
- var out = UTIL.createBuffer();
- out.putInt32(output[0]);
- out.putInt32(output[1]);
- out.putInt32(output[2]);
- out.putInt32(output[3]);
-
- ASSERT.equal(out.toHex(), 'dda97ca4864cdfe06eaf70a0ec0d7191');
- });
-
- it('should decrypt a single block with a 192-bit key', function() {
- var key = [
- 0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f,
- 0x10111213, 0x14151617];
- var block = [0xdda97ca4, 0x864cdfe0, 0x6eaf70a0, 0xec0d7191];
-
- var output = [];
- var w = AES._expandKey(key, true);
- AES._updateBlock(w, block, output, true);
-
- var out = UTIL.createBuffer();
- out.putInt32(output[0]);
- out.putInt32(output[1]);
- out.putInt32(output[2]);
- out.putInt32(output[3]);
-
- ASSERT.equal(out.toHex(), '00112233445566778899aabbccddeeff');
- });
-
- it('should encrypt a single block with a 256-bit key', function() {
- var key = [
- 0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f,
- 0x10111213, 0x14151617, 0x18191a1b, 0x1c1d1e1f];
- var block = [0x00112233, 0x44556677, 0x8899aabb, 0xccddeeff];
-
- var output = [];
- var w = AES._expandKey(key, false);
- AES._updateBlock(w, block, output, false);
-
- var out = UTIL.createBuffer();
- out.putInt32(output[0]);
- out.putInt32(output[1]);
- out.putInt32(output[2]);
- out.putInt32(output[3]);
-
- ASSERT.equal(out.toHex(), '8ea2b7ca516745bfeafc49904b496089');
- });
-
- it('should decrypt a single block with a 256-bit key', function() {
- var key = [
- 0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f,
- 0x10111213, 0x14151617, 0x18191a1b, 0x1c1d1e1f];
- var block = [0x8ea2b7ca, 0x516745bf, 0xeafc4990, 0x4b496089];
-
- var output = [];
- var w = AES._expandKey(key, true);
- AES._updateBlock(w, block, output, true);
-
- var out = UTIL.createBuffer();
- out.putInt32(output[0]);
- out.putInt32(output[1]);
- out.putInt32(output[2]);
- out.putInt32(output[3]);
-
- ASSERT.equal(out.toHex(), '00112233445566778899aabbccddeeff');
- });
-
- // AES-128-ECB
- (function() {
- var keys = [
- '2b7e151628aed2a6abf7158809cf4f3c',
- '2b7e151628aed2a6abf7158809cf4f3c',
- '2b7e151628aed2a6abf7158809cf4f3c',
- '2b7e151628aed2a6abf7158809cf4f3c'
- ];
-
- var inputs = [
- '6bc1bee22e409f96e93d7e117393172a',
- 'ae2d8a571e03ac9c9eb76fac45af8e51',
- '30c81c46a35ce411e5fbc1191a0a52ef',
- 'f69f2445df4f9b17ad2b417be66c3710'
- ];
-
- var outputs = [
- '3ad77bb40d7a3660a89ecaf32466ef97',
- 'f5d3d58503b9699de785895a96fdbaaf',
- '43b1cd7f598ece23881b00e3ed030688',
- '7b0c785e27e8ad3f8223207104725dd4'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-128-ecb encrypt: ' + inputs[i], function() {
- // encrypt w/no padding
- var cipher = CIPHER.createCipher('AES-ECB', key);
- cipher.mode.pad = false;
- cipher.start();
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-128-ecb decrypt: ' + outputs[i], function() {
- // decrypt w/no padding
- var cipher = CIPHER.createDecipher('AES-ECB', key);
- cipher.mode.unpad = false;
- cipher.start();
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-192-ECB
- (function() {
- var keys = [
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b',
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b',
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b',
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b'
- ];
-
- var inputs = [
- '6bc1bee22e409f96e93d7e117393172a',
- 'ae2d8a571e03ac9c9eb76fac45af8e51',
- '30c81c46a35ce411e5fbc1191a0a52ef',
- 'f69f2445df4f9b17ad2b417be66c3710'
- ];
-
- var outputs = [
- 'bd334f1d6e45f25ff712a214571fa5cc',
- '974104846d0ad3ad7734ecb3ecee4eef',
- 'ef7afd2270e2e60adce0ba2face6444e',
- '9a4b41ba738d6c72fb16691603c18e0e'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-192-ecb encrypt: ' + inputs[i], function() {
- // encrypt w/no padding
- var cipher = CIPHER.createCipher('AES-ECB', key);
- cipher.mode.pad = false;
- cipher.start();
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-192-ecb decrypt: ' + outputs[i], function() {
- // decrypt w/no padding
- var cipher = CIPHER.createDecipher('AES-ECB', key);
- cipher.mode.unpad = false;
- cipher.start();
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-256-ECB
- (function() {
- var keys = [
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4',
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4',
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4',
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4'
- ];
-
- var inputs = [
- '6bc1bee22e409f96e93d7e117393172a',
- 'ae2d8a571e03ac9c9eb76fac45af8e51',
- '30c81c46a35ce411e5fbc1191a0a52ef',
- 'f69f2445df4f9b17ad2b417be66c3710'
- ];
-
- var outputs = [
- 'f3eed1bdb5d2a03c064b5a7e3db181f8',
- '591ccb10d410ed26dc5ba74a31362870',
- 'b6ed21b99ca6f4f9f153e7b1beafed1d',
- '23304b7a39f9f3ff067d8d8f9e24ecc7'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-256-ecb encrypt: ' + inputs[i], function() {
- // encrypt w/no padding
- var cipher = CIPHER.createCipher('AES-ECB', key);
- cipher.mode.pad = false;
- cipher.start();
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-256-ecb decrypt: ' + outputs[i], function() {
- // decrypt w/no padding
- var cipher = CIPHER.createDecipher('AES-ECB', key);
- cipher.mode.unpad = false;
- cipher.start();
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-128-CBC
- (function() {
- var keys = [
- '06a9214036b8a15b512e03d534120006',
- 'c286696d887c9aa0611bbb3e2025a45a',
- '6c3ea0477630ce21a2ce334aa746c2cd',
- '56e47a38c5598974bc46903dba290349'
- ];
-
- var ivs = [
- '3dafba429d9eb430b422da802c9fac41',
- '562e17996d093d28ddb3ba695a2e6f58',
- 'c782dc4c098c66cbd9cd27d825682c81',
- '8ce82eefbea0da3c44699ed7db51b7d9'
- ];
-
- var inputs = [
- 'Single block msg',
- '000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f',
- 'This is a 48-byte message (exactly 3 AES blocks)',
- 'a0a1a2a3a4a5a6a7a8a9aaabacadaeaf' +
- 'b0b1b2b3b4b5b6b7b8b9babbbcbdbebf' +
- 'c0c1c2c3c4c5c6c7c8c9cacbcccdcecf' +
- 'd0d1d2d3d4d5d6d7d8d9dadbdcdddedf'
- ];
-
- var outputs = [
- 'e353779c1079aeb82708942dbe77181a',
- 'd296cd94c2cccf8a3a863028b5e1dc0a7586602d253cfff91b8266bea6d61ab1',
- 'd0a02b3836451753d493665d33f0e886' +
- '2dea54cdb293abc7506939276772f8d5' +
- '021c19216bad525c8579695d83ba2684',
- 'c30e32ffedc0774e6aff6af0869f71aa' +
- '0f3af07a9a31a9c684db207eb0ef8e4e' +
- '35907aa632c3ffdf868bb7b29d3d46ad' +
- '83ce9f9a102ee99d49a53e87f4c3da55'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var input = (i & 1) ? UTIL.hexToBytes(inputs[i]) : inputs[i];
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-128-cbc encrypt: ' + inputs[i], function() {
- // encrypt w/no padding
- var cipher = CIPHER.createCipher('AES-CBC', key);
- cipher.mode.pad = false;
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-128-cbc decrypt: ' + outputs[i], function() {
- // decrypt w/no padding
- var cipher = CIPHER.createDecipher('AES-CBC', key);
- cipher.mode.unpad = false;
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- var out = (i & 1) ? cipher.output.toHex() : cipher.output.bytes();
- ASSERT.equal(out, inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-192-CBC
- (function() {
- var keys = [
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b',
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b',
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b',
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b'
- ];
-
- var ivs = [
- '000102030405060708090A0B0C0D0E0F',
- '4F021DB243BC633D7178183A9FA071E8',
- 'B4D9ADA9AD7DEDF4E5E738763F69145A',
- '571B242012FB7AE07FA9BAAC3DF102E0'
- ];
-
- var inputs = [
- '6bc1bee22e409f96e93d7e117393172a',
- 'ae2d8a571e03ac9c9eb76fac45af8e51',
- '30c81c46a35ce411e5fbc1191a0a52ef',
- 'f69f2445df4f9b17ad2b417be66c3710'
- ];
-
- var outputs = [
- '4f021db243bc633d7178183a9fa071e8',
- 'b4d9ada9ad7dedf4e5e738763f69145a',
- '571b242012fb7ae07fa9baac3df102e0',
- '08b0e27988598881d920a9e64f5615cd'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-192-cbc encrypt: ' + inputs[i], function() {
- // encrypt w/no padding
- var cipher = CIPHER.createCipher('AES-CBC', key);
- cipher.mode.pad = false;
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-192-cbc decrypt: ' + outputs[i], function() {
- // decrypt w/no padding
- var cipher = CIPHER.createDecipher('AES-CBC', key);
- cipher.mode.unpad = false;
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- var out = cipher.output.toHex();
- ASSERT.equal(out, inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-256-CBC
- (function() {
- var keys = [
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4',
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4',
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4',
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4'
- ];
-
- var ivs = [
- '000102030405060708090A0B0C0D0E0F',
- 'F58C4C04D6E5F1BA779EABFB5F7BFBD6',
- '9CFC4E967EDB808D679F777BC6702C7D',
- '39F23369A9D9BACFA530E26304231461'
- ];
-
- var inputs = [
- '6bc1bee22e409f96e93d7e117393172a',
- 'ae2d8a571e03ac9c9eb76fac45af8e51',
- '30c81c46a35ce411e5fbc1191a0a52ef',
- 'f69f2445df4f9b17ad2b417be66c3710'
- ];
-
- var outputs = [
- 'f58c4c04d6e5f1ba779eabfb5f7bfbd6',
- '9cfc4e967edb808d679f777bc6702c7d',
- '39f23369a9d9bacfa530e26304231461',
- 'b2eb05e2c39be9fcda6c19078c6a9d1b'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-256-cbc encrypt: ' + inputs[i], function() {
- // encrypt w/no padding
- var cipher = CIPHER.createCipher('AES-CBC', key);
- cipher.mode.pad = false;
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-256-cbc decrypt: ' + outputs[i], function() {
- // decrypt w/no padding
- var cipher = CIPHER.createDecipher('AES-CBC', key);
- cipher.mode.unpad = false;
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- var out = cipher.output.toHex();
- ASSERT.equal(out, inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-128-CFB
- (function() {
- var keys = [
- '00000000000000000000000000000000',
- '2b7e151628aed2a6abf7158809cf4f3c',
- '2b7e151628aed2a6abf7158809cf4f3c',
- '2b7e151628aed2a6abf7158809cf4f3c',
- '2b7e151628aed2a6abf7158809cf4f3c',
- '00000000000000000000000000000000'
- ];
-
- var ivs = [
- '80000000000000000000000000000000',
- '000102030405060708090a0b0c0d0e0f',
- '3B3FD92EB72DAD20333449F8E83CFB4A',
- 'C8A64537A0B3A93FCDE3CDAD9F1CE58B',
- '26751F67A3CBB140B1808CF187A4F4DF',
- '60f9ff04fac1a25657bf5b36b5efaf75'
- ];
-
- var inputs = [
- '00000000000000000000000000000000',
- '6bc1bee22e409f96e93d7e117393172a',
- 'ae2d8a571e03ac9c9eb76fac45af8e51',
- '30c81c46a35ce411e5fbc1191a0a52ef',
- 'f69f2445df4f9b17ad2b417be66c3710',
- 'This is a 48-byte message (exactly 3 AES blocks)'
- ];
-
- var outputs = [
- '3ad78e726c1ec02b7ebfe92b23d9ec34',
- '3b3fd92eb72dad20333449f8e83cfb4a',
- 'c8a64537a0b3a93fcde3cdad9f1ce58b',
- '26751f67a3cbb140b1808cf187a4f4df',
- 'c04b05357c5d1c0eeac4c66f9ff7f2e6',
- '52396a2ba1ba420c5e5b699a814944d8' +
- 'f4e7fbf984a038319fbc0b4ee45cfa6f' +
- '07b2564beab5b5e92dbd44cb345f49b4'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var input = (i !== 5) ? UTIL.hexToBytes(inputs[i]) : inputs[i];
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-128-cfb encrypt: ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-CFB', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-128-cfb decrypt: ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-CFB', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- var out = (i !== 5) ?
- cipher.output.toHex() : cipher.output.getBytes();
- ASSERT.equal(out, inputs[i]);
- });
-
- it('should aes-128-cfb encrypt (one byte at a time): ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-CFB', key);
- cipher.start({iv: iv});
- var input_ = UTIL.createBuffer(input);
- var out = UTIL.createBuffer();
- while(input_.length() > 0) {
- cipher.update(UTIL.createBuffer(input_.getBytes(1)));
- ASSERT.equal(cipher.output.length(), 1);
- out.putByte(cipher.output.getByte());
- }
- cipher.finish();
- ASSERT.equal(out.toHex(), outputs[i]);
- });
-
- it('should aes-128-cfb decrypt (one byte at a time): ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-CFB', key);
- cipher.start({iv: iv});
- var output_ = UTIL.createBuffer(output);
- var out = UTIL.createBuffer();
- while(output_.length() > 0) {
- cipher.update(UTIL.createBuffer(output_.getBytes(1)));
- ASSERT.equal(cipher.output.length(), 1);
- out.putByte(cipher.output.getByte());
- }
- cipher.finish();
- out = (i !== 5) ? out.toHex() : out.getBytes();
- ASSERT.equal(out, inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-192-CFB
- (function() {
- var keys = [
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b',
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b',
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b',
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b'
- ];
-
- var ivs = [
- '000102030405060708090A0B0C0D0E0F',
- 'CDC80D6FDDF18CAB34C25909C99A4174',
- '67CE7F7F81173621961A2B70171D3D7A',
- '2E1E8A1DD59B88B1C8E60FED1EFAC4C9'
- ];
-
- var inputs = [
- '6bc1bee22e409f96e93d7e117393172a',
- 'ae2d8a571e03ac9c9eb76fac45af8e51',
- '30c81c46a35ce411e5fbc1191a0a52ef',
- 'f69f2445df4f9b17ad2b417be66c3710'
- ];
-
- var outputs = [
- 'cdc80d6fddf18cab34c25909c99a4174',
- '67ce7f7f81173621961a2b70171d3d7a',
- '2e1e8a1dd59b88b1c8e60fed1efac4c9',
- 'c05f9f9ca9834fa042ae8fba584b09ff'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-192-cfb encrypt: ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-CFB', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-192-cfb decrypt: ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-CFB', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- var out = cipher.output.toHex();
- ASSERT.equal(out, inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-256-CFB
- (function() {
- var keys = [
- '861009ec4d599fab1f40abc76e6f89880cff5833c79c548c99f9045f191cd90b'
- ];
-
- var ivs = [
- 'd927ad81199aa7dcadfdb4e47b6dc694'
- ];
-
- var inputs = [
- 'MY-DATA-AND-HERE-IS-MORE-DATA'
- ];
-
- var outputs = [
- '80eb666a9fc9e263faf71e87ffc94451d7d8df7cfcf2606470351dd5ac'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var input = inputs[i];
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-256-cfb encrypt: ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-CFB', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-256-cfb decrypt: ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-CFB', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- var out = cipher.output.getBytes();
- ASSERT.equal(out, inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-128-OFB
- (function() {
- var keys = [
- '00000000000000000000000000000000',
- '00000000000000000000000000000000',
- '00000000000000000000000000000000'
- ];
-
- var ivs = [
- '80000000000000000000000000000000',
- 'c8ca0d6a35dbeac776e911ee16bea7d3',
- '80000000000000000000000000000000'
- ];
-
- var inputs = [
- '00000000000000000000000000000000',
- 'This is a 48-byte message (exactly 3 AES blocks)',
- '0000'
- ];
-
- var outputs = [
- '3ad78e726c1ec02b7ebfe92b23d9ec34',
- '39c0190727a76b2a90963426f63689cf' +
- 'cdb8a2be8e20c5e877a81a724e3611f6' +
- '2ecc386f2e941b2441c838906002be19',
- '3ad7'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var input = (i !== 1) ? UTIL.hexToBytes(inputs[i]) : inputs[i];
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-128-ofb encrypt: ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-OFB', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-128-ofb decrypt: ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-OFB', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- var out = (i !== 1) ?
- cipher.output.toHex() : cipher.output.getBytes();
- ASSERT.equal(out, inputs[i]);
- });
-
- it('should aes-128-ofb encrypt (one byte at a time): ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-OFB', key);
- cipher.start({iv: iv});
- var input_ = UTIL.createBuffer(input);
- var out = UTIL.createBuffer();
- while(input_.length() > 0) {
- cipher.update(UTIL.createBuffer(input_.getBytes(1)));
- ASSERT.equal(cipher.output.length(), 1);
- out.putByte(cipher.output.getByte());
- }
- cipher.finish();
- ASSERT.equal(out.toHex(), outputs[i]);
- });
-
- it('should aes-128-ofb decrypt (one byte at a time): ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-OFB', key);
- cipher.start({iv: iv});
- var output_ = UTIL.createBuffer(output);
- var out = UTIL.createBuffer();
- while(output_.length() > 0) {
- cipher.update(UTIL.createBuffer(output_.getBytes(1)));
- ASSERT.equal(cipher.output.length(), 1);
- out.putByte(cipher.output.getByte());
- }
- cipher.finish();
- out = (i !== 1) ? out.toHex() : out.getBytes();
- ASSERT.equal(out, inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-192-OFB
- (function() {
- var keys = [
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b',
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b',
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b',
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b'
- ];
-
- var ivs = [
- '000102030405060708090A0B0C0D0E0F',
- 'A609B38DF3B1133DDDFF2718BA09565E',
- '52EF01DA52602FE0975F78AC84BF8A50',
- 'BD5286AC63AABD7EB067AC54B553F71D'
- ];
-
- var inputs = [
- '6bc1bee22e409f96e93d7e117393172a',
- 'ae2d8a571e03ac9c9eb76fac45af8e51',
- '30c81c46a35ce411e5fbc1191a0a52ef',
- 'f69f2445df4f9b17ad2b417be66c3710'
- ];
-
- var outputs = [
- 'cdc80d6fddf18cab34c25909c99a4174',
- 'fcc28b8d4c63837c09e81700c1100401',
- '8d9a9aeac0f6596f559c6d4daf59a5f2',
- '6d9f200857ca6c3e9cac524bd9acc92a'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-192-ofb encrypt: ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-OFB', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-192-ofb decrypt: ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-OFB', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- var out = cipher.output.toHex();
- ASSERT.equal(out, inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-256-OFB
- (function() {
- var keys = [
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4',
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4',
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4',
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4'
- ];
-
- var ivs = [
- '000102030405060708090A0B0C0D0E0F',
- 'B7BF3A5DF43989DD97F0FA97EBCE2F4A',
- 'E1C656305ED1A7A6563805746FE03EDC',
- '41635BE625B48AFC1666DD42A09D96E7'
- ];
-
- var inputs = [
- '6bc1bee22e409f96e93d7e117393172a',
- 'ae2d8a571e03ac9c9eb76fac45af8e51',
- '30c81c46a35ce411e5fbc1191a0a52ef',
- 'f69f2445df4f9b17ad2b417be66c3710'
- ];
-
- var outputs = [
- 'dc7e84bfda79164b7ecd8486985d3860',
- '4febdc6740d20b3ac88f6ad82a4fb08d',
- '71ab47a086e86eedf39d1c5bba97c408',
- '0126141d67f37be8538f5a8be740e484'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-256-ofb encrypt: ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-OFB', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-256-ofb decrypt: ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-OFB', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- var out = cipher.output.toHex();
- ASSERT.equal(out, inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-128-CTR
- (function() {
- var keys = [
- '2b7e151628aed2a6abf7158809cf4f3c',
- '00000000000000000000000000000000',
- '2b7e151628aed2a6abf7158809cf4f3c'
- ];
-
- var ivs = [
- 'f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff',
- '650cdb80ff9fc758342d2bd99ee2abcf',
- 'f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff'
- ];
-
- var inputs = [
- '6bc1bee22e409f96e93d7e117393172a',
- 'This is a 48-byte message (exactly 3 AES blocks)',
- '6bc1be'
- ];
-
- var outputs = [
- '874d6191b620e3261bef6864990db6ce',
- '5ede11d00e9a76ec1d5e7e811ea3dd1c' +
- 'e09ee941210f825d35718d3282796f1c' +
- '07c3f1cb424f2b365766ab5229f5b5a4',
- '874d61'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var input = (i !== 1) ? UTIL.hexToBytes(inputs[i]) : inputs[i];
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-128-ctr encrypt: ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-CTR', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-128-ctr decrypt: ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-CTR', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- var out = (i !== 1) ?
- cipher.output.toHex() : cipher.output.getBytes();
- ASSERT.equal(out, inputs[i]);
- });
-
- it('should aes-128-ctr encrypt (one byte at a time): ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-CTR', key);
- cipher.start({iv: iv});
- var input_ = UTIL.createBuffer(input);
- var out = UTIL.createBuffer();
- while(input_.length() > 0) {
- cipher.update(UTIL.createBuffer(input_.getBytes(1)));
- ASSERT.equal(cipher.output.length(), 1);
- out.putByte(cipher.output.getByte());
- }
- cipher.finish();
- ASSERT.equal(out.toHex(), outputs[i]);
- });
-
- it('should aes-128-ctr decrypt (one byte at a time): ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-CTR', key);
- cipher.start({iv: iv});
- var output_ = UTIL.createBuffer(output);
- var out = UTIL.createBuffer();
- while(output_.length() > 0) {
- cipher.update(UTIL.createBuffer(output_.getBytes(1)));
- ASSERT.equal(cipher.output.length(), 1);
- out.putByte(cipher.output.getByte());
- }
- cipher.finish();
- out = (i !== 1) ? out.toHex() : out.getBytes();
- ASSERT.equal(out, inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-192-CTR
- (function() {
- var keys = [
- '8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b'
- ];
-
- var ivs = [
- 'f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff'
- ];
-
- var inputs = [
- '6bc1bee22e409f96e93d7e117393172a' +
- 'ae2d8a571e03ac9c9eb76fac45af8e51' +
- '30c81c46a35ce411e5fbc1191a0a52ef' +
- 'f69f2445df4f9b17ad2b417be66c3710'
- ];
-
- var outputs = [
- '1abc932417521ca24f2b0459fe7e6e0b' +
- '090339ec0aa6faefd5ccc2c6f4ce8e94' +
- '1e36b26bd1ebc670d1bd1d665620abf7' +
- '4f78a7f6d29809585a97daec58c6b050'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-192-ctr encrypt: ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-CTR', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-192-ctr decrypt: ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-CTR', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- var out = cipher.output.toHex();
- ASSERT.equal(out, inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-256-CTR
- (function() {
- var keys = [
- '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4'
- ];
-
- var ivs = [
- 'f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff'
- ];
-
- var inputs = [
- '6bc1bee22e409f96e93d7e117393172a' +
- 'ae2d8a571e03ac9c9eb76fac45af8e51' +
- '30c81c46a35ce411e5fbc1191a0a52ef' +
- 'f69f2445df4f9b17ad2b417be66c3710'
- ];
-
- var outputs = [
- '601ec313775789a5b7a7f504bbf3d228' +
- 'f443e3ca4d62b59aca84e990cacaf5c5' +
- '2b0930daa23de94ce87017ba2d84988d' +
- 'dfc9c58db67aada613c2dd08457941a6'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-256-ctr encrypt: ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-CTR', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- });
-
- it('should aes-256-ctr decrypt: ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-CTR', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer(output));
- cipher.finish();
- var out = cipher.output.toHex();
- ASSERT.equal(out, inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-128-GCM
- (function() {
- var keys = [
- '00000000000000000000000000000000',
- '00000000000000000000000000000000',
- 'feffe9928665731c6d6a8f9467308308',
- 'feffe9928665731c6d6a8f9467308308',
- 'feffe9928665731c6d6a8f9467308308',
- 'feffe9928665731c6d6a8f9467308308',
- '00000000000000000000000000000000'
- ];
-
- var ivs = [
- '000000000000000000000000',
- '000000000000000000000000',
- 'cafebabefacedbaddecaf888',
- 'cafebabefacedbaddecaf888',
- 'cafebabefacedbad',
- '9313225df88406e555909c5aff5269aa' +
- '6a7a9538534f7da1e4c303d2a318a728' +
- 'c3c0c95156809539fcf0e2429a6b5254' +
- '16aedbf5a0de6a57a637b39b',
- '000000000000000000000000'
- ];
-
- var adatas = [
- '',
- '',
- '',
- 'feedfacedeadbeeffeedfacedeadbeef' +
- 'abaddad2',
- 'feedfacedeadbeeffeedfacedeadbeef' +
- 'abaddad2',
- 'feedfacedeadbeeffeedfacedeadbeef' +
- 'abaddad2',
- ''
- ];
-
- var inputs = [
- '',
- '00000000000000000000000000000000',
- 'd9313225f88406e5a55909c5aff5269a' +
- '86a7a9531534f7da2e4c303d8a318a72' +
- '1c3c0c95956809532fcf0e2449a6b525' +
- 'b16aedf5aa0de657ba637b391aafd255',
- 'd9313225f88406e5a55909c5aff5269a' +
- '86a7a9531534f7da2e4c303d8a318a72' +
- '1c3c0c95956809532fcf0e2449a6b525' +
- 'b16aedf5aa0de657ba637b39',
- 'd9313225f88406e5a55909c5aff5269a' +
- '86a7a9531534f7da2e4c303d8a318a72' +
- '1c3c0c95956809532fcf0e2449a6b525' +
- 'b16aedf5aa0de657ba637b39',
- 'd9313225f88406e5a55909c5aff5269a' +
- '86a7a9531534f7da2e4c303d8a318a72' +
- '1c3c0c95956809532fcf0e2449a6b525' +
- 'b16aedf5aa0de657ba637b39',
- '0000'
- ];
-
- var outputs = [
- '',
- '0388dace60b6a392f328c2b971b2fe78',
- '42831ec2217774244b7221b784d0d49c' +
- 'e3aa212f2c02a4e035c17e2329aca12e' +
- '21d514b25466931c7d8f6a5aac84aa05' +
- '1ba30b396a0aac973d58e091473f5985',
- '42831ec2217774244b7221b784d0d49c' +
- 'e3aa212f2c02a4e035c17e2329aca12e' +
- '21d514b25466931c7d8f6a5aac84aa05' +
- '1ba30b396a0aac973d58e091',
- '61353b4c2806934a777ff51fa22a4755' +
- '699b2a714fcdc6f83766e5f97b6c7423' +
- '73806900e49f24b22b097544d4896b42' +
- '4989b5e1ebac0f07c23f4598',
- '8ce24998625615b603a033aca13fb894' +
- 'be9112a5c3a211a8ba262a3cca7e2ca7' +
- '01e4a9a4fba43c90ccdcb281d48c7c6f' +
- 'd62875d2aca417034c34aee5',
- '0388'
- ];
-
- var tags = [
- '58e2fccefa7e3061367f1d57a4e7455a',
- 'ab6e47d42cec13bdf53a67b21257bddf',
- '4d5c2af327cd64a62cf35abd2ba6fab4',
- '5bc94fbc3221a5db94fae95ae7121a47',
- '3612d2e79e3b0785561be14aaca2fccb',
- '619cc5aefffe0bfa462af43c1699d050',
- '93dcdd26f79ec1dd9bff57204d9b33f5'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var adata = UTIL.hexToBytes(adatas[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-128-gcm encrypt: ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-GCM', key);
- cipher.start({iv: iv, additionalData: adata});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- ASSERT.equal(cipher.mode.tag.toHex(), tags[i]);
- });
-
- it('should aes-128-gcm decrypt: ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-GCM', key);
- cipher.start({
- iv: iv,
- additionalData: adata,
- tag: UTIL.hexToBytes(tags[i])
- });
- cipher.update(UTIL.createBuffer(output));
- var pass = cipher.finish();
- ASSERT.equal(cipher.mode.tag.toHex(), tags[i]);
- ASSERT.equal(pass, true);
- ASSERT.equal(cipher.output.toHex(), inputs[i]);
- });
-
- it('should aes-128-gcm encrypt (one byte at a time): ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-GCM', key);
- cipher.start({iv: iv, additionalData: adata});
- var input_ = UTIL.createBuffer(input);
- var out = UTIL.createBuffer();
- while(input_.length() > 0) {
- cipher.update(UTIL.createBuffer(input_.getBytes(1)));
- ASSERT.equal(cipher.output.length(), 1);
- out.putByte(cipher.output.getByte());
- }
- cipher.finish();
- ASSERT.equal(out.toHex(), outputs[i]);
- ASSERT.equal(cipher.mode.tag.toHex(), tags[i]);
- });
- })(i);
- }
- })();
-
- // AES-192-GCM
- (function() {
- var keys = [
- '00000000000000000000000000000000' +
- '0000000000000000',
- '00000000000000000000000000000000' +
- '0000000000000000',
- 'feffe9928665731c6d6a8f9467308308' +
- 'feffe9928665731c',
- 'feffe9928665731c6d6a8f9467308308' +
- 'feffe9928665731c',
- 'feffe9928665731c6d6a8f9467308308' +
- 'feffe9928665731c',
- 'feffe9928665731c6d6a8f9467308308' +
- 'feffe9928665731c'
- ];
-
- var ivs = [
- '000000000000000000000000',
- '000000000000000000000000',
- 'cafebabefacedbaddecaf888',
- 'cafebabefacedbaddecaf888',
- 'cafebabefacedbad',
- '9313225df88406e555909c5aff5269aa' +
- '6a7a9538534f7da1e4c303d2a318a728' +
- 'c3c0c95156809539fcf0e2429a6b5254' +
- '16aedbf5a0de6a57a637b39b'
- ];
-
- var adatas = [
- '',
- '',
- '',
- 'feedfacedeadbeeffeedfacedeadbeef' +
- 'abaddad2',
- 'feedfacedeadbeeffeedfacedeadbeef' +
- 'abaddad2',
- 'feedfacedeadbeeffeedfacedeadbeef' +
- 'abaddad2'
- ];
-
- var inputs = [
- '',
- '00000000000000000000000000000000',
- 'd9313225f88406e5a55909c5aff5269a' +
- '86a7a9531534f7da2e4c303d8a318a72' +
- '1c3c0c95956809532fcf0e2449a6b525' +
- 'b16aedf5aa0de657ba637b391aafd255',
- 'd9313225f88406e5a55909c5aff5269a' +
- '86a7a9531534f7da2e4c303d8a318a72' +
- '1c3c0c95956809532fcf0e2449a6b525' +
- 'b16aedf5aa0de657ba637b39',
- 'd9313225f88406e5a55909c5aff5269a' +
- '86a7a9531534f7da2e4c303d8a318a72' +
- '1c3c0c95956809532fcf0e2449a6b525' +
- 'b16aedf5aa0de657ba637b39',
- 'd9313225f88406e5a55909c5aff5269a' +
- '86a7a9531534f7da2e4c303d8a318a72' +
- '1c3c0c95956809532fcf0e2449a6b525' +
- 'b16aedf5aa0de657ba637b39'
- ];
-
- var outputs = [
- '',
- '98e7247c07f0fe411c267e4384b0f600',
- '3980ca0b3c00e841eb06fac4872a2757' +
- '859e1ceaa6efd984628593b40ca1e19c' +
- '7d773d00c144c525ac619d18c84a3f47' +
- '18e2448b2fe324d9ccda2710acade256',
- '3980ca0b3c00e841eb06fac4872a2757' +
- '859e1ceaa6efd984628593b40ca1e19c' +
- '7d773d00c144c525ac619d18c84a3f47' +
- '18e2448b2fe324d9ccda2710',
- '0f10f599ae14a154ed24b36e25324db8' +
- 'c566632ef2bbb34f8347280fc4507057' +
- 'fddc29df9a471f75c66541d4d4dad1c9' +
- 'e93a19a58e8b473fa0f062f7',
- 'd27e88681ce3243c4830165a8fdcf9ff' +
- '1de9a1d8e6b447ef6ef7b79828666e45' +
- '81e79012af34ddd9e2f037589b292db3' +
- 'e67c036745fa22e7e9b7373b'
- ];
-
- var tags = [
- 'cd33b28ac773f74ba00ed1f312572435',
- '2ff58d80033927ab8ef4d4587514f0fb',
- '9924a7c8587336bfb118024db8674a14',
- '2519498e80f1478f37ba55bd6d27618c',
- '65dcc57fcf623a24094fcca40d3533f8',
- 'dcf566ff291c25bbb8568fc3d376a6d9'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var adata = UTIL.hexToBytes(adatas[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-128-gcm encrypt: ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-GCM', key);
- cipher.start({iv: iv, additionalData: adata});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- ASSERT.equal(cipher.mode.tag.toHex(), tags[i]);
- });
-
- it('should aes-128-gcm decrypt: ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-GCM', key);
- cipher.start({
- iv: iv,
- additionalData: adata,
- tag: UTIL.hexToBytes(tags[i])
- });
- cipher.update(UTIL.createBuffer(output));
- var pass = cipher.finish();
- ASSERT.equal(cipher.mode.tag.toHex(), tags[i]);
- ASSERT.equal(pass, true);
- ASSERT.equal(cipher.output.toHex(), inputs[i]);
- });
- })(i);
- }
- })();
-
- // AES-256-GCM
- (function() {
- var keys = [
- '00000000000000000000000000000000' +
- '00000000000000000000000000000000',
- '00000000000000000000000000000000' +
- '00000000000000000000000000000000',
- 'feffe9928665731c6d6a8f9467308308' +
- 'feffe9928665731c6d6a8f9467308308',
- 'feffe9928665731c6d6a8f9467308308' +
- 'feffe9928665731c6d6a8f9467308308',
- 'feffe9928665731c6d6a8f9467308308' +
- 'feffe9928665731c6d6a8f9467308308',
- 'feffe9928665731c6d6a8f9467308308' +
- 'feffe9928665731c6d6a8f9467308308'
- ];
-
- var ivs = [
- '000000000000000000000000',
- '000000000000000000000000',
- 'cafebabefacedbaddecaf888',
- 'cafebabefacedbaddecaf888',
- 'cafebabefacedbad',
- '9313225df88406e555909c5aff5269aa' +
- '6a7a9538534f7da1e4c303d2a318a728' +
- 'c3c0c95156809539fcf0e2429a6b5254' +
- '16aedbf5a0de6a57a637b39b'
- ];
-
- var adatas = [
- '',
- '',
- '',
- 'feedfacedeadbeeffeedfacedeadbeef' +
- 'abaddad2',
- 'feedfacedeadbeeffeedfacedeadbeef' +
- 'abaddad2',
- 'feedfacedeadbeeffeedfacedeadbeef' +
- 'abaddad2'
- ];
-
- var inputs = [
- '',
- '00000000000000000000000000000000',
- 'd9313225f88406e5a55909c5aff5269a' +
- '86a7a9531534f7da2e4c303d8a318a72' +
- '1c3c0c95956809532fcf0e2449a6b525' +
- 'b16aedf5aa0de657ba637b391aafd255',
- 'd9313225f88406e5a55909c5aff5269a' +
- '86a7a9531534f7da2e4c303d8a318a72' +
- '1c3c0c95956809532fcf0e2449a6b525' +
- 'b16aedf5aa0de657ba637b39',
- 'd9313225f88406e5a55909c5aff5269a' +
- '86a7a9531534f7da2e4c303d8a318a72' +
- '1c3c0c95956809532fcf0e2449a6b525' +
- 'b16aedf5aa0de657ba637b39',
- 'd9313225f88406e5a55909c5aff5269a' +
- '86a7a9531534f7da2e4c303d8a318a72' +
- '1c3c0c95956809532fcf0e2449a6b525' +
- 'b16aedf5aa0de657ba637b39'
- ];
-
- var outputs = [
- '',
- 'cea7403d4d606b6e074ec5d3baf39d18',
- '522dc1f099567d07f47f37a32a84427d' +
- '643a8cdcbfe5c0c97598a2bd2555d1aa' +
- '8cb08e48590dbb3da7b08b1056828838' +
- 'c5f61e6393ba7a0abcc9f662898015ad',
- '522dc1f099567d07f47f37a32a84427d' +
- '643a8cdcbfe5c0c97598a2bd2555d1aa' +
- '8cb08e48590dbb3da7b08b1056828838' +
- 'c5f61e6393ba7a0abcc9f662',
- 'c3762df1ca787d32ae47c13bf19844cb' +
- 'af1ae14d0b976afac52ff7d79bba9de0' +
- 'feb582d33934a4f0954cc2363bc73f78' +
- '62ac430e64abe499f47c9b1f',
- '5a8def2f0c9e53f1f75d7853659e2a20' +
- 'eeb2b22aafde6419a058ab4f6f746bf4' +
- '0fc0c3b780f244452da3ebf1c5d82cde' +
- 'a2418997200ef82e44ae7e3f'
- ];
-
- var tags = [
- '530f8afbc74536b9a963b4f1c4cb738b',
- 'd0d1c8a799996bf0265b98b5d48ab919',
- 'b094dac5d93471bdec1a502270e3cc6c',
- '76fc6ece0f4e1768cddf8853bb2d551b',
- '3a337dbf46a792c45e454913fe2ea8f2',
- 'a44a8266ee1c8eb0c8b5d4cf5ae9f19a'
- ];
-
- for(var i = 0; i < keys.length; ++i) {
- (function(i) {
- var key = UTIL.hexToBytes(keys[i]);
- var iv = UTIL.hexToBytes(ivs[i]);
- var adata = UTIL.hexToBytes(adatas[i]);
- var input = UTIL.hexToBytes(inputs[i]);
- var output = UTIL.hexToBytes(outputs[i]);
-
- it('should aes-128-gcm encrypt: ' + inputs[i], function() {
- // encrypt
- var cipher = CIPHER.createCipher('AES-GCM', key);
- cipher.start({iv: iv, additionalData: adata});
- cipher.update(UTIL.createBuffer(input));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), outputs[i]);
- ASSERT.equal(cipher.mode.tag.toHex(), tags[i]);
- });
-
- it('should aes-128-gcm decrypt: ' + outputs[i], function() {
- // decrypt
- var cipher = CIPHER.createDecipher('AES-GCM', key);
- cipher.start({
- iv: iv,
- additionalData: adata,
- tag: UTIL.hexToBytes(tags[i])
- });
- cipher.update(UTIL.createBuffer(output));
- var pass = cipher.finish();
- ASSERT.equal(cipher.mode.tag.toHex(), tags[i]);
- ASSERT.equal(pass, true);
- ASSERT.equal(cipher.output.toHex(), inputs[i]);
- });
- })(i);
- }
- })();
- });
-}
-
-// check for AMD
-var forge = {};
-if(typeof define === 'function') {
- define([
- 'forge/cipher',
- 'forge/aes',
- 'forge/util'
- ], function(CIPHER, AES, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- CIPHER(forge),
- AES(forge),
- UTIL(forge)
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/cipher')(forge),
- require('../../js/aes')(forge),
- require('../../js/util')(forge));
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/asn1.js b/school/node_modules/node-forge/nodejs/test/asn1.js
deleted file mode 100644
index 7d0880e..0000000
--- a/school/node_modules/node-forge/nodejs/test/asn1.js
+++ /dev/null
@@ -1,262 +0,0 @@
-(function() {
-
-function Tests(ASSERT, ASN1, UTIL) {
- describe('asn1', function() {
- // TODO: add more ASN.1 coverage
-
- it('should convert an OID to DER', function() {
- ASSERT.equal(ASN1.oidToDer('1.2.840.113549').toHex(), '2a864886f70d');
- });
-
- it('should convert an OID from DER', function() {
- var der = UTIL.hexToBytes('2a864886f70d');
- ASSERT.equal(ASN1.derToOid(der), '1.2.840.113549');
- });
-
- it('should convert INTEGER 0 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(0).toHex(), '00');
- });
-
- it('should convert INTEGER 1 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(1).toHex(), '01');
- });
-
- it('should convert INTEGER 127 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(127).toHex(), '7f');
- });
-
- it('should convert INTEGER 128 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(128).toHex(), '0080');
- });
-
- it('should convert INTEGER 256 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(256).toHex(), '0100');
- });
-
- it('should convert INTEGER -128 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(-128).toHex(), '80');
- });
-
- it('should convert INTEGER -129 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(-129).toHex(), 'ff7f');
- });
-
- it('should convert INTEGER 32768 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(32768).toHex(), '008000');
- });
-
- it('should convert INTEGER -32768 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(-32768).toHex(), '8000');
- });
-
- it('should convert INTEGER -32769 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(-32769).toHex(), 'ff7fff');
- });
-
- it('should convert INTEGER 8388608 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(8388608).toHex(), '00800000');
- });
-
- it('should convert INTEGER -8388608 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(-8388608).toHex(), '800000');
- });
-
- it('should convert INTEGER -8388609 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(-8388609).toHex(), 'ff7fffff');
- });
-
- it('should convert INTEGER 2147483647 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(2147483647).toHex(), '7fffffff');
- });
-
- it('should convert INTEGER -2147483648 to DER', function() {
- ASSERT.equal(ASN1.integerToDer(-2147483648).toHex(), '80000000');
- });
-
- it('should convert INTEGER 0 from DER', function() {
- var der = UTIL.hexToBytes('00');
- ASSERT.equal(ASN1.derToInteger(der), 0);
- });
-
- it('should convert INTEGER 1 from DER', function() {
- var der = UTIL.hexToBytes('01');
- ASSERT.equal(ASN1.derToInteger(der), 1);
- });
-
- it('should convert INTEGER 127 from DER', function() {
- var der = UTIL.hexToBytes('7f');
- ASSERT.equal(ASN1.derToInteger(der), 127);
- });
-
- it('should convert INTEGER 128 from DER', function() {
- var der = UTIL.hexToBytes('0080');
- ASSERT.equal(ASN1.derToInteger(der), 128);
- });
-
- it('should convert INTEGER 256 from DER', function() {
- var der = UTIL.hexToBytes('0100');
- ASSERT.equal(ASN1.derToInteger(der), 256);
- });
-
- it('should convert INTEGER -128 from DER', function() {
- var der = UTIL.hexToBytes('80');
- ASSERT.equal(ASN1.derToInteger(der), -128);
- });
-
- it('should convert INTEGER -129 from DER', function() {
- var der = UTIL.hexToBytes('ff7f');
- ASSERT.equal(ASN1.derToInteger(der), -129);
- });
-
- it('should convert INTEGER 32768 from DER', function() {
- var der = UTIL.hexToBytes('008000');
- ASSERT.equal(ASN1.derToInteger(der), 32768);
- });
-
- it('should convert INTEGER -32768 from DER', function() {
- var der = UTIL.hexToBytes('8000');
- ASSERT.equal(ASN1.derToInteger(der), -32768);
- });
-
- it('should convert INTEGER -32769 from DER', function() {
- var der = UTIL.hexToBytes('ff7fff');
- ASSERT.equal(ASN1.derToInteger(der), -32769);
- });
-
- it('should convert INTEGER 8388608 from DER', function() {
- var der = UTIL.hexToBytes('00800000');
- ASSERT.equal(ASN1.derToInteger(der), 8388608);
- });
-
- it('should convert INTEGER -8388608 from DER', function() {
- var der = UTIL.hexToBytes('800000');
- ASSERT.equal(ASN1.derToInteger(der), -8388608);
- });
-
- it('should convert INTEGER -8388609 from DER', function() {
- var der = UTIL.hexToBytes('ff7fffff');
- ASSERT.equal(ASN1.derToInteger(der), -8388609);
- });
-
- it('should convert INTEGER 2147483647 from DER', function() {
- var der = UTIL.hexToBytes('7fffffff');
- ASSERT.equal(ASN1.derToInteger(der), 2147483647);
- });
-
- it('should convert INTEGER -2147483648 from DER', function() {
- var der = UTIL.hexToBytes('80000000');
- ASSERT.equal(ASN1.derToInteger(der), -2147483648);
- });
-
- (function() {
- var tests = [{
- in: '20110223123400',
- out: 1298464440000
- }, {
- in: '20110223123400.1',
- out: 1298464440100
- }, {
- in: '20110223123400.123',
- out: 1298464440123
- }];
- for(var i = 0; i < tests.length; ++i) {
- var test = tests[i];
- it('should convert local generalized time "' + test.in + '" to a Date', function() {
- var d = ASN1.generalizedTimeToDate(test.in);
- var localOffset = d.getTimezoneOffset() * 60000;
- ASSERT.equal(d.getTime(), test.out + localOffset);
- });
- }
- })();
-
- (function() {
- var tests = [{
- in: '20110223123400Z', // Wed Feb 23 12:34:00.000 UTC 2011
- out: 1298464440000
- }, {
- in: '20110223123400.1Z', // Wed Feb 23 12:34:00.100 UTC 2011
- out: 1298464440100
- }, {
- in: '20110223123400.123Z', // Wed Feb 23 12:34:00.123 UTC 2011
- out: 1298464440123
- }, {
- in: '20110223123400+0200', // Wed Feb 23 10:34:00.000 UTC 2011
- out: 1298457240000
- }, {
- in: '20110223123400.1+0200', // Wed Feb 23 10:34:00.100 UTC 2011
- out: 1298457240100
- }, {
- in: '20110223123400.123+0200', // Wed Feb 23 10:34:00.123 UTC 2011
- out: 1298457240123
- }, {
- in: '20110223123400-0200', // Wed Feb 23 14:34:00.000 UTC 2011
- out: 1298471640000
- }, {
- in: '20110223123400.1-0200', // Wed Feb 23 14:34:00.100 UTC 2011
- out: 1298471640100
- }, {
- in: '20110223123400.123-0200', // Wed Feb 23 14:34:00.123 UTC 2011
- out: 1298471640123
- }];
- for(var i = 0; i < tests.length; ++i) {
- var test = tests[i];
- it('should convert utc generalized time "' + test.in + '" to a Date', function() {
- var d = ASN1.generalizedTimeToDate(test.in);
- ASSERT.equal(d.getTime(), test.out);
- });
- }
- })();
-
- (function() {
- var tests = [{
- in: '1102231234Z', // Wed Feb 23 12:34:00 UTC 2011
- out: 1298464440000
- }, {
- in: '1102231234+0200', // Wed Feb 23 10:34:00 UTC 2011
- out: 1298457240000
- }, {
- in: '1102231234-0200', // Wed Feb 23 14:34:00 UTC 2011
- out: 1298471640000
- }, {
- in: '110223123456Z', // Wed Feb 23 12:34:56 UTC 2011
- out: 1298464496000
- }, {
- in: '110223123456+0200', // Wed Feb 23 10:34:56 UTC 2011
- out: 1298457296000
- }, {
- in: '110223123456-0200', // Wed Feb 23 14:34:56 UTC 2011
- out: 1298471696000
- }];
- for(var i = 0; i < tests.length; ++i) {
- var test = tests[i];
- it('should convert utc time "' + test.in + '" to a Date', function() {
- var d = ASN1.utcTimeToDate(test.in);
- ASSERT.equal(d.getTime(), test.out);
- });
- }
- })();
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/asn1',
- 'forge/util'
- ], function(ASN1, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- ASN1(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/asn1')(),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/browser.js b/school/node_modules/node-forge/nodejs/test/browser.js
deleted file mode 100644
index a96b2d6..0000000
--- a/school/node_modules/node-forge/nodejs/test/browser.js
+++ /dev/null
@@ -1,41 +0,0 @@
-var server = require('../server');
-var grunt = require('grunt');
-
-describe('browser', function() {
- it('should run tests', function(done) {
- this.timeout(60 * 1000 * 5);
-
- return server.main(function(err, info) {
- if(err) {
- return done(err);
- }
-
- grunt.initConfig({
- mocha: {
- all: {
- options: {
- reporter: 'List',
- urls: ['http://localhost:' + info.port + '/index.html']
- }
- }
- }
- });
-
- grunt.loadNpmTasks('grunt-mocha');
-
- grunt.registerInitTask('default', function() {
- grunt.task.run(['mocha']);
- });
- grunt.tasks(['default'], {
- //debug: true
- }, function() {
- if(err) {
- return done(err);
- }
- // finish immediately
- done(null);
- return info.server.close();
- });
- });
- });
-});
diff --git a/school/node_modules/node-forge/nodejs/test/csr.js b/school/node_modules/node-forge/nodejs/test/csr.js
deleted file mode 100644
index 340c09f..0000000
--- a/school/node_modules/node-forge/nodejs/test/csr.js
+++ /dev/null
@@ -1,148 +0,0 @@
-(function() {
-
-function Tests(ASSERT, PKI) {
- var _pem = {
- privateKey: '-----BEGIN RSA PRIVATE KEY-----\r\n' +
- 'MIICXQIBAAKBgQDL0EugUiNGMWscLAVM0VoMdhDZEJOqdsUMpx9U0YZI7szokJqQ\r\n' +
- 'NIwokiQ6EonNnWSMlIvy46AhnlRYn+ezeTeU7eMGTkP3VF29vXBo+dLq5e+8VyAy\r\n' +
- 'Q3FzM1wI4ts4hRACF8w6mqygXQ7i/SDu8/rXqRGtvnM+z0MYDdKo80efzwIDAQAB\r\n' +
- 'AoGAIzkGONi5G+JifmXlLJdplom486p3upf4Ce2/7mqfaG9MnkyPSairKD/JXvfh\r\n' +
- 'NNWkkN8DKKDKBcVVElPgORYT0qwrWc7ueLBMUCbRXb1ZyfEulimG0R3kjUh7NYau\r\n' +
- 'DaIkVgfykXGSQMZx8FoaT6L080zd+0emKDDYRrb+/kgJNJECQQDoUZoiC2K/DWNY\r\n' +
- 'h3/ppZ0ane2y4SBmJUHJVMPQ2CEgxsrJTxet668ckNCKaOP/3VFPoWC41f17DvKq\r\n' +
- 'noYINNntAkEA4JbZBZBVUrQFhHlrpXT4jzqtO2RlKZzEq8qmFZfEErxOT1WMyyCi\r\n' +
- 'lAQ5gUKardo1Kf0omC8Xq/uO9ZYdED55KwJBALs6cJ65UFaq4oLJiQPzLd7yokuE\r\n' +
- 'dcj8g71PLBTW6jPxIiMFNA89nz3FU9wIVp+xbMNhSoMMKqIPVPC+m0Rn260CQQDA\r\n' +
- 'I83fWK/mZWUjBM33a68KumRiH238v8XyQxj7+C8i6D8G2GXvkigFAehAkb7LZZd+\r\n' +
- 'KLuGFyPlWv3fVWHf99KpAkBQFKk3MRMl6IGJZUEFQe4l5whm8LkGU4acSqv9B3xt\r\n' +
- 'qROkCrsFrMPqjuuzEmyHoQZ64r2PLJg7FOuyhBnQUOt4\r\n' +
- '-----END RSA PRIVATE KEY-----\r\n',
- publicKey: '-----BEGIN PUBLIC KEY-----\r\n' +
- 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDL0EugUiNGMWscLAVM0VoMdhDZ\r\n' +
- 'EJOqdsUMpx9U0YZI7szokJqQNIwokiQ6EonNnWSMlIvy46AhnlRYn+ezeTeU7eMG\r\n' +
- 'TkP3VF29vXBo+dLq5e+8VyAyQ3FzM1wI4ts4hRACF8w6mqygXQ7i/SDu8/rXqRGt\r\n' +
- 'vnM+z0MYDdKo80efzwIDAQAB\r\n' +
- '-----END PUBLIC KEY-----\r\n'
- };
-
- describe('csr', function() {
- it('should generate a certification request', function() {
- var keys = {
- privateKey: PKI.privateKeyFromPem(_pem.privateKey),
- publicKey: PKI.publicKeyFromPem(_pem.publicKey)
- };
- var csr = PKI.createCertificationRequest();
- csr.publicKey = keys.publicKey;
- csr.setSubject([{
- name: 'commonName',
- value: 'example.org'
- }, {
- name: 'countryName',
- value: 'US'
- }, {
- shortName: 'ST',
- value: 'Virginia'
- }, {
- name: 'localityName',
- value: 'Blacksburg'
- }, {
- name: 'organizationName',
- value: 'Test'
- }, {
- shortName: 'OU',
- value: 'Test'
- }]);
- // add optional attributes
- csr.setAttributes([{
- name: 'challengePassword',
- value: 'password'
- }, {
- name: 'unstructuredName',
- value: 'My company'
- }, {
- name: 'extensionRequest',
- extensions: [{
- name: 'subjectAltName',
- altNames: [{
- // type 2 is DNS
- type: 2,
- value: 'test.domain.com'
- }, {
- type: 2,
- value: 'other.domain.com'
- }, {
- type: 2,
- value: 'www.domain.net'
- }]
- }]
- }]);
-
- // sign certification request
- csr.sign(keys.privateKey);
-
- var pem = PKI.certificationRequestToPem(csr);
- csr = PKI.certificationRequestFromPem(pem);
- ASSERT.ok(csr.getAttribute({name: 'extensionRequest'}));
- ASSERT.equal(csr.getAttribute({name: 'extensionRequest'}).extensions[0].name, 'subjectAltName');
- ASSERT.deepEqual(csr.getAttribute({name: 'extensionRequest'}).extensions[0].altNames, [{
- // type 2 is DNS
- type: 2,
- value: 'test.domain.com'
- }, {
- type: 2,
- value: 'other.domain.com'
- }, {
- type: 2,
- value: 'www.domain.net'
- }]);
- ASSERT.ok(csr.verify());
- });
-
- it('should load an OpenSSL-generated certification request', function() {
- var pem = '-----BEGIN CERTIFICATE REQUEST-----\r\n' +
- 'MIICdTCCAV0CAQAwMDEVMBMGA1UEAwwMTXlDb21tb25OYW1lMRcwFQYDVQQKDA5N\r\n' +
- 'eU9yZ2FuaXphdGlvbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKRU\r\n' +
- 'zrAMbiiSjAYYl3PWsOrNwY0VtemgRZc0t7+3FlWp1e8uIA3KxZFZY875wo0QOvD+\r\n' +
- 'AdNv5+YnokgzOi83F3T4yewBSR0TiO3Pa4tL4C7CzWnhYliC/owk5bHCV0HLkYUW\r\n' +
- 'F6z7Lx3HyhoxlKmrHySSPPZRLKp7KcwxbjFc2EfhQV21I73Z1mCG6MEp7cN2qBbQ\r\n' +
- 'PyOMNjAUibOWs4JJEdUjWhm86EZm9+qfgpL5tlpZCe+kXySrKTp56mMsfSOQvlol\r\n' +
- 'pRO8pP9AUjaEqRikCZ745I/9W7dHNPUoyxkWV5jRDwcT7s652+L6oxtoqVOXpg28\r\n' +
- 'uAL0kUZQMa8wkYUKZiMCAwEAAaAAMA0GCSqGSIb3DQEBBQUAA4IBAQCXQH+ut6tr\r\n' +
- 'Z/FdIDOljrc7uh8XpFRKS3GqC/PJsEwrV7d3CX5HuWPTuPc9FU5FQ88w6evXEA0o\r\n' +
- 'ijxHuydeXmdjpy433vXWo1TaRSXh1WaBMG5pW/SlGZK9/Hr1P0v7KN/KCY5nXxoQ\r\n' +
- 'k3Ndg9HzGrYnRoJVXzvdQeBGwCoJFk4FH+Rxa/F03VTUU5nwx66TsL9JUp9pnbI7\r\n' +
- 'MR6DIA97LnTmut8Xp0Uurw+zsS5rif9iv0BKHd7eGpNNGl0RXu8E5dbT0zD90TSa\r\n' +
- 'P5WjxjvY+Udg8XZU+UwT3kcyTEFpiQdkzTIKXg0dFurfUE9XG/9aic9oMZ/IBZz9\r\n' +
- 'a535a7e9RkbJ\r\n' +
- '-----END CERTIFICATE REQUEST-----\r\n';
-
- var csr = PKI.certificationRequestFromPem(pem);
- ASSERT.equal(csr.subject.getField('CN').value, 'MyCommonName');
- ASSERT.equal(csr.subject.getField('O').value, 'MyOrganization');
- ASSERT.equal(csr.signatureOid, PKI.oids.sha1WithRSAEncryption);
- ASSERT.equal(csr.publicKey.e.toString(16), '10001');
- ASSERT.equal(csr.publicKey.n.toString(16).toUpperCase(), 'A454CEB00C6E28928C06189773D6B0EACDC18D15B5E9A0459734B7BFB71655A9D5EF2E200DCAC5915963CEF9C28D103AF0FE01D36FE7E627A248333A2F371774F8C9EC01491D1388EDCF6B8B4BE02EC2CD69E1625882FE8C24E5B1C25741CB91851617ACFB2F1DC7CA1A3194A9AB1F24923CF6512CAA7B29CC316E315CD847E1415DB523BDD9D66086E8C129EDC376A816D03F238C36301489B396B3824911D5235A19BCE84666F7EA9F8292F9B65A5909EFA45F24AB293A79EA632C7D2390BE5A25A513BCA4FF40523684A918A4099EF8E48FFD5BB74734F528CB19165798D10F0713EECEB9DBE2FAA31B68A95397A60DBCB802F491465031AF3091850A6623');
- ASSERT.ok(csr.verify());
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/pki'
- ], function(PKI) {
- Tests(
- // Global provided by test harness
- ASSERT,
- PKI()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/pki')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/des.js b/school/node_modules/node-forge/nodejs/test/des.js
deleted file mode 100644
index 8be2c68..0000000
--- a/school/node_modules/node-forge/nodejs/test/des.js
+++ /dev/null
@@ -1,155 +0,0 @@
-(function() {
-
-function Tests(ASSERT, CIPHER, DES, UTIL) {
- describe('des', function() {
- // OpenSSL equivalent:
- // openssl enc -des-ecb -K a1c06b381adf3651 -nosalt
- it('should des-ecb encrypt: foobar', function() {
- var key = new UTIL.createBuffer(
- UTIL.hexToBytes('a1c06b381adf3651'));
-
- var cipher = CIPHER.createCipher('DES-ECB', key);
- cipher.start();
- cipher.update(UTIL.createBuffer('foobar'));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), 'b705ffcf3dff06b3');
- });
-
- // OpenSSL equivalent:
- // openssl enc -d -des-ecb -K a1c06b381adf3651 -nosalt
- it('should des-ecb decrypt: b705ffcf3dff06b3', function() {
- var key = new UTIL.createBuffer(
- UTIL.hexToBytes('a1c06b381adf3651'));
-
- var decipher = CIPHER.createDecipher('DES-ECB', key);
- decipher.start();
- decipher.update(UTIL.createBuffer(UTIL.hexToBytes('b705ffcf3dff06b3')));
- decipher.finish();
- ASSERT.equal(decipher.output.getBytes(), 'foobar');
- });
-
- // OpenSSL equivalent:
- // openssl enc -des -K a1c06b381adf3651 -iv 818bcf76efc59662 -nosalt
- it('should des-cbc encrypt: foobar', function() {
- var key = new UTIL.createBuffer(
- UTIL.hexToBytes('a1c06b381adf3651'));
- var iv = new UTIL.createBuffer(
- UTIL.hexToBytes('818bcf76efc59662'));
-
- var cipher = CIPHER.createCipher('DES-CBC', key);
- cipher.start({iv: iv});
- cipher.update(UTIL.createBuffer('foobar'));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), '3261e5839a990454');
- });
-
- // OpenSSL equivalent:
- // openssl enc -d -des -K a1c06b381adf3651 -iv 818bcf76efc59662 -nosalt
- it('should des-cbc decrypt: 3261e5839a990454', function() {
- var key = new UTIL.createBuffer(
- UTIL.hexToBytes('a1c06b381adf3651'));
- var iv = new UTIL.createBuffer(
- UTIL.hexToBytes('818bcf76efc59662'));
-
- var decipher = CIPHER.createDecipher('DES-CBC', key);
- decipher.start({iv: iv});
- decipher.update(UTIL.createBuffer(UTIL.hexToBytes('3261e5839a990454')));
- decipher.finish();
- ASSERT.equal(decipher.output.getBytes(), 'foobar');
- });
-
- // OpenSSL equivalent:
- // openssl enc -des-ede3 -K a1c06b381adf36517e84575552777779da5e3d9f994b05b5 -nosalt
- it('should 3des-ecb encrypt: foobar', function() {
- var key = new UTIL.createBuffer(
- UTIL.hexToBytes('a1c06b381adf36517e84575552777779da5e3d9f994b05b5'));
-
- var cipher = CIPHER.createCipher('3DES-ECB', key);
- cipher.start();
- cipher.update(UTIL.createBuffer('foobar'));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), 'fce8b1ee8c6440d1');
- });
-
- // OpenSSL equivalent:
- // openssl enc -d -des-ede3 -K a1c06b381adf36517e84575552777779da5e3d9f994b05b5 -nosalt
- it('should 3des-ecb decrypt: fce8b1ee8c6440d1', function() {
- var key = new UTIL.createBuffer(
- UTIL.hexToBytes('a1c06b381adf36517e84575552777779da5e3d9f994b05b5'));
-
- var decipher = CIPHER.createDecipher('3DES-ECB', key);
- decipher.start();
- decipher.update(UTIL.createBuffer(UTIL.hexToBytes('fce8b1ee8c6440d1')));
- decipher.finish();
- ASSERT.equal(decipher.output.getBytes(), 'foobar');
- });
-
- // OpenSSL equivalent:
- // openssl enc -des3 -K a1c06b381adf36517e84575552777779da5e3d9f994b05b5 -iv 818bcf76efc59662 -nosalt
- it('should 3des-cbc encrypt "foobar", restart, and encrypt "foobar,,"', function() {
- var key = new UTIL.createBuffer(
- UTIL.hexToBytes('a1c06b381adf36517e84575552777779da5e3d9f994b05b5'));
- var iv = new UTIL.createBuffer(
- UTIL.hexToBytes('818bcf76efc59662'));
-
- var cipher = CIPHER.createCipher('3DES-CBC', key);
- cipher.start({iv: iv.copy()});
- cipher.update(UTIL.createBuffer('foobar'));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), '209225f7687ca0b2');
-
- cipher.start({iv: iv.copy()});
- cipher.update(UTIL.createBuffer('foobar,,'));
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), '57156174c48dfc37293831bf192a6742');
- });
-
- // OpenSSL equivalent:
- // openssl enc -d -des3 -K a1c06b381adf36517e84575552777779da5e3d9f994b05b5 -iv 818bcf76efc59662 -nosalt
- it('should 3des-cbc decrypt "209225f7687ca0b2", restart, and decrypt "57156174c48dfc37293831bf192a6742,,"', function() {
- var key = new UTIL.createBuffer(
- UTIL.hexToBytes('a1c06b381adf36517e84575552777779da5e3d9f994b05b5'));
- var iv = new UTIL.createBuffer(
- UTIL.hexToBytes('818bcf76efc59662'));
-
- var decipher = CIPHER.createDecipher('3DES-CBC', key);
- decipher.start({iv: iv.copy()});
- decipher.update(UTIL.createBuffer(UTIL.hexToBytes('209225f7687ca0b2')));
- decipher.finish();
- ASSERT.equal(decipher.output.getBytes(), 'foobar');
-
- decipher.start({iv: iv.copy()});
- decipher.update(
- UTIL.createBuffer(UTIL.hexToBytes('57156174c48dfc37293831bf192a6742')));
- decipher.finish();
- ASSERT.equal(decipher.output.getBytes(), 'foobar,,');
- });
- });
-}
-
-// check for AMD
-var forge = {};
-if(typeof define === 'function') {
- define([
- 'forge/cipher',
- 'forge/des',
- 'forge/util'
- ], function(CIPHER, DES, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- CIPHER(forge),
- DES(forge),
- UTIL(forge)
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/cipher')(forge),
- require('../../js/des')(forge),
- require('../../js/util')(forge));
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/hmac.js b/school/node_modules/node-forge/nodejs/test/hmac.js
deleted file mode 100644
index 404b36b..0000000
--- a/school/node_modules/node-forge/nodejs/test/hmac.js
+++ /dev/null
@@ -1,85 +0,0 @@
-(function() {
-
-function Tests(ASSERT, HMAC, UTIL) {
- describe('hmac', function() {
- it('should md5 hash "Hi There", 16-byte key', function() {
- var key = UTIL.hexToBytes('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b');
- var hmac = HMAC.create();
- hmac.start('MD5', key);
- hmac.update('Hi There');
- ASSERT.equal(hmac.digest().toHex(), '9294727a3638bb1c13f48ef8158bfc9d');
- });
-
- it('should md5 hash "what do ya want for nothing?", "Jefe" key', function() {
- var hmac = HMAC.create();
- hmac.start('MD5', 'Jefe');
- hmac.update('what do ya want for nothing?');
- ASSERT.equal(hmac.digest().toHex(), '750c783e6ab0b503eaa86e310a5db738');
- });
-
- it('should md5 hash "Test Using Larger Than Block-Size Key - Hash Key First", 80-byte key', function() {
- var key = UTIL.hexToBytes(
- 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
- 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
- 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
- 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
- var hmac = HMAC.create();
- hmac.start('MD5', key);
- hmac.update('Test Using Larger Than Block-Size Key - Hash Key First');
- ASSERT.equal(hmac.digest().toHex(), '6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd');
- });
-
- it('should sha1 hash "Hi There", 20-byte key', function() {
- var key = UTIL.hexToBytes('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b');
- var hmac = HMAC.create();
- hmac.start('SHA1', key);
- hmac.update('Hi There');
- ASSERT.equal(
- hmac.digest().toHex(), 'b617318655057264e28bc0b6fb378c8ef146be00');
- });
-
- it('should sha1 hash "what do ya want for nothing?", "Jefe" key', function() {
- var hmac = HMAC.create();
- hmac.start('SHA1', 'Jefe');
- hmac.update('what do ya want for nothing?');
- ASSERT.equal(
- hmac.digest().toHex(), 'effcdf6ae5eb2fa2d27416d5f184df9c259a7c79');
- });
-
- it('should sha1 hash "Test Using Larger Than Block-Size Key - Hash Key First", 80-byte key', function() {
- var key = UTIL.hexToBytes(
- 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
- 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
- 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
- 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
- var hmac = HMAC.create();
- hmac.start('SHA1', key);
- hmac.update('Test Using Larger Than Block-Size Key - Hash Key First');
- ASSERT.equal(
- hmac.digest().toHex(), 'aa4ae5e15272d00e95705637ce8a3b55ed402112');
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/hmac',
- 'forge/util'
- ], function(HMAC, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- HMAC(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/hmac')(),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/kem.js b/school/node_modules/node-forge/nodejs/test/kem.js
deleted file mode 100644
index 0415abe..0000000
--- a/school/node_modules/node-forge/nodejs/test/kem.js
+++ /dev/null
@@ -1,198 +0,0 @@
-(function() {
-
-function Tests(ASSERT, KEM, MD, RSA, UTIL, JSBN, RANDOM) {
-
- function FixedSecureRandom(str) {
- var bytes = UTIL.hexToBytes(str);
- this.getBytesSync = function(count) {
- // prepend zeros
- return UTIL.fillString(String.fromCharCode(0), bytes.length - count) +
- bytes;
- };
- }
-
- describe('kem', function() {
- it('should generate and encrypt a symmetric key and decrypt it 10x', function() {
- for(var i = 0; i < 10; ++i) {
- var kdf = new KEM.kdf1(MD.sha256.create());
- var kem = KEM.rsa.create(kdf);
-
- var pair = RSA.generateKeyPair(512);
-
- var result = kem.encrypt(pair.publicKey, 256);
- var key1 = result.key;
- var key2 = kem.decrypt(pair.privateKey, result.encapsulation, 256);
-
- ASSERT.equal(UTIL.bytesToHex(key1), UTIL.bytesToHex(key2));
- }
- });
- });
-
- /**
- * According to section "C.6 Test vectors for RSA-KEM" from ISO-18033-2 final
- * draft.
- */
- describe('C.6 Test vectors for RSA-KEM from ISO-18033-2 final', function() {
- it('should pass test vector C.6.1', function() {
- var n = '5888113332502691251761936431009284884966640757179802337490546478326238537107326596800820237597139824869184990638749556269785797065508097452399642780486933';
- var e = '65537';
- var d = '3202313555859948186315374524474173995679783580392140237044349728046479396037520308981353808895461806395564474639124525446044708705259675840210989546479265';
-
- var C0 = '4603e5324cab9cef8365c817052d954d44447b1667099edc69942d32cd594e4ffcf268ae3836e2c35744aaa53ae201fe499806b67dedaa26bf72ecbd117a6fc0';
- var K = '5f8de105b5e96b2e490ddecbd147dd1def7e3b8e0e6a26eb7b956ccb8b3bdc1ca975bc57c3989e8fbad31a224655d800c46954840ff32052cdf0d640562bdfadfa263cfccf3c52b29f2af4a1869959bc77f854cf15bd7a25192985a842dbff8e13efee5b7e7e55bbe4d389647c686a9a9ab3fb889b2d7767d3837eea4e0a2f04';
-
- var kdf = new KEM.kdf1(MD.sha1.create());
- var rnd = new FixedSecureRandom('032e45326fa859a72ec235acff929b15d1372e30b207255f0611b8f785d764374152e0ac009e509e7ba30cd2f1778e113b64e135cf4e2292c75efe5288edfda4');
- var kem = KEM.rsa.create(kdf, {prng: rnd});
-
- var rsaPublicKey = RSA.setPublicKey(
- new JSBN.BigInteger(n), new JSBN.BigInteger(e));
- var rsaPrivateKey = RSA.setPrivateKey(
- new JSBN.BigInteger(n), null, new JSBN.BigInteger(d));
-
- var result = kem.encrypt(rsaPublicKey, 128);
- ASSERT.equal(UTIL.bytesToHex(result.encapsulation), C0);
- ASSERT.equal(UTIL.bytesToHex(result.key), K);
-
- var decryptedKey = kem.decrypt(rsaPrivateKey, result.encapsulation, 128);
- ASSERT.equal(UTIL.bytesToHex(decryptedKey), K);
- });
-
- it('should pass test vector C.6.2', function() {
- var n = '5888113332502691251761936431009284884966640757179802337490546478326238537107326596800820237597139824869184990638749556269785797065508097452399642780486933';
- var e = '65537';
- var d = '3202313555859948186315374524474173995679783580392140237044349728046479396037520308981353808895461806395564474639124525446044708705259675840210989546479265';
-
- var C0 = '4603e5324cab9cef8365c817052d954d44447b1667099edc69942d32cd594e4ffcf268ae3836e2c35744aaa53ae201fe499806b67dedaa26bf72ecbd117a6fc0';
- var K = '0e6a26eb7b956ccb8b3bdc1ca975bc57c3989e8fbad31a224655d800c46954840ff32052cdf0d640562bdfadfa263cfccf3c52b29f2af4a1869959bc77f854cf15bd7a25192985a842dbff8e13efee5b7e7e55bbe4d389647c686a9a9ab3fb889b2d7767d3837eea4e0a2f04b53ca8f50fb31225c1be2d0126c8c7a4753b0807';
-
- var kdf = new KEM.kdf2(MD.sha1.create());
- var rnd = new FixedSecureRandom('032e45326fa859a72ec235acff929b15d1372e30b207255f0611b8f785d764374152e0ac009e509e7ba30cd2f1778e113b64e135cf4e2292c75efe5288edfda4');
- var kem = KEM.rsa.create(kdf, {prng: rnd});
-
- var rsaPublicKey = RSA.setPublicKey(
- new JSBN.BigInteger(n), new JSBN.BigInteger(e));
- var rsaPrivateKey = RSA.setPrivateKey(
- new JSBN.BigInteger(n), null, new JSBN.BigInteger(d));
-
- var result = kem.encrypt(rsaPublicKey, 128);
- ASSERT.equal(UTIL.bytesToHex(result.encapsulation), C0);
- ASSERT.equal(UTIL.bytesToHex(result.key), K);
-
- var decryptedKey = kem.decrypt(rsaPrivateKey, result.encapsulation, 128);
- ASSERT.equal(UTIL.bytesToHex(decryptedKey), K);
- });
-
- it('should pass test vector C.6.3', function() {
- var n = '5888113332502691251761936431009284884966640757179802337490546478326238537107326596800820237597139824869184990638749556269785797065508097452399642780486933';
- var e = '65537';
- var d = '3202313555859948186315374524474173995679783580392140237044349728046479396037520308981353808895461806395564474639124525446044708705259675840210989546479265';
-
- var C0 = '4603e5324cab9cef8365c817052d954d44447b1667099edc69942d32cd594e4ffcf268ae3836e2c35744aaa53ae201fe499806b67dedaa26bf72ecbd117a6fc0';
- var K = '09e2decf2a6e1666c2f6071ff4298305e2643fd510a2403db42a8743cb989de86e668d168cbe604611ac179f819a3d18412e9eb45668f2923c087c12fee0c5a0d2a8aa70185401fbbd99379ec76c663e875a60b4aacb1319fa11c3365a8b79a44669f26fb555c80391847b05eca1cb5cf8c2d531448d33fbaca19f6410ee1fcb';
-
- var kdf = new KEM.kdf1(MD.sha256.create(), 20);
- var rnd = new FixedSecureRandom('032e45326fa859a72ec235acff929b15d1372e30b207255f0611b8f785d764374152e0ac009e509e7ba30cd2f1778e113b64e135cf4e2292c75efe5288edfda4');
- var kem = KEM.rsa.create(kdf, {prng: rnd});
-
- var rsaPublicKey = RSA.setPublicKey(
- new JSBN.BigInteger(n), new JSBN.BigInteger(e));
- var rsaPrivateKey = RSA.setPrivateKey(
- new JSBN.BigInteger(n), null, new JSBN.BigInteger(d));
-
- var result = kem.encrypt(rsaPublicKey, 128);
- ASSERT.equal(UTIL.bytesToHex(result.encapsulation), C0);
- ASSERT.equal(UTIL.bytesToHex(result.key), K);
-
- var decryptedKey = kem.decrypt(rsaPrivateKey, result.encapsulation, 128);
- ASSERT.equal(UTIL.bytesToHex(decryptedKey), K);
- });
-
- it('should pass test vector C.6.4', function() {
- var n = '5888113332502691251761936431009284884966640757179802337490546478326238537107326596800820237597139824869184990638749556269785797065508097452399642780486933';
- var e = '65537';
- var d = '3202313555859948186315374524474173995679783580392140237044349728046479396037520308981353808895461806395564474639124525446044708705259675840210989546479265';
-
- var C0 = '4603e5324cab9cef8365c817052d954d44447b1667099edc69942d32cd594e4ffcf268ae3836e2c35744aaa53ae201fe499806b67dedaa26bf72ecbd117a6fc0';
- var K = '10a2403db42a8743cb989de86e668d168cbe604611ac179f819a3d18412e9eb45668f2923c087c12fee0c5a0d2a8aa70185401fbbd99379ec76c663e875a60b4aacb1319fa11c3365a8b79a44669f26fb555c80391847b05eca1cb5cf8c2d531448d33fbaca19f6410ee1fcb260892670e0814c348664f6a7248aaf998a3acc6';
-
- var kdf = new KEM.kdf2(MD.sha256.create(), 20);
- var rnd = new FixedSecureRandom('00032e45326fa859a72ec235acff929b15d1372e30b207255f0611b8f785d764374152e0ac009e509e7ba30cd2f1778e113b64e135cf4e2292c75efe5288edfda4');
- var kem = KEM.rsa.create(kdf, {prng: rnd});
-
- var rsaPublicKey = RSA.setPublicKey(
- new JSBN.BigInteger(n), new JSBN.BigInteger(e));
- var rsaPrivateKey = RSA.setPrivateKey(
- new JSBN.BigInteger(n), null, new JSBN.BigInteger(d));
-
- var result = kem.encrypt(rsaPublicKey, 128);
- ASSERT.equal(UTIL.bytesToHex(result.encapsulation), C0);
- ASSERT.equal(UTIL.bytesToHex(result.key), K);
-
- var decryptedKey = kem.decrypt(rsaPrivateKey, result.encapsulation, 128);
- ASSERT.equal(UTIL.bytesToHex(decryptedKey), K);
- });
- });
-
- describe('prepended zeros test', function() {
- it('should pass when random has leading zeros', function() {
- var n = '5888113332502691251761936431009284884966640757179802337490546478326238537107326596800820237597139824869184990638749556269785797065508097452399642780486933';
- var e = '65537';
- var d = '3202313555859948186315374524474173995679783580392140237044349728046479396037520308981353808895461806395564474639124525446044708705259675840210989546479265';
-
- var C0 = '5f268a76c1aed04bc195a143d7ee768bee0aad308d16196274a02d9c1a72bbe10cbf718de323fc0135c5f8129f96ac8f504d9623960dc54cd87bddee94f5a0b2';
- var K = '8bf41e59dc1b83142ee32569a347a94539e48c98347c685a29e3aa8b7a3ea714d68c1a43c4a760c9d4a45149b0ce8b681e98076bdd4393394c7832a7fa71848257772ac38a4e7fbe96e8bb383becbb7242841946e82e35d9ef1667245fc82601e7edf53b897f5ce2b6bce8e1e3212abd5a8a99a0c9b99472e22a313dac396383';
-
- var kdf = new KEM.kdf1(MD.sha1.create());
- var rnd = new FixedSecureRandom('000e45326fa859a72ec235acff929b15d1372e30b207255f0611b8f785d764374152e0ac009e509e7ba30cd2f1778e113b64e135cf4e2292c75efe5288edfda4');
- var kem = KEM.rsa.create(kdf, {prng: rnd});
-
- var rsaPublicKey = RSA.setPublicKey(
- new JSBN.BigInteger(n), new JSBN.BigInteger(e));
- var rsaPrivateKey = RSA.setPrivateKey(
- new JSBN.BigInteger(n), null, new JSBN.BigInteger(d));
-
- var result = kem.encrypt(rsaPublicKey, 128);
- ASSERT.equal(UTIL.bytesToHex(result.encapsulation), C0);
- ASSERT.equal(UTIL.bytesToHex(result.key), K);
-
- var decryptedKey = kem.decrypt(rsaPrivateKey, result.encapsulation, 128);
- ASSERT.equal(UTIL.bytesToHex(decryptedKey), K);
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/kem',
- 'forge/md',
- 'forge/rsa',
- 'forge/util',
- 'forge/jsbn',
- 'forge/random'
- ], function(KEM, MD, RSA, UTIL, JSBN, RANDOM) {
- Tests(
- // Global provided by test harness
- ASSERT,
- KEM(),
- MD(),
- RSA(),
- UTIL(),
- JSBN(),
- RANDOM()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/kem')(),
- require('../../js/md')(),
- require('../../js/rsa')(),
- require('../../js/util')(),
- require('../../js/jsbn')(),
- require('../../js/random')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/md5.js b/school/node_modules/node-forge/nodejs/test/md5.js
deleted file mode 100644
index 5ab3d58..0000000
--- a/school/node_modules/node-forge/nodejs/test/md5.js
+++ /dev/null
@@ -1,117 +0,0 @@
-(function() {
-
-function Tests(ASSERT, MD5, UTIL) {
- describe('md5', function() {
- it('should digest the empty string', function() {
- var md = MD5.create();
- ASSERT.equal(md.digest().toHex(), 'd41d8cd98f00b204e9800998ecf8427e');
- });
-
- it('should digest "abc"', function() {
- var md = MD5.create();
- md.update('abc');
- ASSERT.equal(md.digest().toHex(), '900150983cd24fb0d6963f7d28e17f72');
- });
-
- it('should digest "The quick brown fox jumps over the lazy dog"', function() {
- var md = MD5.create();
- md.update('The quick brown fox jumps over the lazy dog');
- ASSERT.equal(md.digest().toHex(), '9e107d9d372bb6826bd81d3542a419d6');
- });
-
- it('should digest "c\'\u00e8"', function() {
- var md = MD5.create();
- md.update("c\'\u00e8", 'utf8');
- ASSERT.equal(md.digest().toHex(), '8ef7c2941d78fe89f31e614437c9db59');
- });
-
- it('should digest "THIS IS A MESSAGE"', function() {
- var md = MD5.create();
- md.start();
- md.update('THIS IS ');
- md.update('A MESSAGE');
- // do twice to check continuing digest
- ASSERT.equal(md.digest().toHex(), '78eebfd9d42958e3f31244f116ab7bbe');
- ASSERT.equal(md.digest().toHex(), '78eebfd9d42958e3f31244f116ab7bbe');
- });
-
- it('should digest a long message', function() {
- var input = UTIL.hexToBytes(
- '0100002903018d32e9c6dc423774c4c39a5a1b78f44cc2cab5f676d39' +
- 'f703d29bfa27dfeb870000002002f01000200004603014c2c1e835d39' +
- 'da71bc0857eb04c2b50fe90dbb2a8477fe7364598d6f0575999c20a6c' +
- '7248c5174da6d03ac711888f762fc4ed54f7254b32273690de849c843' +
- '073d002f000b0003d20003cf0003cc308203c8308202b0a0030201020' +
- '20100300d06092a864886f70d0101050500308186310b300906035504' +
- '0613025553311d301b060355040a13144469676974616c2042617a616' +
- '1722c20496e632e31443042060355040b133b4269746d756e6b206c6f' +
- '63616c686f73742d6f6e6c7920436572746966696361746573202d204' +
- '17574686f72697a6174696f6e20766961204254503112301006035504' +
- '0313096c6f63616c686f7374301e170d3130303231343137303931395' +
- 'a170d3230303231333137303931395a308186310b3009060355040613' +
- '025553311d301b060355040a13144469676974616c2042617a6161722' +
- 'c20496e632e31443042060355040b133b4269746d756e6b206c6f6361' +
- '6c686f73742d6f6e6c7920436572746966696361746573202d2041757' +
- '4686f72697a6174696f6e207669612042545031123010060355040313' +
- '096c6f63616c686f737430820122300d06092a864886f70d010101050' +
- '00382010f003082010a0282010100dc436f17d6909d8a9d6186ea218e' +
- 'b5c86b848bae02219bd56a71203daf07e81bc19e7e98134136bcb0128' +
- '81864bf03b3774652ad5eab85dba411a5114ffeac09babce75f313143' +
- '45512cd87c91318b2e77433270a52185fc16f428c3ca412ad6e9484bc' +
- '2fb87abb4e8fb71bf0f619e31a42340b35967f06c24a741a31c979c0b' +
- 'b8921a90a47025fbeb8adca576979e70a56830c61170c9647c18c0794' +
- 'd68c0df38f3aac5fc3b530e016ea5659715339f3f3c209cdee9dbe794' +
- 'b5af92530c5754c1d874b78974bfad994e0dfc582275e79feb522f6e4' +
- 'bcc2b2945baedfb0dbdaebb605f9483ff0bea29ecd5f4d6f2769965d1' +
- 'b3e04f8422716042680011ff676f0203010001a33f303d300c0603551' +
- 'd130101ff04023000300e0603551d0f0101ff0404030204f0301d0603' +
- '551d250416301406082b0601050507030106082b06010505070302300' +
- 'd06092a864886f70d010105050003820101009c4562be3f2d8d8e3880' +
- '85a697f2f106eaeff4992a43f198fe3dcf15c8229cf1043f061a38204' +
- 'f73d86f4fb6348048cc5279ed719873aa10e3773d92b629c2c3fcce04' +
- '012c81ba3b4ec451e9644ec5191078402d845e05d02c7b4d974b45882' +
- '76e5037aba7ef26a8bddeb21e10698c82f425e767dc401adf722fa73a' +
- 'b78cfa069bd69052d7ca6a75cc9225550e315d71c5f8764362ea4dbc6' +
- 'ecb837a8471043c5a7f826a71af145a053090bd4bccca6a2c552841cd' +
- 'b1908a8352f49283d2e641acdef667c7543af441a16f8294251e2ac37' +
- '6fa507b53ae418dd038cd20cef1e7bfbf5ae03a7c88d93d843abaabbd' +
- 'c5f3431132f3e559d2dd414c3eda38a210b80e0000001000010201002' +
- '6a220b7be857402819b78d81080d01a682599bbd00902985cc64edf8e' +
- '520e4111eb0e1729a14ffa3498ca259cc9ad6fc78fa130d968ebdb78d' +
- 'c0b950c0aa44355f13ba678419185d7e4608fe178ca6b2cef33e41937' +
- '78d1a70fe4d0dfcb110be4bbb4dbaa712177655728f914ab4c0f6c4ae' +
- 'f79a46b3d996c82b2ebe9ed1748eb5cace7dc44fb67e73f452a047f2e' +
- 'd199b3d50d5db960acf03244dc8efa4fc129faf8b65f9e52e62b55447' +
- '22bd17d2358e817a777618a4265a3db277fc04851a82a91fe6cdcb812' +
- '7f156e0b4a5d1f54ce2742eb70c895f5f8b85f5febe69bc73e891f928' +
- '0826860a0c2ef94c7935e6215c3c4cd6b0e43e80cca396d913d36be');
-
- var md = MD5.create();
- md.update(input);
- ASSERT.equal(md.digest().toHex(), 'd15a2da0e92c3da55dc573f885b6e653');
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/md5',
- 'forge/util'
- ], function(MD5, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- MD5(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/md5')(),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/mgf1.js b/school/node_modules/node-forge/nodejs/test/mgf1.js
deleted file mode 100644
index 6c54ff1..0000000
--- a/school/node_modules/node-forge/nodejs/test/mgf1.js
+++ /dev/null
@@ -1,39 +0,0 @@
-(function() {
-
-function Tests(ASSERT, MGF, MD, UTIL) {
- describe('mgf1', function() {
- it('should digest the empty string', function() {
- var seed = UTIL.hexToBytes('032e45326fa859a72ec235acff929b15d1372e30b207255f0611b8f785d764374152e0ac009e509e7ba30cd2f1778e113b64e135cf4e2292c75efe5288edfda4');
- var expect = UTIL.hexToBytes('5f8de105b5e96b2e490ddecbd147dd1def7e3b8e0e6a26eb7b956ccb8b3bdc1ca975bc57c3989e8fbad31a224655d800c46954840ff32052cdf0d640562bdfadfa263cfccf3c52b29f2af4a1869959bc77f854cf15bd7a25192985a842dbff8e13efee5b7e7e55bbe4d389647c686a9a9ab3fb889b2d7767d3837eea4e0a2f04');
- var mgf = MGF.mgf1.create(MD.sha1.create());
- var result = mgf.generate(seed, expect.length);
- ASSERT.equal(result, expect);
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/mgf',
- 'forge/md',
- 'forge/util'
- ], function(MGF, MD, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- MGF(),
- MD(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/mgf')(),
- require('../../js/md')(),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/pbkdf2.js b/school/node_modules/node-forge/nodejs/test/pbkdf2.js
deleted file mode 100644
index 90e36f0..0000000
--- a/school/node_modules/node-forge/nodejs/test/pbkdf2.js
+++ /dev/null
@@ -1,140 +0,0 @@
-(function() {
-
-function Tests(ASSERT, PBKDF2, MD, UTIL) {
- describe('pbkdf2', function() {
- it('should derive a password with hmac-sha-1 c=1', function() {
- var dkHex = UTIL.bytesToHex(PBKDF2('password', 'salt', 1, 20));
- ASSERT.equal(dkHex, '0c60c80f961f0e71f3a9b524af6012062fe037a6');
- });
-
- it('should derive a password with hmac-sha-1 c=2', function() {
- var dkHex = UTIL.bytesToHex(PBKDF2('password', 'salt', 2, 20));
- ASSERT.equal(dkHex, 'ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957');
- });
-
- it('should derive a password with hmac-sha-1 c=5 keylen=8', function() {
- var salt = UTIL.hexToBytes('1234567878563412');
- var dkHex = UTIL.bytesToHex(PBKDF2('password', salt, 5, 8));
- ASSERT.equal(dkHex, 'd1daa78615f287e6');
- });
-
- it('should derive a password with hmac-sha-1 c=4096', function() {
- // Note: might be too slow on old browsers
- var dkHex = UTIL.bytesToHex(PBKDF2('password', 'salt', 4096, 20));
- ASSERT.equal(dkHex, '4b007901b765489abead49d926f721d065a429c1');
- });
-
- /*
- it('should derive a password with hmac-sha-1 c=16777216', function() {
- // Note: too slow
- var dkHex = UTIL.bytesToHex(PBKDF2('password', 'salt', 16777216, 20));
- ASSERT.equal(dkHex, 'eefe3d61cd4da4e4e9945b3d6ba2158c2634e984');
- });*/
-
- it('should derive a password with hmac-sha-256 c=1000', function() {
- // Note: might be too slow on old browsers
- var salt = '4bcda0d1c689fe465c5b8a817f0ddf3d';
- var md = MD.sha256.create();
- var dkHex = UTIL.bytesToHex(PBKDF2('password', salt, 1000, 48, md));
- ASSERT.equal(dkHex, '9da8a5f4ae605f35e82e5beac5f362df15c4255d88f738d641466a4107f9970238e768e72af29ac89a1b16ff277b31d2');
- });
-
- it('should derive a password with hmac-sha-256 (passed as an algorithm identifier) c=1000', function() {
- // Note: might be too slow on old browsers
- var salt = '4bcda0d1c689fe465c5b8a817f0ddf3d';
- var dkHex = UTIL.bytesToHex(PBKDF2('password', salt, 1000, 48, 'sha256'));
- ASSERT.equal(dkHex, '9da8a5f4ae605f35e82e5beac5f362df15c4255d88f738d641466a4107f9970238e768e72af29ac89a1b16ff277b31d2');
- });
-
- it('should asynchronously derive a password with hmac-sha-1 c=1', function(done) {
- PBKDF2('password', 'salt', 1, 20, function(err, dk) {
- var dkHex = UTIL.bytesToHex(dk);
- ASSERT.equal(dkHex, '0c60c80f961f0e71f3a9b524af6012062fe037a6');
- done();
- });
- });
-
- it('should asynchronously derive a password with hmac-sha-1 c=2', function(done) {
- PBKDF2('password', 'salt', 2, 20, function(err, dk) {
- var dkHex = UTIL.bytesToHex(dk);
- ASSERT.equal(dkHex, 'ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957');
- done();
- });
- });
-
- it('should asynchronously derive a password with hmac-sha-1 c=5 keylen=8', function(done) {
- var salt = UTIL.hexToBytes('1234567878563412');
- PBKDF2('password', salt, 5, 8, function(err, dk) {
- var dkHex = UTIL.bytesToHex(dk);
- ASSERT.equal(dkHex, 'd1daa78615f287e6');
- done();
- });
- });
-
- it('should asynchronously derive a password with hmac-sha-1 c=4096', function(done) {
- // Note: might be too slow on old browsers
- PBKDF2('password', 'salt', 4096, 20, function(err, dk) {
- var dkHex = UTIL.bytesToHex(dk);
- ASSERT.equal(dkHex, '4b007901b765489abead49d926f721d065a429c1');
- done();
- });
- });
-
- /*
- it('should asynchronously derive a password with hmac-sha-1 c=16777216', function(done) {
- // Note: too slow
- PBKDF2('password', 'salt', 16777216, 20, function(err, dk) {
- var dkHex = UTIL.bytesToHex(dk);
- ASSERT.equal(dkHex, 'eefe3d61cd4da4e4e9945b3d6ba2158c2634e984');
- done();
- });
- });*/
-
- it('should asynchronously derive a password with hmac-sha-256 c=1000', function(done) {
- // Note: might be too slow on old browsers
- var salt = '4bcda0d1c689fe465c5b8a817f0ddf3d';
- var md = MD.sha256.create();
- PBKDF2('password', salt, 1000, 48, md, function(err, dk) {
- var dkHex = UTIL.bytesToHex(dk);
- ASSERT.equal(dkHex, '9da8a5f4ae605f35e82e5beac5f362df15c4255d88f738d641466a4107f9970238e768e72af29ac89a1b16ff277b31d2');
- done();
- });
- });
-
- it('should asynchronously derive a password with hmac-sha-256 (passed as an algorithm identifier) c=1000', function(done) {
- // Note: might be too slow on old browsers
- var salt = '4bcda0d1c689fe465c5b8a817f0ddf3d';
- PBKDF2('password', salt, 1000, 48, 'sha256', function(err, dk) {
- var dkHex = UTIL.bytesToHex(dk);
- ASSERT.equal(dkHex, '9da8a5f4ae605f35e82e5beac5f362df15c4255d88f738d641466a4107f9970238e768e72af29ac89a1b16ff277b31d2');
- done();
- });
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/pbkdf2',
- 'forge/md',
- 'forge/util'
- ], function(PBKDF2, MD, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- PBKDF2(),
- MD(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/pbkdf2')(),
- require('../../js/md')(),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/pem.js b/school/node_modules/node-forge/nodejs/test/pem.js
deleted file mode 100644
index 6b405cb..0000000
--- a/school/node_modules/node-forge/nodejs/test/pem.js
+++ /dev/null
@@ -1,104 +0,0 @@
-(function() {
-
-function Tests(ASSERT, PEM) {
- var _input = '-----BEGIN PRIVACY-ENHANCED MESSAGE-----\r\n' +
- 'Proc-Type: 4,ENCRYPTED\r\n' +
- 'Content-Domain: RFC822\r\n' +
- 'DEK-Info: DES-CBC,F8143EDE5960C597\r\n' +
- 'Originator-ID-Symmetric: linn@zendia.enet.dec.com,,\r\n' +
- 'Recipient-ID-Symmetric: linn@zendia.enet.dec.com,ptf-kmc,3\r\n' +
- 'Key-Info: DES-ECB,RSA-MD2,9FD3AAD2F2691B9A,\r\n' +
- ' B70665BB9BF7CBCDA60195DB94F727D3\r\n' +
- 'Recipient-ID-Symmetric: pem-dev@tis.com,ptf-kmc,4\r\n' +
- 'Key-Info: DES-ECB,RSA-MD2,161A3F75DC82EF26,\r\n' +
- ' E2EF532C65CBCFF79F83A2658132DB47\r\n' +
- '\r\n' +
- 'LLrHB0eJzyhP+/fSStdW8okeEnv47jxe7SJ/iN72ohNcUk2jHEUSoH1nvNSIWL9M\r\n' +
- '8tEjmF/zxB+bATMtPjCUWbz8Lr9wloXIkjHUlBLpvXR0UrUzYbkNpk0agV2IzUpk\r\n' +
- 'J6UiRRGcDSvzrsoK+oNvqu6z7Xs5Xfz5rDqUcMlK1Z6720dcBWGGsDLpTpSCnpot\r\n' +
- 'dXd/H5LMDWnonNvPCwQUHg==\r\n' +
- '-----END PRIVACY-ENHANCED MESSAGE-----\r\n' +
- '-----BEGIN PRIVACY-ENHANCED MESSAGE-----\r\n' +
- 'Proc-Type: 4,ENCRYPTED\r\n' +
- 'Content-Domain: RFC822\r\n' +
- 'DEK-Info: DES-CBC,BFF968AA74691AC1\r\n' +
- 'Originator-Certificate:\r\n' +
- ' MIIBlTCCAScCAWUwDQYJKoZIhvcNAQECBQAwUTELMAkGA1UEBhMCVVMxIDAeBgNV\r\n' +
- ' BAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMQ8wDQYDVQQLEwZCZXRhIDExDzAN\r\n' +
- ' BgNVBAsTBk5PVEFSWTAeFw05MTA5MDQxODM4MTdaFw05MzA5MDMxODM4MTZaMEUx\r\n' +
- ' CzAJBgNVBAYTAlVTMSAwHgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEU\r\n' +
- ' MBIGA1UEAxMLVGVzdCBVc2VyIDEwWTAKBgRVCAEBAgICAANLADBIAkEAwHZHl7i+\r\n' +
- ' yJcqDtjJCowzTdBJrdAiLAnSC+CnnjOJELyuQiBgkGrgIh3j8/x0fM+YrsyF1u3F\r\n' +
- ' LZPVtzlndhYFJQIDAQABMA0GCSqGSIb3DQEBAgUAA1kACKr0PqphJYw1j+YPtcIq\r\n' +
- ' iWlFPuN5jJ79Khfg7ASFxskYkEMjRNZV/HZDZQEhtVaU7Jxfzs2wfX5byMp2X3U/\r\n' +
- ' 5XUXGx7qusDgHQGs7Jk9W8CW1fuSWUgN4w==\r\n' +
- 'Key-Info: RSA,\r\n' +
- ' I3rRIGXUGWAF8js5wCzRTkdhO34PTHdRZY9Tuvm03M+NM7fx6qc5udixps2Lng0+\r\n' +
- ' wGrtiUm/ovtKdinz6ZQ/aQ==\r\n' +
- 'Issuer-Certificate:\r\n' +
- ' MIIB3DCCAUgCAQowDQYJKoZIhvcNAQECBQAwTzELMAkGA1UEBhMCVVMxIDAeBgNV\r\n' +
- ' BAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMQ8wDQYDVQQLEwZCZXRhIDExDTAL\r\n' +
- ' BgNVBAsTBFRMQ0EwHhcNOTEwOTA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Hfi6/MhPfPF3d\r\n' +
- 'jIqCJAxvld2xgqQimUzoS1a4r7kQQ5c/Iua4LqKeq3ciFzEv/MbZhA==\r\n' +
- '-----END PRIVACY-ENHANCED MESSAGE-----\r\n' +
- '-----BEGIN RSA PRIVATE KEY-----\r\n' +
- 'MIIBPAIBAAJBALjXU+IdHkSkdBscgXf+EBoa55ruAIsU50uDFjFBkp+rWFt5AOGF\r\n' +
- '9xL1/HNIby5M64BCw021nJTZKEOmXKdmzYsCAwEAAQJBAApyYRNOgf9vLAC8Q7T8\r\n' +
- 'bvyKuLxQ50b1D319EywFgLv1Yn0s/F9F+Rew6c04Q0pIqmuOGUM7z94ul/y5OlNJ\r\n' +
- '2cECIQDveEW1ib2+787l7Y0tMeDzf/HQl4MAWdcxXWOeUFK+7QIhAMWZsukutEn9\r\n' +
- '9/yqFMt8bL/dclfNn1IAgUL4+dMJ7zdXAiEAhaxGhVKxN28XuCOFhe/s2R/XdQ/O\r\n' +
- 'UZjU1bqCzDGcLvUCIGYmxu71Tg7SVFkyM/3eHPozKOFrU2m5CRnuTHhlMl2RAiEA\r\n' +
- '0vhM5TEmmNWz0anPVabqDj9TA0z5MsDJQcn5NmO9xnw=\r\n' +
- '-----END RSA PRIVATE KEY-----\r\n';
-
- describe('pem', function() {
- it('should decode and re-encode PEM messages', function() {
- var msgs = PEM.decode(_input);
-
- var output = '';
- for(var i = 0; i < msgs.length; ++i) {
- output += PEM.encode(msgs[i]);
- }
-
- ASSERT.equal(output, _input);
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/pem'
- ], function(PEM) {
- Tests(
- // Global provided by test harness
- ASSERT,
- PEM()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/pem')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/pkcs1.js b/school/node_modules/node-forge/nodejs/test/pkcs1.js
deleted file mode 100644
index 889eb6d..0000000
--- a/school/node_modules/node-forge/nodejs/test/pkcs1.js
+++ /dev/null
@@ -1,1105 +0,0 @@
-(function() {
-
-function Tests(ASSERT, PKI, PKCS1, MD, JSBN, UTIL) {
- var BigInteger = JSBN.BigInteger;
-
- // RSA's test vectors for Forge's RSA-OAEP implementation:
- // http://www.rsa.com/rsalabs/node.asp?id=2125
- describe('pkcs1', function() {
- it('should detect invalid RSAES-OAEP padding', function() {
- var keys = makeKey();
-
- // provide the seed to test the same input each time
- var seed = UTIL.decode64('JRTfRpV1WmeyiOr0kFw27sZv0v0=');
-
- // test decrypting corrupted data: flip every bit (skip first byte to
- // avoid triggering other invalid encryption error) in the message this
- // tests the padding error handling
- var encoded = PKCS1.encode_rsa_oaep(
- keys.publicKey, 'datadatadatadata', {seed: seed});
- var encrypted = keys.publicKey.encrypt(encoded, null);
- var bitLength = encrypted.length * 8;
- // FIXME: test it too slow to run all the time -- temporary
- // change only does partial checks, need a longer term fix
- bitLength /= 8;
- for(var bit = 8; bit < bitLength; ++bit) {
- var byteIndex = bit / 8;
- var bitInByte = bit % 8;
-
- var out = encrypted.substring(0, byteIndex);
- var mask = 0x1 << bitInByte;
- out += String.fromCharCode(encrypted.charCodeAt(byteIndex) ^ mask);
- out += encrypted.substring(byteIndex + 1);
-
- try {
- var decrypted = keys.privateKey.decrypt(out, null);
- PKCS1.decode_rsa_oaep(keys.privateKey, decrypted);
- throw {
- message: 'Expected an exception.'
- };
- } catch(e) {
- ASSERT.equal(e.message, 'Invalid RSAES-OAEP padding.');
- }
- }
- });
-
- it('should detect leading zero bytes', function() {
- var keys = makeKey();
- var message = UTIL.fillString('\x00', 80);
- var encoded = PKCS1.encode_rsa_oaep(keys.publicKey, message);
- var ciphertext = keys.publicKey.encrypt(encoded, null);
- var decrypted = keys.privateKey.decrypt(ciphertext, null);
- var decoded = PKCS1.decode_rsa_oaep(keys.privateKey, decrypted);
- ASSERT.equal(message, decoded);
- });
-
- testOAEP();
- testOAEPSHA256();
-
- function testOAEP() {
- var modulus, exponent, d, p, q, dP, dQ, qInv, pubkey, privateKey;
- var examples;
-
- // Example 1: A 1024-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'qLOyhK+OtQs4cDSoYPFGxJGfMYdjzWxVmMiuSBGh4KvEx+CwgtaTpef87Wdc9GaFEncsDLxkp0LGxjD1M8jMcvYq6DPEC/JYQumEu3i9v5fAEH1VvbZi9cTg+rmEXLUUjvc5LdOq/5OuHmtme7PUJHYW1PW6ENTP0ibeiNOfFvs=';
- exponent = 'AQAB';
- d = 'UzOc/befyEZqZVxzFqyoXFX9j23YmP2vEZUX709S6P2OJY35P+4YD6DkqylpPNg7FSpVPUrE0YEri5+lrw5/Vf5zBN9BVwkm8zEfFcTWWnMsSDEW7j09LQrzVJrZv3y/t4rYhPhNW+sEck3HNpsx3vN9DPU56c/N095lNynq1dE=';
- p = '0yc35yZ//hNBstXA0VCoG1hvsxMr7S+NUmKGSpy58wrzi+RIWY1BOhcu+4AsIazxwRxSDC8mpHHcrSEurHyjnQ==';
- q = 'zIhT0dVNpjD6wAT0cfKBx7iYLYIkpJDtvrM9Pj1cyTxHZXA9HdeRZC8fEWoN2FK+JBmyr3K/6aAw6GCwKItddw==';
- dP = 'DhK/FxjpzvVZm6HDiC/oBGqQh07vzo8szCDk8nQfsKM6OEiuyckwX77L0tdoGZZ9RnGsxkMeQDeWjbN4eOaVwQ==';
- dQ = 'lSl7D5Wi+mfQBwfWCd/U/AXIna/C721upVvsdx6jM3NNklHnkILs2oZu/vE8RZ4aYxOGt+NUyJn18RLKhdcVgw==';
- qInv = 'T0VsUCSTvcDtKrdWo6btTWc1Kml9QhbpMhKxJ6Y9VBHOb6mNXb79cyY+NygUJ0OBgWbtfdY2h90qjKHS9PvY4Q==';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 1.1',
- message: 'ZigZThIHPbA7qUzanvlTI5fVDbp5uYcASv7+NA==',
- seed: 'GLd26iEGnWl3ajPpa61I4d2gpe8=',
- encrypted: 'NU/me0oSbV01/jbHd3kaP3uhPe9ITi05CK/3IvrUaPshaW3pXQvpEcLTF0+K/MIBA197bY5pQC3lRRYYwhpTX6nXv8W43Z/CQ/jPkn2zEyLW6IHqqRqZYXDmV6BaJmQm2YyIAD+Ed8EicJSg2foejEAkMJzh7My1IQA11HrHLoo='
- }, {
- title: 'RSAES-OAEP Encryption Example 1.2',
- message: 'dQxAR/VH6OQUEYVlIymKybriRe+vE5f75W+d1Q==',
- seed: 'DMdCzkqbfzL5UbyyUe/ZJf5P418=',
- encrypted: 'ZA2xrMWOBWj+VAfl+bcB3/jDyR5xbFNvx/zsbLW3HBFlmI1KJ54Vd9cw/Hopky4/AMgVFSNtjY4xAXp6Cd9DUtkEzet5qlg63MMeppikwFKD2rqQib5UkfZ8Gk7kjcdLu+ZkOu+EZnm0yzlaNS1e0RWRLfaW/+BwKTKUbXFJK0Q='
- }, {
- title: 'RSAES-OAEP Encryption Example 1.3',
- message: '2Urggy5kRc5CMxywbVMagrHbS6rTD3RtyRbfJNTjwkUf/1mmQj6w4dAtT+ZGz2md/YGMbpewUQ==',
- seed: 'JRTfRpV1WmeyiOr0kFw27sZv0v0=',
- encrypted: 'Qjc27QNfYCavJ2w1wLN0GzZeX3bKCRtOjCni8L7+5gNZWqgyLWAtLmJeleuBsvHJck6CLsp224YYzwnFNDUDpDYINbWQO8Y344efsF4O8yaF1a7FBnzXzJb+SyZwturDBmsfz1aGtoWJqvt9YpsC2PhiXKODNiTUgA+wgbHPlOs='
- }, {
- title: 'RSAES-OAEP Encryption Example 1.4',
- message: 'UuZQ2Y5/KgSLT4aFIVO5fgHdMW80ahn2eoU=',
- seed: 'xENaPhoYpotoIENikKN877hds/s=',
- encrypted: 'RerUylUeZiyYAPGsqCg7BSXmq64wvktKunYvpA/T044iq+/Gl5T267vAXduxEhYkfS9BL9D7qHxuOs2IiBNkb9DkjnhSBPnD9z1tgjlWJyLd3Ydx/sSLg6Me5vWSxM/UvIgXTzsToRKq47n3uA4PxvclW6iA3H2AIeIq1qhfB1U='
- }, {
- title: 'RSAES-OAEP Encryption Example 1.5',
- message: 'jaif2eX5dKKf7/tGK0kYD2z56AI=',
- seed: 'sxjELfO+D4P+qCP1p7R+1eQlo7U=',
- encrypted: 'NvbjTZSo002qy6M6ITnQCthak0WoYFHnMHFiAFa5IOIZAFhVohOg8jiXzc1zG0UlfHd/6QggK+/dC1g4axJE6gz1OaBdXRAynaROEwMP12Dc1kTP7yCU0ZENP0M+HHxt0YvB8t9/ZD1mL7ndN+rZBZGQ9PpmyjnoacTrRJy9xDk='
- }, {
- title: 'RSAES-OAEP Encryption Example 1.6',
- message: 'JlIQUIRCcQ==',
- seed: '5OwJgsIzbzpnf2o1YXTrDOiHq8I=',
- encrypted: 'Qs7iYXsezqTbP0gpOG+9Ydr78DjhgNg3yWNm3yTAl7SrD6xr31kNghyfEGQuaBrQW414s3jA9Gzi+tY/dOCtPfBrB11+tfVjb41AO5BZynYbXGK7UqpFAC6nC6rOCN7SQ7nYy9YqaK3iZYMrVlZOQ6b6Qu0ZmgmXaXQt8VOeglU='
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha1', examples);
-
- // Example 2: A 1025-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'AZR8f86QQl9HJ55whR8l1eYjFv6KHfGTcePmKOJgVD5JAe9ggfaMC4FBGQ0q6Nq6fRJQ7G22NulE7Dcih3x8HQpn8UsWlMXwN5RRpD5Joy3eg2cLc9qRocmbwjtDamAFXGEPC6+ZwaB5VluVo/FSZjLR1Npg8g7aJeZTxPACdm9F';
- exponent = 'AQAB';
- d = 'CCPyD6212okIip0AiT4h+kobEfvJPGSjvguq6pf7O5PD/3E3BMGcljwdEHqumQVHOfeeAuGG3ob4em3e/qbYzNHTyBpHv6clW+IGAaSksvCKFnteJ51xWxtFW91+qyRZQdl2i5rO+zzNpZUto87nJSW0UBZjqO4VyemS2SRi/jk=';
- p = 'AVnb3gSjPvBvtgi4CxkPTT4ivME6yOSggQM6v6QW7bCzOKoItXMJ6lpSQOfcblQ3jGlBTDHZfdsfQG2zdpzEGkM=';
- q = 'AStlLzBAOzi0CZX9b/QaGsyK2nA3Mja3IC05su4wz7RtsJUR9vMHzGHMIWBsGKdbimL4It8DG6DfDa/VUG9Wi9c=';
- dP = 'Q271CN5zZRnC2kxYDZjILLdFKj+1763Ducd4mhvGWE95Wt270yQ5x0aGVS7LbCwwek069/U57sFXJIx7MfGiVQ==';
- dQ = 'ASsVqJ89+ys5Bz5z8CvdDBp7N53UNfBc3eLv+eRilIt87GLukFDV4IFuB4WoVrSRCNy3XzaDh00cpjKaGQEwZv8=';
- qInv = 'AnDbF9WRSwGNdhGLJDiac1Dsg2sAY6IXISNv2O222JtR5+64e2EbcTLLfqc1bCMVHB53UVB8eG2e4XlBcKjI6A==';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 2.1',
- message: 'j/AMqmBccCgwY02abD1CxlK1jPHZL+xXC+7n',
- seed: 'jEB7XsKJnlCZxT6M55O/lOcbF4I=',
- encrypted: 'AYGviSK5/LTXnZLr4ZgVmS/AwUOdi81JE5ig9K06Mppb2ThVYNtTJoPIt9oE5LEq7Wqs30ccNMnNqJGt3MLfNFZlOqY4Lprlm1RFUlfrCZ1WK74QRT8rbRPFnALhDx+Ku12g0FcJMtrPLQkB23KdD+/MBU5wlo6lQMgbBLyu/nIO'
- }, {
- title: 'RSAES-OAEP Encryption Example 2.2',
- message: 'LQ==',
- seed: 'tgDPPC5QbX8Wd4yRDTqLAD7uYdU=',
- encrypted: 'AYdZ/x32OyeSQQViMUQWqK6vKsY0tG+UCrgtZNvxZe7jMBHadJ1Lq24vzRgSnJ5JJ32EUxErQpoiKoRxsHCZOZjnWIYcTT9tdJ2RxCkNMyx6SrP36jX/OgfUl8lV/w/8lQBrYsbSloENm/qwJBlseTQBLC35eO8pmrojmUDLoQJF'
- }, {
- title: 'RSAES-OAEP Encryption Example 2.3',
- message: 'dPyIxRvJD3evnV6aSnATPUtOCzTaPDfH744=',
- seed: 'pzdoruqpH52MHtb50rY0Z/B8yuM=',
- encrypted: 'AYgCurBMYDJegcSWIxHyvnwq3OkwQaAHGciPlXV18sefG3vIztEVxwazEcCKLZhso7apM2sUfCnG8ilAnd7GUb0f3VoLf2EMmTf9tKOnYjZLizIGtOpIX9CY0I9j1KqLsml9Ant1DDLX906vUYDS6bZrF8svpVUjvCgNoQ0UviBT'
- }, {
- title: 'RSAES-OAEP Encryption Example 2.4',
- message: 'p+sqUDaTHSfU6JEybZlpL/rdqb9+/T405iLErcCF9yHf6IUHLHiiA7FRc5vlQPqMFToQ8Ao=',
- seed: 'mns7DnCL2W+BkOyrT7mys4BagVY=',
- encrypted: 'AKRXjLwXYximOPun0B3xV0avRNT2zZbX58SVy/QlsJxknTK/iG2kj7r5iaIRcYfK+x+1gDF2kOPM1EaSC3r4KzHbWATYfQFRSsv6kVbngvhn9r7ZRJ4OmiwJvOzGqgh2NpZeNLPsdm8v4uQwGKL93rFAYWoOnYLlMxAk7gZS/HZB'
- }, {
- title: 'RSAES-OAEP Encryption Example 2.5',
- message: 'LvKwZvhUwz873LtZlKQ15z1sbA==',
- seed: '6zzrvErcFrtI6IyK7A40r39Cf9M=',
- encrypted: 'AOvF9f2nfP2tPINkGpAl531y2Kb7M6gQ9ZUPjXTHPo2THoY02GqxJGJWrge2AFtxt/L7mDUSGDMc5puP+9ydoIu8nHBPh23rnfn8LsBlyth/kJCweswXqn+ZeyespIgG6Jf3cdlRQf5FJtilMBtnhifvq3B/1A++vW55KiVhPnrs'
- }, {
- title: 'RSAES-OAEP Encryption Example 2.6',
- message: 'in+zRMi2yyzy7x9kP5oyGPbhm7qJwA==',
- seed: 'TEXPTVfJjj1tIJWtxRxInrUN/4Q=',
- encrypted: 'AQg57CDCe5BS5Vvvubd+b8JukHXXpUN4xkar31HkRb1XFd6BeJ9W8YA9kXB2Sp6Ty3h5hpQCPuc5POBLxdj4xaUsFx1Dg346ymL2CesKpf+wlg7wQZjddU9X9/vmq/dlzxGLTKRDsjtaqyZvlSMmrEWBEAZEMl+LchrNXQT/FO86'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha1', examples);
-
- // Example 3: A 1026-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'ArWP7AOahgcApNe2Ri+T5s3UkRYd3XT06BC0DjwWUgBqXCd7J3TBEwWky6taeO+lfheobfej+jb8Sx0iSfIux8LdakYyMqzOqQbWbr6AtXBLEHKdpvgzI0q7Xv3UopLL+tM7TTP6ehS4w5e1bjrNISA0KLd836M6bacGs9iw/EPp';
- exponent = 'AQAB';
- d = 'FbSKW1aDqUZw4jtXGPgU+g4T+FA49QcRGCy6YVEFgfPSLH4jLvk34i5VHWi4bi+MsarYvi5Ij13379J54/Vo1Orzb4DPcUGs5g/MkRP7bEqEH9ULvHxRL/y+/yFIeqgR6zyoxiAFNGqG3oa/odipSP0/NIwi6q3zM8PObOEyCP0=';
- p = 'Ab8B0hbXNZXPAnDCvreNQKDYRH0x2pGamD9+6ngbd9hf43Gz6Tc+e2khfTFQoC2JWN5/rZ1VUWCVi0RUEn4Ofq8=';
- q = 'AY0zmWWBZts4KYFteylUFnWenJGYf1stiuzWOwS0i9ey/PIpu3+KbciLoT3S45rVW20aBhYHCPlwC+gLj9N0TOc=';
- dP = 'BsCiSdIKby7nXIi0lNU/aq6ZqkJ8iMKLFjp2lEXl85DPQMJ0/W6mMppc58fOA6IVg5buKnhFeG4J4ohalyjk5Q==';
- dQ = '0dJ8Kf7dkthsNI7dDMv6wU90bgUc4dGBHfNdYfLuHJfUvygEgC9kJxh7qOkKivRCQ7QHmwNEXmAuKfpRk+ZP6Q==';
- qInv = 'jLL3Vr2JQbHTt3DlrTHuNzsorNpp/5tvQP5Xi58a+4WDb5Yn03rP9zwneeY0uyYBHCyPfzNhriqepl7WieNjmg==';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 3.1',
- message: 'CHggtWno+o0=',
- seed: 'jO1rGWKQgFeQ6QkHQBXmogsMSJQ=',
- encrypted: 'AmoEhdlq69lrQ4IIUJm5Yuaivew9kMjbYl4UNy3oXi1be6q2XI+vkbtVBPtJWvzlyYiz9qUuIOHWy9NWbFzR8rgxi7VCzA6iXEqrmTKvogdg6t3seEOWoH6g7yTU5vTTflBSp6MeFGqkgKERu+kmQBMH4A9BADOEK22C/lzk366A'
- }, {
- title: 'RSAES-OAEP Encryption Example 3.2',
- message: 'RlOsrxcZYLAfUqe+Y6OrIdw2jsQ7UNguw3geBA==',
- seed: 'tCkdZWdVCEjMFWlnyAm6q2ylB/A=',
- encrypted: 'Ak24nHgCmJvgeDhHhjCElBvyCddhmH44+Xy19vG8iNpypQtz668RyHnE+V3ze4ULj2XXYi4lsbiJ6A/oC6yiBp1uDh2CmVP8RZBp3pjql5i0UeVX6Zq/j+PZzPkJbrvz5SVdO04cbS7K3wZ6NZ7qhkBazUfV4WVRfMr9R9bb7kv1'
- }, {
- title: 'RSAES-OAEP Encryption Example 3.3',
- message: '2UzQ4I+kBO2J',
- seed: 'zoko9gWVWCVACLrdl5T63NL9H2U=',
- encrypted: 'Ajm85oEDJEFSiHfW0ci7KKo7yX8d9YRWNhiZV5doOETKhmZHMvS+16CqsIOqq/tyOPWC4wlYwgJOROVwQ7l5UP1UPal3yQzd5TN9YYRC+Z5g13g6tZzm3Z1pxHrR6WK+wi0FiVz/jT9k7VJh2SsmeFEDk0hJkLo/fwaBiub/zoo6'
- }, {
- title: 'RSAES-OAEP Encryption Example 3.4',
- message: 'bMZBtrYeb5Y5dNrSOpATKE7x',
- seed: 'bil59S1oFKV9g7CQBUiI8RmluaM=',
- encrypted: 'AplMYq/Xb0mLof0s9kKFf8qB9Dc8sI8cuu5vAlw7UStCw+h3kRNHZkgDnb4Ek/kkYpL6wolQYA58DzLt+cgbnexFw73gzI2IR1kBaZB7fcWZHOspuwcU1hPZbfDxLsXY01B8jueueN2D8hb6Yd4QA2OspIp+kUrp9C3fvpQ7Cdmg'
- }, {
- title: 'RSAES-OAEP Encryption Example 3.5',
- message: '31FRgyth9PJYkftBcvMo0u3fg3H/z9vpl5OSlfMOymkYAXz9oRU796avh1kyIw==',
- seed: 'LXYL/jjFneNM3IuMeKOOZihKLSc=',
- encrypted: 'AWIEL/aWlZKmFnAxgRojmDTOY4q/VP7IuZR4Eir+LuZ/jFsYsDOYBb/bxaTmcgs3xZz7qUJGTFl/9TKhGYIVRf0uWbEU5h2vcYIFKfUCnPUklUMnw07F5vW6fvzE3pQ6uK1O14exRUMp9w23mKOo9NkvgnTispSK3mJ86O4z5Dxg'
- }, {
- title: 'RSAES-OAEP Encryption Example 3.6',
- message: 'PDutiTxUSm1SCrAiMZGIyNUEt6eIuFCQO4WXLqoYVS4RNKetYJiCYlT/erZys9jrMVj6xtTLrvE=',
- seed: '8XR3nF/Tz+AHuty3o2ybVb/Pvw4=',
- encrypted: 'ABEgUeddBklDvER4B15DSC/VnO4Ged5ok+7DqUPapJC5aRyT38BGS2YjufPb0+cAgyZPA0s3T3QWThoAdjcl5XR0S6C524NDTzHflvbiom9tjro0i9RobCI4rAfDeqw3hdHH7qL4Gf2RSReY7Y6c715Dt4Gw4CduN8Q/+UktAFcw'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha1', examples);
-
- // Example 4: A 1027-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'BRJAtswABPpI0BNGccB4x8jew7Pi8lvCVkRnM52ziFPQa4XupbLeNTv/QqwuRryX+uaslhjalTelyPVTweNXYlmR1hCNzXiF+zolQT9T78rZSMs1zZua6cHGdibRE9V93kxb6na7W7felsANBzculoWm11z50jn6FI1wkxtfP7A5';
- exponent = 'AQAB';
- d = 'BBH/yjt8penpvn/jioUQXjU4ltsFxXlq7NKnJRYes2UchimpuGK5BNewx7N/jLWhwrVAAQGKAKHrLK/k7k6UksNIvCvtq0ueu/Bk6O/zIrkAn47sZTkF9A34ijzcSdRWf3VifUGspiQSm0agt8aY5eZfK3uhAsdJoQE1tlQNBAE=';
- p = 'AnRYwZ7BY2kZ5zbJryXWCaUbj1YdGca/aUPdHuGriko/IyEAvUC4jezGuiNVSLbveSoRyd6CPQp5IscJW266VwE=';
- q = 'AhDumzOrYXFuJ9JRvUZfSzWhojLi2gCQHClL8iNQzkkNCZ9kK1N1YS22O6HyA4ZJK/BNNLPCK865CdE0QbU7UTk=';
- dP = 'OfoCi4JuiMESG3UKiyQvqaNcW2a9/R+mN9PMSKhKT0V6GU53J+Sfe8xuWlpBJlf8RwxzIuvDdBbvRYwweowJAQ==';
- dQ = 'AV2ZqEGVlDl5+p4b4sPBtp9DL0b9A+R9W++7v9ax0Tcdg++zMKPgIJQrL+0RXl0CviT9kskBnRzs1t1M8eVMyJk=';
- qInv = 'AfC3AVFws/XkIiO6MDAcQabYfLtw4wy308Z9JUc9sfbL8D4/kSbj6XloJ5qGWywrQmUkz8UqaD0x7TDrmEvkEro=';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 4.1',
- message: 'SoZglTTuQ0psvKP36WLnbUVeMmTBn2Bfbl/2E3xlxW1/s0TNUryTN089FmyfDG+cUGutGTMJctI=',
- seed: 'HKwZzpk971X5ggP2hSiWyVzMofM=',
- encrypted: 'BMzhlhSEXglBUqP+GOVOMzDETl77xkrhaIbLGGkBTMV4Gx+PngRThNARKhNcoNEunIio5AY0Ft6q44RPYNbpb+FVFF9FJbmjRDHKN2YYD3DhWl5djosaUW/4cGCfE/iWk1ztGIJ5pY7RPQcRQnfXXGVoYH4KsJL9gDoiPkqO4LGo'
- }, {
- title: 'RSAES-OAEP Encryption Example 4.2',
- message: 'sK3E8/4R2lnOmSdz2QWZQ8AwRkl+6dn5oG3xFm20bZj1jSfsB0wC7ubL4kSci5/FCAxcP0QzCSUS7EaqeTdDyA==',
- seed: '9UXViXWF49txqgy42nbFHQMq6WM=',
- encrypted: 'AJe2mMYWVkWzA0hvv1oqRHnA7oWIm1QabwuFjWtll7E7hU60+DmvAzmagNeb2mV4yEH5DWRXFbKA03FDmS3RhsgLlJt3XK6XNw5OyXRDE2xtpITpcP/bEyOiCEeCHTsYOB3hO7SarqZlMMSkuCcfPq4XLNNm4H5mNvEBnSoortFe'
- }, {
- title: 'RSAES-OAEP Encryption Example 4.3',
- message: 'v21C5wFwex0CBrDItFoccmQf8SiJIZqCveqWW155qWsNAWPtnVeOya2iDy+88eo8QInYNBm6gbDGDzYG2pk=',
- seed: 'rZl/7vcw1up75g0NxS5y6sv90nU=',
- encrypted: 'AwH5NenEery0isu+CYldn1lxrxSDnaT/lUF+5FPR/XcxkHK7cpfhtV11Yc2dG7JMGpo3xhmGQwgkKASHnYbr0AHc5Rg5deFQaYm3DlqDQ0FU1cv9aiR4fmDrDGWNKsGTMC0RksbmItShKtS1OSO8okbfMcY5XjdwLGp4rggfudBl'
- }, {
- title: 'RSAES-OAEP Encryption Example 4.4',
- message: '+y7xEvXnZuuUAZKXk0eU974vb8HFjg==',
- seed: 'E2RU31cw9zyAen5A2MGjEqxbndM=',
- encrypted: 'AtEQrTCvtye+tpHdDPF9CvGh5/oMwEDsGkuiakLFnQp5ai4iyPNXzMmLZRms62gulF5iy3NGFKUpQHzUUr7j5E/s6EI8wZ5VVIuLmUuEnH7N5JM+dgN+HQzkQnWwhxDGjkMBMLkpcw7XfgmwFWQsVZPwTk/7lBB5gQKo6W/9/hHk'
- }, {
- title: 'RSAES-OAEP Encryption Example 4.5',
- message: 'KMzUR7uehRZtq7nlt9GtrcS5058gTpbV5EDOmtkovBwihA==',
- seed: 'vKgFf4JLLqJX8oYUB+72PTMghoE=',
- encrypted: 'ANu4p0OdkO/ZGaN3xU+uj+EexYw7hYNi4jrRuKRDEHmQZrmTR6pSVpHSrcWNmwbjTyiMFwOQxfDhHAqjZFlZ8Y7nno8r6NesXCPQYfGN10uMXypY/LXrDFT5nwGoMkdWgpJTZYM0CUjXqMl8Ss0emNHincMg6XomBTKoqnp1ih7C'
- }, {
- title: 'RSAES-OAEP Encryption Example 4.6',
- message: '8iJCdR7GsQ==',
- seed: 'Ln4eF/ZHtd3QM+FUcvkPaBLzrE4=',
- encrypted: 'AKX/pHaMi77K7i23fo8u7JlZWTNUVSCDXlun25ST0+F83e/mpfVnYkRxkI204tg6D77mBgj8hASVA7IjSgfcg7J7IoR62JIP9C9nTvebdigLACM9K1G4yycDqdQr+8glDJbsMsBR5X8bS6Uo24nDfkxU4n5uZKxpY1roh9lUFhmp'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha1', examples);
-
- // Example 5: A 1028-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'Cq3z+cEl5diR8xrESOmT3v5YD4ArRfnX8iulAh6cR1drWh5oAxup205tq+TZah1vPSZyaM/0CABfEY78rbmYiNHCNEZxZrKiuEmgWoicBgrA2gxfrotV8wm6YucDdC+gMm8tELARAhSJ/0l3cBkNiV/Tn1IpPDnv1zppi9q58Q7Z';
- exponent = 'AQAB';
- d = 'AlbrTLpwZ/LSvlQNzf9FgqNrfTHRyQmbshS3mEhGaiaPgPWKSawEwONkiTSgIGwEU3wZsjZkOmCCcyFE33X6IXWI95RoK+iRaCdtxybFwMvbhNMbvybQpDr0lXF/fVKKz+40FWH2/zyuBcV4+EcNloL5wNBy+fYGi1bViA9oK+LF';
- p = 'A7DTli9tF1Scv8oRKUNI3PDn45+MK8aCTyFktgbWh4YNrh5jI5PP7fUTIoIpBp4vYOSs1+YzpDYGP4I4X0iZNwc=';
- q = 'AuTDLi9Rcmm3ByMJ8AwOMTZffOKLI2uCkS3yOavzlXLPDtYEsCmC5TVkxS1qBTl95cBSov3cFB73GJg2NGrrMx8=';
- dP = 'AehLEZ0lFh+mewAlalvZtkXSsjLssFsBUYACmohiKtw/CbOurN5hYat83iLCrSbneX31TgcsvTsmc4ALPkM429U=';
- dQ = '65CqGkATW0zqBxl87ciBm+Hny/8lR2YhFvRlpKn0h6sS87pP7xOCImWmUpfZi3ve2TcuP/6Bo4s+lgD+0FV1Tw==';
- qInv = 'AS9/gTj5QEBi64WkKSRSCzj1u4hqAZb0i7jc6mD9kswCfxjngVijSlxdX4YKD2wEBxp9ATEsBlBi8etIt50cg8s=';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 5.1',
- message: 'r3GpAeOmHTEy8Pwf20dPnqZXklf/wk0WQXAUWz296A==',
- seed: 'RMkuKD93uUmcYD2WNmDIfS+TlGE=',
- encrypted: 'A2BGpKR9ntO6mokTnBBQOOt0krBaXWi/1TrM/0WX96aGUbR7SkYn2Sfkhe7XtFZkIOi0CYeeXWBuriUdIqXfeZ95IL/BF7mSVypTsSYxRrzqAzhcxehTyaEByMPhvaMaUZgHSWxsteXvtAiCOjUrj6BmH7Zk763Vk965n/9e0ADl'
- }, {
- title: 'RSAES-OAEP Encryption Example 5.2',
- message: 'o7hEoII5qKxBYFrxemz9pNNQE2WFkDpBenkmh2BRmktKwzA+xz8Ph8+zI5k=',
- seed: 'yyj1hgZZ/O7knD7q/OYlpwgDvTI=',
- encrypted: 'A9brZU7c5hW8WfRVJl7U5aGCI8u5vk5AabRzgE1d6W9U3KqmA9BJxdlKoUcN/NIlQGa3x7Yf8fb2dw4yFcUTmf1ONOxQgrxI8ImECtBDVK5m3A8b0Y5GGjPMEli0Q6KDem3yZ1mqIwIzSYb4c4DJzJ1Tvp+ZYF0smpfaewkVpKet'
- }, {
- title: 'RSAES-OAEP Encryption Example 5.3',
- message: 'MIsOy9LHbLd/xvcMXt0jP9LyCSnWKfAmlTu2Ko9KOjFL3hld6FtfgW2iqrB00my2rN3zI647nGeKw88S+93n',
- seed: 'IoX0DXcEgvmp76LHLLOsVXFtwMo=',
- encrypted: 'B3CVIYFkn5+fB/9ib/OiLDXEYkQ9kF1Fap/Qv/Q8rCynqfVU6UeLmsw6yDiwIED/0+GEfeLkJTkp+d2e5ARDJamwXKu4CLLuhA004V0QWj8feydpWhoHotc/4I7KqjycnU1aif+JDVRyfXrkDA7BqN2GFl2O4sY2gUEBaki1W2ln'
- }, {
- title: 'RSAES-OAEP Encryption Example 5.4',
- message: 'FcW57hGF',
- seed: 'SfpF06eN0Q39V3OZ0esAr37tVRM=',
- encrypted: 'CBK3Z2jry2QtBAJY5fREGgGFIb2WaH5sXomfzWwXWI/1moLMiuA6S0WzEpmvF4jDKffc0oX4z0ztgmBrl2EmcaRb7coTNEIUTRYX0RT4AoV/D51zl1HFej+e5ACRLGHi5pkr4DGkPdSPproU7vfEIrXtxOevoE/dOPQC0ci7cZq/'
- }, {
- title: 'RSAES-OAEP Encryption Example 5.5',
- message: 'IQJuaADH+nKPyqug0ZauKNeirE/9irznlPCYX2DIpnNydzZdP+oR24kjogKa',
- seed: '8Ch0EyNMxQNHJKCUxFhrh6/xM/w=',
- encrypted: 'B7YOFOyVS/0p5g0AR+eJ9R1XGGxjWJkDMGeTztP2gkHHQ1KaumpjdPkuGeAWPvozaX4Zb3Zh36qkeqxr3l5R3rUHxyxYmiyhaT2WsUYDgSSbLNuerER2nySJxdPS+Z8O48fuW/ZKWsecQr1DPxSb6MtZVINhZAWVUTyXr3vCUJcj'
- }, {
- title: 'RSAES-OAEP Encryption Example 5.6',
- message: 'VB43totsiHK4TAI=',
- seed: '2fukXJbyHm4m0p6yzctlhb6cs0E=',
- encrypted: 'CMNtTdozQjsu1oMNhfZBG6Hc9HCh+uDr7+58CJ8lbO90y5bqacOPYPOavuRBKby0yS3n95diOyAHTj2cKJlwHtkHHh76C92E1MPlEwMC2PAkC6ukuEpxzAMvIjWl/w+uJ3w+j5ESvvRMmuINF1/JpAWL/JMLoxsC4uT0REg3EPJK'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha1', examples);
-
- // Example 6: A 1029-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'ErF/ba0uzRn/RtwT94YPCeDgz7Z3s4pSWSMFzq8CLBZtuQ0ErCnjP33RLZ+vZuCBa7Y+rSZ8x9RsF8N74hS8oqItcjpk5EQHQ2tvyWVymu/CVU83bNXc6mgpN4CmK/OdAClIWhYLu55dwJctIaUE9S5e4CiqQWMy9RCy6c/19yKv';
- exponent = 'AQAB';
- d = 'ApXso1YGGDaVWc7NMDqpz9r8HZ8GlZ33X/75KaqJaWG80ZDcaZftp/WWPnJNB7TcEfMGXlrpfZaDURIoC5CEuxTyoh69ToidQbnEEy7BlW/KuLsv7QV1iEk2Uixf99MyYZBIJOfK3uTguzctJFfPeOK9EoYij/g/EHMc5jyQz/P5';
- p = 'BKbOi3NY36ab3PdCYXAFr7U4X186WKJO90oiqMBct8w469TMnZqdeJpizQ9g8MuUHTQjyWku+k/jrf8pDEdJo4s=';
- q = 'BATJqAM3H+20xb4588ALAJ5eCKY74eQANc2spQEcxwHPfuvLmfD/4Xz9Ckv3vv0t1TaslG23l/28Sr6PKTSbke0=';
- dP = 'A5Ycj3YKor1RVMeq/XciWzus0BOa57WUjqMxH8zYb7lcda+nZyhLmy3lWVcvFdjQRMfrg6G+X63yzDd8DYR1KUs=';
- dQ = 'AiGX4GZ0IZaqvAP6L+605wsVy3h9YXrNMbt1x7wjStcG98SNIYLR8P+cIo3PQZZ7bAum0sCtEQobhXgx7CReLLE=';
- qInv = 'BAHEwMU9RdvbXp2W0P7PQnXfCXS8Sgc2tKdMMmkFPvtoas4kBuIsngWN20rlQGJ64v2wgmHo5+S8vJlNqvowXEU=';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 6.1',
- message: 'QEbKi6ozR8on9J4NgfnMHXG+m6UX1A==',
- seed: '3Q9s/kFeiOWkaaUfu6bf1ArbQ4Q=',
- encrypted: 'BjDuvNKFbCT3mIBuQfnmc0Xtqc7aOGrMn6yuoe7tBqzlg3CXGNnRafrfQU1cdvkploM+8wW3Wx5LlfZiog+u3DuuDEgnqL+KiO29V+wgOieoQfAuQ6YVurGoysBwHeNN6972KgiAibVew26nUi/T7I0GtqBz5t+DMVO8Cu/ZO9Gj'
- }, {
- title: 'RSAES-OAEP Encryption Example 6.2',
- message: 'XMcsYCMd8Ds9QPm1eTG8MRCflyUn8osZ50gMcojLPJKyJRIhTkvmyRR5Ldq99X+qiqc=',
- seed: 'jRS9lGoTURSPXK4u2aDGU+hevYU=',
- encrypted: 'Drw3N2FzpP0vicxVwspismsR1Rw8fOSeiEX3TnYHMXxDa8jSO5Zn3+udCHI0tHvGg3F1rlwFWfa4HX0iQW0+UPSsUz2PCBLy2555H+nHdayLatD1Na2c6yOkoCAUxYqz+NMWFJmiYPOTSOcUriodNEMgj9i3Isz9+zk+mAEfmeY/'
- }, {
- title: 'RSAES-OAEP Encryption Example 6.3',
- message: 'sg5lEwMJL0vMtDBwwPhtIwSTYu2WZC/FYywn20pS49gx8qsGiyOxSYecAC9r8/7ul1kRElYs',
- seed: 'bAdbxFUg8WXAv16kxd8ZG8nvDkQ=',
- encrypted: 'Cpi/EJNhk5RDbPaNjzji8Vj96OpU80NfI5uNBrgyGEQgJHau7ZYAlJJIDOOo1wVJjEyMaPAVAdyB22CPYAhzUMjDsL0unvaoFFi3yAG4ny5P6Z1JALpqS15althl3Gdsd1WSh5QTDWKAqBYKGQ8t8+p8+aoCcdiOnmkF7PHFFS1l'
- }, {
- title: 'RSAES-OAEP Encryption Example 6.4',
- message: 'aE4wOMXAQfc=',
- seed: 'O7w71mN9/hKEaQECm/WwwHEDQ5w=',
- encrypted: 'AI56Z8rPtcTiS+x97hSRF/GVmM6MRYCP74jGCP+c1uaVJjuaPArUuLpMlSOOlqhCK4U1YpyNU4I3RHmtE/o5l0skL5p1nur5yDrVqMoYlAoBYrp1WHbfJj9L1QxlJcVgkCZ8Hw4JzgiZoM81nogSCr2b+JNEWzyud9Ngc1mumlL4'
- }, {
- title: 'RSAES-OAEP Encryption Example 6.5',
- message: 'MkiMsmLQQdbk3TX5h788ppbbHwasKaRGkw==',
- seed: 'tGtBiT6L7zJvZ1k4OoMHHa5/yrw=',
- encrypted: 'AAA0dEFse2i9+WHDhXN5RNfx9AyzlTQ8aTzAtP5jsx/t8erurJzMBnizHcMuCXdIlRTE8JCF9imKllPwGupARf9YLuiHviauV1tz7vfzd0kh43Wj0ZrdoMoxqhhJiHwfQsrJZ396L06SP25ahos4wITvGHWU3J9/BI/qLgKVU4Sr'
- }, {
- title: 'RSAES-OAEP Encryption Example 6.6',
- message: 'ULoUvoRicgJ5wwa6',
- seed: 'CiQDMSpB49UvBg+8E6Z95c92Cac=',
- encrypted: 'CgJt2l/IeF972b91Mntj6F4sD97l2ttl69ysmuHelcksZyq0M6p6jmnOam2Il/rErEpU3oQa5eW7znaHh515Y0zqejBoQGXHFNUkCbkoJWu/U+q81SMetyWVBFNzmb0pFktybTOkbacBNgpBaKCRzKty1Epi/tJGwP/qWxNIq1Rw'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha1', examples);
-
- // Example 7: A 1030-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'MRF58Lz8m508oxXQDvMNe906LPrpkRv+3LlIs6R4LQcytqtEqkvwN0GmRNwBvsPmmwGgM+Z12KzXxJJcaxrsMRkFHf2Jdi0hXUVHX/y1n5CBSGI/NxdxVvauht16fF9D3B4fkIJUBYooSl8GwAIXk6h/GsX+/33K7mnF5Ro3ieNz';
- exponent = 'AQAB';
- d = 'Bwz8/y/rgnbidDLEXf7kj0m3kX1lMOHwyjRg8y4CdhdEh8VuIqRdJQDXd1SVIZ19Flqc872Swyr5qY2NycwpaACtyUoKVPtA80KRv4TujqErbxCTWcbTVCpQ+cdn9c//BaaBwuZW+3fKqttL6UaNirzU35j1jobSBT+hNJ90jiGx';
- p = 'B0kmLBEc1HDsJWbms3MvwJMpRpqhkHHTucAZBlFMbx0muqFL6rCXHIt+YRpPeQCdb+p3aSjKJShbDeNkPRo/jHE=';
- q = 'BrweUOlsAr9jbp7qi4mbvr92Ud533UdMPpvCO62BgrYZBMfZffvr+x4AEIh4tuZ+QVOR1nlCwrK/m0Q1+IsMsCM=';
- dP = 'A7x+p/CqsUOrxs6LlxGGNqMBcuTP4CyPoN2jt7qvkPgJKYKYVSX0iL38tL1ybiJjmsZKMJKrf/y/HVM0z6ULW/E=';
- dQ = 'AmKmqinCo8Z9xTRsBjga/Zh6o8yTz7/s9U/dn514fX9ZpSPTmJedoTei9jgf6UgB98lNohUY3DTLQIcMRpeZStk=';
- qInv = 'ZJ1MF7buFyHnctA4mlWcPTzflVDUV8RrA3t0ZBsdUhZq+KITyDliBs37pEIvGNb2Hby10hTJcb9IKuuXanNwwg==';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 7.1',
- message: 'R6rpCQ==',
- seed: 'Q90JoH/0ysccqkYy7l4cHa7kzY8=',
- encrypted: 'FojkzneUu6bLcBQWns1VnO3iowtWpSto2f4Yzxlz75eyoDFTlRx1X2KUqkmtvbVYRatodfs5hsk+z5J5YoQNKC+eVM6LaQ98DLi71zRA2VcdGxbNkmD56rR4PMSC5SI9xglzhxeD7Cewrg/UdzLLwoahc/ySsA+0umgkZHzZPIXB'
- }, {
- title: 'RSAES-OAEP Encryption Example 7.2',
- message: 'HZsuIiPZvBO/ufFiznNdtIunxo9oIqChp7auFlg05w==',
- seed: 'Opw87HuE+b063svGc+yZ1UsivJs=',
- encrypted: 'EFLtOXsuAeHQ7hxQvyQ2P5XlBPSgNDSgj9giV07WuXNu27XzkNsQMhR5qKE5NQ4r1Jd8N3jvMx8+eK4RiyaEUfIKLwHUcfXVPFZpNxcbLbwtS95FmleZ8DctZXQjmyMj0kXQu4HChrY8iaNhAXM35JAviKRn9MfyRL/Vq0ZDf/O2'
- }, {
- title: 'RSAES-OAEP Encryption Example 7.3',
- message: '2Xb8',
- seed: 'dqdeW2FXpVbPiIS7LkXCk91UXPU=',
- encrypted: 'IVXNhD/ySk7outt2lCYAKKSQgTuos2mky/EG7BSOUphwf1llvn0QHBBJ6oWEwkzWNFWtnBBNaGKC0/uAOkwRwcLpuRxxeIAdG2ZA8AP1co3wB7ikzMkrzgXkGicnjXyFAYxSQUMTpQd3iQAdTwGRC3Kq0F0iCqFKWHM6dIm8VFVr'
- }, {
- title: 'RSAES-OAEP Encryption Example 7.4',
- message: '1HOGI98iOqQ4Q9+EZ1NMQdAT4MgDxiTiY2ZrI5veQKXymuuN5549qmHdA3D0m9SwE4NLmCEq72scXuNzs8s=',
- seed: 'eGYxSmrW8rJQo1lB2yj1hktYWFk=',
- encrypted: 'CrFMNzrrfUMo0KqtjAlNiLnrCYuV8hBUopCCUivnwnoxKHi2N5F+PYGebDxWjbXYQ4ArBtUdnpiivgv0DAMUI7AO37/4Mg77kXG9IERlOky5xRIvbGXoPNouw8EmAnqcGla6h00P6iPzgLgs8kC4z1QABHWMTHfZNBV6dPP8Er+s'
- }, {
- title: 'RSAES-OAEP Encryption Example 7.5',
- message: 'u0cjHKXqHTrUbJk0XZqKYQ==',
- seed: 'shZu1HLVjbEMqyxrAAzM8Qp9xQk=',
- encrypted: 'AoOHoxgndDR5i02X9GAGjfUpj6ulBBuhF2Ghy3MWskGEEU7FACV+JYntO2B6HrvpemzC4CvxtoH0IxKjO3p32OeFXEpt4D48BGQ/eGuRomSg1oBeLOqR5oF363pk2SVeTyfnE7fM7ADcIA69IcLqK7iQ/q5JQt+UHcP5eJDtNHR4'
- }, {
- title: 'RSAES-OAEP Encryption Example 7.6',
- message: 'IYSCcJXTXD+G9gDo5ZdUATKW',
- seed: 'Umc73iyhZsKqRhMawdyAjWfX07E=',
- encrypted: 'FMZ4qUrWBSXvOelZsvO6XAl6lP+RK2fbrOgFNcGHq9R9B1QgsYchUrugj3/DHzE7v5JzyRL8TAFJqbDPt5gH40brMyBpYRvsD/m80Wjx98M+dzE86kVLlOJUnuzwAuKs9/by0oRdT+CqsuWpLd9oxICuESR5NdH2JXSEIhauZ0EV'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha1', examples);
-
- // Example 8: A 1031-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'W98OMNMh3aUUf4gkCPppGVSA34+A0/bov1gYUE82QnypsfVUC5xlqPaXTPhEeiRNkoAgG7Sfy75jeNGUTNIn4jD5bj0Q+Bnc7ydsZKALKktnAefQHeX6veOx6aDfgvRjE1nNImaWR/uxcXJGE07XtJfP/73EK1nHOpbtkBZiEt/3';
- exponent = 'AQAB';
- d = 'D30enlqqJf0T5KBmOuFE4NFfXNGLzbCd8sx+ZOPF6RWtYmRTBBYdCYxxW7eri9AdB+rz/tfH7QivKopi70SrFrMg4Ur3Kkj5av4mKgrkz2XmNekQeQzU7lzqdopLJjn35vZ3s/C7a+MrdXR9iQkDbwJk9Y1AHNuhMXFhV6dez2Mx';
- p = 'CgLvhEjZ+ti70NAEyMKql1HvlyHBsNAyNqVLDflHy67VolXuno4g1JHqFyP+CUcEqXYuiK/RbrtZlEEsqWbcT58=';
- q = 'CS02Ln7ToL/Z6f0ObAMBtt8pFZz1DMg7mwz01u6nGmHgArRuCuny3mLSW110UtSYuByaxvxYWT1MP7T11y37sKk=';
- dP = 'B8cUEK8QOWLbNnQE43roULqk6cKd2SFFgVKUpnx9HG3tJjqgMKm2M65QMD4UA10a8BQSPrpoeCAwjY68hbaVfX0=';
- dQ = 'rix1OAwCwBatBYkbMwHeiB8orhFxGCtrLIO+p8UV7KnKKYx7HKtYF6WXBo/IUGDeTaigFjeKrkPH+We8w3kEuQ==';
- qInv = 'BZjRBZ462k9jIHUsCdgF/30fGuDQF67u6c76DX3X/3deRLV4Mi9kBdYhHaGVGWZqqH/cTNjIj2tuPWfpYdy7o9A=';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 8.1',
- message: 'BQt1Xl5ogPe56daSp0w3quRJsxv+pt7/g3R6iX9sLIJbsa2/hQo8lplLXeWzPLx9SheROnln',
- seed: 'dwb/yh7PsevuKlXlxuJM0nl6QSU=',
- encrypted: 'CbNoPYousPspW2LtH7kpC3FEV7eCUxn0ZHhyr4ibMECUcgIK0SkSvxmxHUgZ9JYUgk/9hNCcChfn0XMJ0SkZeQQQqimVaZ9qhtvjJCtazCOvRWkQgNaxroEPs+MFcIfwlwCSzgC+lWL/QFO2Jizgyqk+E3I9LjpboHXUXw1htUth'
- }, {
- title: 'RSAES-OAEP Encryption Example 8.2',
- message: 'TraNzZPKmxnfERvUNgj1VwJv5KodXPrCJ6PrWrlUjBigbd7SP4GCWYay/NcRCezvfv+Ihz8HXCqgxGn2nJK8',
- seed: 'o3F9oUO03P+8dCZlqPqVBYVUg0M=',
- encrypted: 'Ls8VyXxaFbFHaumGs3G1eiQoT0oWKo0MgYLnkF55IlbxgSul+D8fehMOQtzAIjKETtwUoxpo7peuVko4OjQRZWQkxfYt22Rgk8Nnvh/NpCbPAKBtist+V3dvu9hVrD31BvwWsdfD8hEPPYBo6R4YY2ODHIQJaA2NqezYzx+iDuOd'
- }, {
- title: 'RSAES-OAEP Encryption Example 8.3',
- message: 'hgSsVjKMGrWtkXhh',
- seed: '7gYgkHPMoCa7Jk5Rhb+MaLdzn4Y=',
- encrypted: 'S8iRMKWy2rt8L8+Q610Or55oG3FGo48xc6PZz+xS6p4KQZMuZIqdaTRMUNp2P1GgPJV2ITHoBSJU3NIkjLpA/TFmd4bOBaK3tTGsnaye1YSlm2d8GortjF0V1owFVp4r54C/fbY4/Sv9KoWrJ2hg83dzOPypif/XQ9E+4I4MqYk/'
- }, {
- title: 'RSAES-OAEP Encryption Example 8.4',
- message: '/dpfv27DYanZpKxoryFqBob0OLHg5cNrlV904QfznA3dzA==',
- seed: 'mQrVc9xIqXMjW22CVDYY8ulVEF0=',
- encrypted: 'LkVoR9j8Nv8BR9aZNZS5OXIn1Xd1LHnQ+QT8sDnU2BL+pgWntXTdgsp4b5N1I0hDjun1tUVJhdXw4WmePnrRdaMuFfA96wQquf4d2dsbuG+MCJzLRefvDF7nyptykMprFb7UcDl4ioqT/4Pg6NYkTHEAY2Le72m29Bb7PGhDg/vQ'
- }, {
- title: 'RSAES-OAEP Encryption Example 8.5',
- message: 'Sl9JFL7iXePGk0HeBw==',
- seed: '7MY7KPB1byL1Ksjm7BJRpuwwRxg=',
- encrypted: 'H7k1b9XEsXltsuv30NOTzIEK32FF3vwvznFPedk4ANXirCEeqLvsyktlS5TDsYsw3Vds403JVDbvV6CUFWRZIzWaXXtBce8iwkZw8bIp02A+kfdmcbffl+cxfJdzRHbV89F9Ic+Ctbqfg98uWI02mE/RtYRGi9I7LodfMvaJU/ey'
- }, {
- title: 'RSAES-OAEP Encryption Example 8.6',
- message: 'jgfWb3uICnJWOrzT81CSvDNAn7f4jyRyvg==',
- seed: 'OSXHGzYtQKCm3kIUVXm6Hn3UWfw=',
- encrypted: 'Ov2cZgAUeyF5jYGMZVoPTJIS2ybQsN/cKnWUzLPSL1vx18PhEs1z/H1QnHqLr908J00TmQCflgnsS+ZHfkU/B1qjPbOChwwcNAmu85LXOGrjppa5mpS02gWJRH6VXRbJixdgKlm9c2J5/Nj7KAxEYtWQv6m/E/7VcOr96XMwosIQ'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha1', examples);
-
- // Example 9: A 1536-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'zyzUHjTKOnKOpcuK/2TDbSe971Nk4zb9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jjHyKTmSTwLqf0wN0gmewg7mnpsth5C2zYrjJiW23Bk4CrVrmFYfaFbRknJBZSQn+s328tlS+tyaOyAHlqLSqORG+vYhULwW+';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 9.1',
- message: '9zX9VbqSWSw7Urj5xPaaqhy++P6IrdCVWVQSRn+c9OwLiWxZ7aFiEOdUnIq7EM28IaEuyba1uP0vEDmetg==',
- seed: 'jsll8TSj7Jkx6SocoNyBadXqcFw=',
- encrypted: 'JnvNEYrKsfyLqByF1zADy4YQ+lXB2X2o1Ip8fwaJak23UaooQlW502rWXzdlPYKfGzf5e4ABlCVFsvwsVac3bKehvksXYMjgWjPlqiUmuNmOMXCI54NMdVsqWbEmMaGCwF1dQ6sXeSZPhFb1Fc5X399RLVST2re3M43Et9eNucCRrDuvU3pp/H9UnZefDv+alP2kFpvU0dGaacmeM8O1VJDVAbObHtrhGP9nk6FTJhWE06Xzn25oLj0XyM0SYfpy'
- }, {
- title: 'RSAES-OAEP Encryption Example 9.2',
- message: 'gbkGYFAVpjqr5C3fEeGXiRL1QEx0dLJtzj7Ugr+WHsyBi/QgxUZZ',
- seed: '7LG4sl+lDNqwjlYEKGf0r1gm0Ww=',
- encrypted: 'k6yfBnHsKay7RE7/waV0E1HWD9sOOT+/dUrPDeSXYaFIQd93cum8gnc5ZqFYTE1yuuoAEY+D81zKblN8vU2BH1WDspeD2KbZTNMb5w1vUmwQ/wnG+nzgaXlaP80FEf1fy1ZLzIDqnHjzi4ABJTnYpN32/oHpzdt/UNu7vMfl2GCXzPTsSRifuL8xi+bVoHFdUWtJrxkSWM0y3IM85utGc8A6Gbus6IzFSJX2NswMHsiQltEc4jWiZcoXZCMqaJro'
- }, {
- title: 'RSAES-OAEP Encryption Example 9.3',
- message: '/TJkKd+biQ4JtUsYuPNPHiQ=',
- seed: '6JuwMsbOYiy9tTvJRmAU6nf3d8A=',
- encrypted: 'gevdlQVLDIIu+a12k/Woet+0tMTOcN8t+E7UnATaWLpfwgoZ4abot6OQCyJ5bcToae5rQnktFajs61bAnGmRToE86o9pMeS47W9CGvKY1ZXJf0eJx8qmEsfvNgmEwhuT7cVAEGi1r0x4qHcbmE1TuOqK3y9qfUoLp2x14d2fZY8g3tSkYHHUbXeRtWgD2P6n8LD45Brj8JODpvlYX+d1Pqr/0r+UVjEIvuzCB7u1NfX8xwXw3en3CMYvSanJA3HT'
- }, {
- title: 'RSAES-OAEP Encryption Example 9.4',
- message: '8UWbXwyS8BoPcjouVmJITY+MCiD8KdrWrNQ7tfPv/fThtj4H/f5mKNDXTKGb8taeSgq/htKTklp5Z3L4CI4=',
- seed: 'YG87mcC5zNdx6qKeoOTIhPMYnMw=',
- encrypted: 'vMNflM3mbLETZiXWJblEMqNbIvPS+hGmE/8PylvVf4e5AszcHNCuvLBxXuhp0dH+OV9nkwA/XspGUFnIhmDURv9fCBhVICJVfjjAimfq2ZEmIlTxBoKXXsVjl3aFN/SXevbV9qrOt/sl3sWTcjAjH9iXivSRGaKfKeQkq4JytHVieS1clPd0uIKdCw2fGoye3fN1dNX6JI7vqcUnH8XsJXnIG91htBD6Yf425CQiHBE63bJ1ZkyAHTTKjGNR5KhY'
- }, {
- title: 'RSAES-OAEP Encryption Example 9.5',
- message: 'U+boxynW+cMZ3TF+dLDbjkzMol88gwV0bhN6xjpj7zc557WVq7lujVXlT3vUGrQzN4/7kR0=',
- seed: '/LxCFALp7KvGCCr6QLpfJlIshA4=',
- encrypted: 'Iyr7ySf6CML2onuH1KXLCcB9wm+uc9c6kFWIOfT9ZtKBuH7HNLziN7oWZpjtgpEGp95pQs1s3OeP7Y0uTYFCjmZJDQNiZM75KvlB0+NQVf45geFNKcu5pPZ0cwY7rseaEXn1oXycGDLyg4/X1eWbuWWdVtzooBnt7xuzrMxpfMbMenePYKBkx/b11SnGIQJi4APeWD6B4xZ7iZcfuMDhXUT//vibU9jWTdeX0Vm1bSsI6lMH6hLCQb1Y1O4nih8u'
- }, {
- title: 'RSAES-OAEP Encryption Example 9.6',
- message: 'trKOohmNDBAIvGQ=',
- seed: 'I6reDh4Iu5uaeNIwKlL5whsuG6I=',
- encrypted: 'Q4zH3AimjaJJ5CUF+Fc7pg4sJ3PVspD0z53/cY6EIIHDg+ZwJKDylZTqmHudJeS3OPKFlw0ZWrs6jIBU49eda5yagye6WW8SWeJxJmdHZpB9jVgv86hHYVSSmtsebRI1ssy07I9mO6nMZwqSvr2FPI2/acZDbQFvYa3YNulHMkUENCB/n9TEPewqEqlY76Ae/iZpiZteYEwlXFX7cWbeVYnjaVl7sJFowG3V2xd+BqF0DrLVyC+uym2S/O6ZMbqf'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha1', examples);
-
- // Example 10: A 2048-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'rkXtVgHOxrjMBfgDk1xnTdvg11xMCf15UfxrDK7DE6jfOZcMUYv/ul7Wjz8NfyKkAp1BPxrgfk6+nkF3ziPn9UBLVp5O4b3PPB+wPvETgC1PhV65tRNLWnyAha3K5vovoUF+w3Y74XGwxit2Dt4jwSrZK5gIhMZB9aj6wmva1KAzgaIv4bdUiFCUyCUG1AGaU1ooav6ycbubpZLeGNz2AMKu6uVuAvfPefwUzzvcfNhP67v5UMqQMEsiGaeqBjrvosPBmA5WDNZK/neVhbYQdle5V4V+/eYBCYirfeQX/IjY84TE5ucsP5Q+DDHAxKXMNvh52KOsnX1Zhg6q2muDuw==';
- exponent = 'AQAB';
- d = 'BWsEIW/l81SsdyUKS2sMhSWoXFmwvYDFZFCiLV9DjllqMzqodeKR3UP0jLiLnV/A1Jn5/NHDl/mvwHDNnjmMjRnmHbfHQQprJnXfv100W4BNIBrdUC1c4t/LCRzpmXu+vlcwbzg+TViBA/A29+hdGTTRUqMj5KjbRR1vSlsbDxAswVDgL+7iuI3qStTBusyyTYQHLRTh0kpncfdAjuMFZPuG1Dk6NLzwt4hQHRkzA/E6IoSwAfD2Ser3kyjUrFxDCrRBSSCpRg7Rt7xA7GU+h20Jq8UJrkW1JRkBFqDCYQGEgphQnBw786SD5ydAVOFelwdQNumJ9gkygHtSV3UeeQ==';
- p = '7PWuzR5VFf/6y9daKBbG6/SQGM37RjjhhdZqc5a2+AkPgBjH/ZXMNLhX3BfwzGUWuxNGq01YLK2te0EDNSOHtwM40IQEfJ2VObZJYgSz3W6kQkmSB77AH5ZCh/9jNsOYRlgzaEb1bkaGGIHBAjPSF2vxWl6W3ceAvIaKp30852k=';
- q = 'vEbEZPxqxMp4Ow6wijyEG3cvfpsvKLq9WIroheGgxh5IWKD7JawpmZDzW+hRZMJZuhF1zdcZJwcTUYSZK2wpt0bdDSyr4UKDX30UjMFhUktKCZRtSLgoRz8c52tstohsNFwD4F9B1RtcOpCj8kBzx9dKT+JdnPIcdZYPP8OGMYM=';
- dP = 'xzVkVx0A+xXQij3plXpQkV1xJulELaz0K8guhi5Wc/9qAI7U0uN0YX34nxehYLQ7f9qctra3QhhgmBX31FyiY8FZqjLSctEn+vS8jKLXc3jorrGbCtfaPLPeCucxSYD2K21LCoddHfA8G645zNgz72zX4tlSi/CE0flp55Tp9sE=';
- dQ = 'Jlizf235wQML4dtoEX+p2H456itpO35tOi9wlHQT7sYULhj7jfy2rFRdfIagrUj4RXFw8O+ya8SBJsU+/R0WkgGY3CoRB9woLbaoDNMGI2C6P6E/cOQxL/GmzWuPxM2cXD2xfG1qVyEvc64p9hkye61ZsVOFhYW6Tii2CmKkXkk=';
- qInv = 'bzhSazklCFU07z5BWoNu3ouGFYosfL/sywvYNDBP7Gg7qNT0ecQz1DQW5jJpYjzqEAd22Fr/QB0//2EO5lQRzjsTY9Y6lwnu3kJkfOpWFJPVRXCoecGGgs2XcQuWIF7DERfXO182Ij+t1ui6kN18DuYdROFjJR4gx/ZuswURfLg=';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 10.1',
- message: 'i7pr+CpsD4bV8XVul5VocLCJU7BrTrIFvBaU7g==',
- seed: 'R+GrcRn+5WyV7l6q2G9A0KpjvTM=',
- encrypted: 'U+pdwIzSYPs7hYVnKH+pFVLDCy/r+6IT8K6HcC0GjRm6sH/ldFI9+0ITnWjDxa/u4L/ky3lpy/OCuATW5hOWFE4tDmB0H4mTwwFLWLmxlXqLq80jr4VPTDVvsWYqpyv8x+WGVZ3EKA0WDBJnhacj6+6+/3HxFZRECq74fRB5Ood0ojnUoEyH/hRnudr4UgjsbHJVeUqWzCkUL5qL1Bjjwf1nNEsM0IKd87K+xgJTGWKTxrNNP3XTLyE91Fxic9UFrfTM7RBXy3WPwmru+kQSVe1OZMGZ7gdefxZkYYL9tGRzm2irXa/w5j6VUgFoJPBUv008jJCpe7a2VTKE60KfzA=='
- }, {
- title: 'RSAES-OAEP Encryption Example 10.2',
- message: '5q0YHwU7WKkE8kV1EDc+Vw==',
- seed: 'bRf1tMH/rDUdGVv3sJ0J8JpAec8=',
- encrypted: 'orGkMKnWV+L6HCu17UP/slwFowj+kJPAEDF5X1h0QAEQgorlj7m1gc6d3dPlSa4EoJhUWb3mxiZZTnsF3EJ4sqFGXBNoQIgjyF6W3GbDowmDxjlmT8RWmjf+IeWhlbV3bu0t+NjTYa9obnUCKbvWY/FhhopQYV4MM3vsDKNf7AuxnDbrLgu8wFgvodk6rNsGEGP1nyzh7kNgXl2J7KGD0qzf6fgQEQIq07Q6PdQX2slLThHqgbGSlm6WaxgggucZZGB7T4AC82KZhEoR8q4PrqwurnD49PmAiKzc0KxVbp/MxRFSGQj60m8ExkIBRQMFd4dYsFOL+LW7FEqCjmKXlQ=='
- }, {
- title: 'RSAES-OAEP Encryption Example 10.3',
- message: 'UQos9g6Gb6I0BVPJTqOfvCVjEeg+lEVLQSQ=',
- seed: 'OFOHUU3szHx0DdjN+druSaHL/VQ=',
- encrypted: 'mIbD5nZKi5qE6EFI69jDsaqAUDgaePZocUwW2c/Spu3FaXnFNdne47RLhcGL6JKJkjcXEUciFtld2pjS7oNHybFN/9/4SqSNJawG99fmU5islnsc6Qkl9n3OBJt/gS2wdCmXp01E/oHb4Oej/q8uXECviI1VDdu+O8IGV6KVQ/j8KRO5vRphsqsiVuxAm719wNF3F+olxD9C7Sffhzi/SvxnZv96/whZVV7ig5IPTIpjxKc0DLr93DOezbSwUVAC+WyTK1t5Fnr2mcCtP8z98PROhacCYr8uGP40uFBYmXXoZ/+WnUjqvyEicVRs3AWmnstSblKHDINvMHvXmHgO3g=='
- }, {
- title: 'RSAES-OAEP Encryption Example 10.4',
- message: 'vN0ZDaO30wDfmgbiLKrip18QyR/2Z7fBa96LUwZKJkmpQEXJ',
- seed: 'XKymoPdkFhqWhPhdkrbg7zfKi2U=',
- encrypted: 'Yxjp+1wNBeUwfhaDQ26QMpOsRkI1iqoiPXFjATq6h+Lf2o5gxoYOKaHpJoYWPqC5F18ynKOxMaHt06d3Wai5e61qT49DlvKM9vOcpYES5IFg1uID2qWFbzrKX/7Vd69JlAjj39Iz4+YE2+NKnEyQgt5lUnysYzHSncgOBQig+nEi5/Mp9sylz6NNTR2kF4BUV+AIvsVJ5Hj/nhKnY8R30Vu7ePW2m9V4MPwsTtaG15vHKpXYX4gTTGsK/laozPvIVYKLszm9F5Cc8dcN4zNa4HA5CT5gbWVTZd5lULhyzW3h1EDuAxthlF9imtijU7DUCTnpajxFDSqNXu6fZ4CTyA=='
- }, {
- title: 'RSAES-OAEP Encryption Example 10.5',
- message: 'p91sfcJLRvndXx6RraTDs9+UfodyMqk=',
- seed: 'lbyp44WYlLPdhp+n7NW7xkAb8+Q=',
- encrypted: 'dSkIcsz9SkUFZg1lH1babaoJyhMB2JBjL2qZLz1WXO5GSv3tQO07W+k1ZxTqWqdlX0oTZsLxfHKPbyxaXR+OKEKbxOb48s/42o3A4KmAjkX9CeovpAyyts5v//XA4VnRG2jZCoX3uE4QOwnmgmZkgMZXUFwJKSWUaKMUeG106rExVzzyNL9X232eZsxnSBkuAC3A3uqTBYXwgx/c2bwz1R957S/8Frz01ZgS/OvKo/kGmw5EVobWRMJcz2O0Vu5fpv/pbxnN91H+2erzWVd1Tb9L/qUhaqGETcUHyy0IDnIuuhUDCMK1/xGTYg8XZuz0SBuvuUO9KSh38hNspJSroA=='
- }, {
- title: 'RSAES-OAEP Encryption Example 10.6',
- message: '6vGnOhsMRglTfeac2SKLvPuajKjGw++vBW/kp/RjTtALfDnsaSLXuOosBOus',
- seed: 'n0fd9C6X7qhWqb28cU6zrCL26zI=',
- encrypted: 'LSB6c0Mqj7TAMFGz9zsophdkCY36NMR6IJlfgRWqaBZnm1V+gtvuWEkIxuaXgtfes029Za8GPVf8p2pf0GlJL9YGjZmE0gk1BWWmLlx38jA4wSyxDGY0cJtUfEb2tKcJvYXKEi10Rl75d2LCl2Pgbbx6nnOMeL/KAQLcXnnWW5c/KCQMqrLhYaeLV9JiRX7YGV1T48eunaAhiDxtt8JK/dIyLqyXKtPDVMX87x4UbDoCkPtnrfAHBm4AQo0s7BjOWPkyhpje/vSy617HaRj94cGYy7OLevxnYmqa7+xDIr/ZDSVjSByaIh94yCcsgtG2KrkU4cafavbvMMpSYNtKRg=='
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha1', examples);
- }
-
- function testOAEPSHA256() {
- var modulus, exponent, d, p, q, dP, dQ, qInv, pubkey, privateKey;
- var examples;
-
- // Example 1: A 1024-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'qLOyhK+OtQs4cDSoYPFGxJGfMYdjzWxVmMiuSBGh4KvEx+CwgtaTpef87Wdc9GaFEncsDLxkp0LGxjD1M8jMcvYq6DPEC/JYQumEu3i9v5fAEH1VvbZi9cTg+rmEXLUUjvc5LdOq/5OuHmtme7PUJHYW1PW6ENTP0ibeiNOfFvs=';
- exponent = 'AQAB';
- d = 'UzOc/befyEZqZVxzFqyoXFX9j23YmP2vEZUX709S6P2OJY35P+4YD6DkqylpPNg7FSpVPUrE0YEri5+lrw5/Vf5zBN9BVwkm8zEfFcTWWnMsSDEW7j09LQrzVJrZv3y/t4rYhPhNW+sEck3HNpsx3vN9DPU56c/N095lNynq1dE=';
- p = '0yc35yZ//hNBstXA0VCoG1hvsxMr7S+NUmKGSpy58wrzi+RIWY1BOhcu+4AsIazxwRxSDC8mpHHcrSEurHyjnQ==';
- q = 'zIhT0dVNpjD6wAT0cfKBx7iYLYIkpJDtvrM9Pj1cyTxHZXA9HdeRZC8fEWoN2FK+JBmyr3K/6aAw6GCwKItddw==';
- dP = 'DhK/FxjpzvVZm6HDiC/oBGqQh07vzo8szCDk8nQfsKM6OEiuyckwX77L0tdoGZZ9RnGsxkMeQDeWjbN4eOaVwQ==';
- dQ = 'lSl7D5Wi+mfQBwfWCd/U/AXIna/C721upVvsdx6jM3NNklHnkILs2oZu/vE8RZ4aYxOGt+NUyJn18RLKhdcVgw==';
- qInv = 'T0VsUCSTvcDtKrdWo6btTWc1Kml9QhbpMhKxJ6Y9VBHOb6mNXb79cyY+NygUJ0OBgWbtfdY2h90qjKHS9PvY4Q==';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 1.1',
- message: 'ZigZThIHPbA7qUzanvlTI5fVDbp5uYcASv7+NA==',
- seed: 'GLd26iEGnWl3ajPpa61I4d2gpe8Yt3bqIQadaXdqM+k=',
- encrypted: 'W1QN+A1CKWotV6aZW7NYnUy7SmZd34SiX0jiPiLj9+8sZW6O/L7793+IFFSO3VKbPWhrjJPyR3ZmZ+yHDCzTDkRth+s5FN3nuFtlD3XQmmh0+x60PvAUiXJnAMcwxV96wHKjsUNPSnE1fsrCPBpIO5ZRaJ1pIF6R25IeuMwDujo='
- }, {
- title: 'RSAES-OAEP Encryption Example 1.2',
- message: 'dQxAR/VH6OQUEYVlIymKybriRe+vE5f75W+d1Q==',
- seed: 'DMdCzkqbfzL5UbyyUe/ZJf5P418Mx0LOSpt/MvlRvLI=',
- encrypted: 'jsKSyOW1BkucnZpnt9fS72P/lamWQqexXEDPVs8uzGlFj24Rj+cqGYVlt7i9nTmOGj2YrvM8swUTJQCYIF+QBiKbkcA7WBTBXfiUlkHvpWQD0bLwOkp1CmwfpF4sq2gTsCuSaGzZAc50ZAIOvpldizU7uOCwNNGOlERcFkvhfEE='
- }, {
- title: 'RSAES-OAEP Encryption Example 1.3',
- message: '2Urggy5kRc5CMxywbVMagrHbS6rTD3RtyRbfJNTjwkUf/1mmQj6w4dAtT+ZGz2md/YGMbpewUQ==',
- seed: 'JRTfRpV1WmeyiOr0kFw27sZv0v0lFN9GlXVaZ7KI6vQ=',
- encrypted: 'LcQ1BhOH4Vs0XX8/QJ6q/L0vSs9BUXfA20lQ6mwAt/gvUaUOvKJWBujoxt1QgpRnU6WuH7cSCFWXuKNnrhofpFF3CBTLIUbHZFoou0A4Roi4vFGFvYYu96Boy+oWivwB9/BKs1QMQeHADgNwUgqVD15+q27yHdfIH7kGp+DiGas='
- }, {
- title: 'RSAES-OAEP Encryption Example 1.4',
- message: 'UuZQ2Y5/KgSLT4aFIVO5fgHdMW80ahn2eoU=',
- seed: 'xENaPhoYpotoIENikKN877hds/vEQ1o+Ghimi2ggQ2I=',
- encrypted: 'ZMkqw9CM3SuY2zPBr8/9QbgXaVon4O4AKIufl3i7RVPD07fiTOnXF0aSWKUcdXNhE6ZcXc0Ha97/S5aw6mQKYfbmjaSq/H45s2nfZYTNIa74OgsV1DTDDLSF6/3J2UKhsG0LGIFaV9cNjfucDA5KbfQbzTq8u/+WN06J6nbInrI='
- }, {
- title: 'RSAES-OAEP Encryption Example 1.5',
- message: 'jaif2eX5dKKf7/tGK0kYD2z56AI=',
- seed: 'sxjELfO+D4P+qCP1p7R+1eQlo7WzGMQt874Pg/6oI/U=',
- encrypted: 'NzKEr8KhWRbX/VHniUE8ap0HzdDEWOyfl7dfNHXjL4h/320dmK633rGUvlA7sE4z9yuMj/xF++9ZeBzN6oSPLhVJV/aivUfcC8J99lwwp49W7phnvkUA4WUSmUeX+XRhwj8cR27mf5lu/6kKKbgasdt4BHqXcc5jOZICnld6vdE='
- }, {
- title: 'RSAES-OAEP Encryption Example 1.6',
- message: 'JlIQUIRCcQ==',
- seed: '5OwJgsIzbzpnf2o1YXTrDOiHq8Lk7AmCwjNvOmd/ajU=',
- encrypted: 'nfQEzsDY2gS9UYXF85t+u0Tm7HrOmmf+LqxCD+6N4XD36NoQ96PE9Squ83PvxKy8Bj8Q0N2L8E5Z5/9AWxLPCBqOkqkqIqO7ZDQMmpHml3H1yz82rpAzAQi6acZDSFQAW8NKhg4nEEwfwKdaGQcI0JZm6FrTQUuXskOqFUT0NJc='
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha256', examples);
-
- // Example 2: A 1025-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'AZR8f86QQl9HJ55whR8l1eYjFv6KHfGTcePmKOJgVD5JAe9ggfaMC4FBGQ0q6Nq6fRJQ7G22NulE7Dcih3x8HQpn8UsWlMXwN5RRpD5Joy3eg2cLc9qRocmbwjtDamAFXGEPC6+ZwaB5VluVo/FSZjLR1Npg8g7aJeZTxPACdm9F';
- exponent = 'AQAB';
- d = 'CCPyD6212okIip0AiT4h+kobEfvJPGSjvguq6pf7O5PD/3E3BMGcljwdEHqumQVHOfeeAuGG3ob4em3e/qbYzNHTyBpHv6clW+IGAaSksvCKFnteJ51xWxtFW91+qyRZQdl2i5rO+zzNpZUto87nJSW0UBZjqO4VyemS2SRi/jk=';
- p = 'AVnb3gSjPvBvtgi4CxkPTT4ivME6yOSggQM6v6QW7bCzOKoItXMJ6lpSQOfcblQ3jGlBTDHZfdsfQG2zdpzEGkM=';
- q = 'AStlLzBAOzi0CZX9b/QaGsyK2nA3Mja3IC05su4wz7RtsJUR9vMHzGHMIWBsGKdbimL4It8DG6DfDa/VUG9Wi9c=';
- dP = 'Q271CN5zZRnC2kxYDZjILLdFKj+1763Ducd4mhvGWE95Wt270yQ5x0aGVS7LbCwwek069/U57sFXJIx7MfGiVQ==';
- dQ = 'ASsVqJ89+ys5Bz5z8CvdDBp7N53UNfBc3eLv+eRilIt87GLukFDV4IFuB4WoVrSRCNy3XzaDh00cpjKaGQEwZv8=';
- qInv = 'AnDbF9WRSwGNdhGLJDiac1Dsg2sAY6IXISNv2O222JtR5+64e2EbcTLLfqc1bCMVHB53UVB8eG2e4XlBcKjI6A==';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 2.1',
- message: 'j/AMqmBccCgwY02abD1CxlK1jPHZL+xXC+7n',
- seed: 'jEB7XsKJnlCZxT6M55O/lOcbF4KMQHtewomeUJnFPow=',
- encrypted: 'AR3o2JwhHLKUfOLZ26KXD9INUK1/fWJzdZix7E545qladDYdpHRaE5zBP9nf6IPmZvBUPq75n1E4suxm+Bom7crf9be1HXCFZnmR/wo92CKg4D1zRlBwr/3Gitr3h9rU6N+tid2x9yOYj955rf3Bq4j6wmjYQpWphbhBIBMoliyJ'
- }, {
- title: 'RSAES-OAEP Encryption Example 2.2',
- message: 'LQ==',
- seed: 'tgDPPC5QbX8Wd4yRDTqLAD7uYdW2AM88LlBtfxZ3jJE=',
- encrypted: 'AIeYuAD2aYZYnEu1YK+INur95FfP2pTz8/k4r3xwL4bVMufgvzWFLdVK24fP96jTteLkrX6HjmebBVeUhSWG3ahebh3LH5yVS9yx+xHzM1Jxc8X1rS+kYgdCGWFbszMF/vP0ogisy5XthHqcoHNEM4Rzln7ugrXuS+dNuuPEjIAf'
- }, {
- title: 'RSAES-OAEP Encryption Example 2.3',
- message: 'dPyIxRvJD3evnV6aSnATPUtOCzTaPDfH744=',
- seed: 'pzdoruqpH52MHtb50rY0Z/B8yuOnN2iu6qkfnYwe1vk=',
- encrypted: 'AMkW9IJHAFs0JbfwRZhrRITtj1bQVDLcjFCwYxHMDBlSHIqpDzSAL8aMxiUq41Feo9S2O/1ZTXIiK8baJpWs9y+BPqgi1lABB6JJIvU2QZYMzWK0XgjkWk12g6HSPFhuK4yf+LQ1UYpbKVquUdZ9POOCR8S7yS+tdful6qP8Wpkm'
- }, {
- title: 'RSAES-OAEP Encryption Example 2.4',
- message: 'p+sqUDaTHSfU6JEybZlpL/rdqb9+/T405iLErcCF9yHf6IUHLHiiA7FRc5vlQPqMFToQ8Ao=',
- seed: 'mns7DnCL2W+BkOyrT7mys4BagVaaezsOcIvZb4GQ7Ks=',
- encrypted: 'AJ6YQ3DNjd7YXZzjHASKxPmwFbHKwoEpof+P+Li3+o6Xa95C21XyWZF0iCXc5USp5jwLt66T6G3aYQkEpoyFGvSPA3NV6tOUabopdmslYCkOwuOIsFLiuzkJc4Hu6nWXeJtTVtHn7FmzQgzQOMjuty1YConfe78YuQvyE3IAKkr2'
- }, {
- title: 'RSAES-OAEP Encryption Example 2.5',
- message: 'LvKwZvhUwz873LtZlKQ15z1sbA==',
- seed: '6zzrvErcFrtI6IyK7A40r39Cf9PrPOu8StwWu0jojIo=',
- encrypted: 'AMv457W0EOt8RH+LAEoMQ7dKjZamzOdwTHJepDkaGGoQHi2z8coCiVemL5XYZ+ctjPBdw3y3nlMn1sif9i3WCzY26ram8PL5eVYk7Bm3XBjv9wuhw1RZmLFzKfJS+3vi+RTFhwjyyeaJrc07f5E7Cu7CVWNh3Oe3lvSF3TB2HUI8'
- }, {
- title: 'RSAES-OAEP Encryption Example 2.6',
- message: 'in+zRMi2yyzy7x9kP5oyGPbhm7qJwA==',
- seed: 'TEXPTVfJjj1tIJWtxRxInrUN/4RMRc9NV8mOPW0gla0=',
- encrypted: 'AJ5iMVr3Q6ZZlqLj/x8wWewQBcUMnRoaS2lrejzqRk12Bw120fXolT6pgo20OtM6/ZpZSN7vCpmPOYgCf93MOqKpN1pqumUH33+iP1a+tos5351SidwwNb2hLy3JfhkapvjB+c9JvbIolIgr+xeWhWPmMDam/Du/y+EsBOdZrbYc'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha256', examples);
-
- // Example 3: A 1026-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'ArWP7AOahgcApNe2Ri+T5s3UkRYd3XT06BC0DjwWUgBqXCd7J3TBEwWky6taeO+lfheobfej+jb8Sx0iSfIux8LdakYyMqzOqQbWbr6AtXBLEHKdpvgzI0q7Xv3UopLL+tM7TTP6ehS4w5e1bjrNISA0KLd836M6bacGs9iw/EPp';
- exponent = 'AQAB';
- d = 'FbSKW1aDqUZw4jtXGPgU+g4T+FA49QcRGCy6YVEFgfPSLH4jLvk34i5VHWi4bi+MsarYvi5Ij13379J54/Vo1Orzb4DPcUGs5g/MkRP7bEqEH9ULvHxRL/y+/yFIeqgR6zyoxiAFNGqG3oa/odipSP0/NIwi6q3zM8PObOEyCP0=';
- p = 'Ab8B0hbXNZXPAnDCvreNQKDYRH0x2pGamD9+6ngbd9hf43Gz6Tc+e2khfTFQoC2JWN5/rZ1VUWCVi0RUEn4Ofq8=';
- q = 'AY0zmWWBZts4KYFteylUFnWenJGYf1stiuzWOwS0i9ey/PIpu3+KbciLoT3S45rVW20aBhYHCPlwC+gLj9N0TOc=';
- dP = 'BsCiSdIKby7nXIi0lNU/aq6ZqkJ8iMKLFjp2lEXl85DPQMJ0/W6mMppc58fOA6IVg5buKnhFeG4J4ohalyjk5Q==';
- dQ = '0dJ8Kf7dkthsNI7dDMv6wU90bgUc4dGBHfNdYfLuHJfUvygEgC9kJxh7qOkKivRCQ7QHmwNEXmAuKfpRk+ZP6Q==';
- qInv = 'jLL3Vr2JQbHTt3DlrTHuNzsorNpp/5tvQP5Xi58a+4WDb5Yn03rP9zwneeY0uyYBHCyPfzNhriqepl7WieNjmg==';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 3.1',
- message: 'CHggtWno+o0=',
- seed: 'jO1rGWKQgFeQ6QkHQBXmogsMSJSM7WsZYpCAV5DpCQc=',
- encrypted: 'AJqBCgTJGSHjv2OR0lObiDY2gZmWdutHfVeadCdFr2W4mS3ZHwet283wbtY/bsM8w0rVxNAPh3NZNrcRt56NhoT0NzD2IK3WNy39Im/CfbicvC6Vq2PyXUh1iza+90PUM3jECPP5NsOx658MzEnYyFZFb9izZIna6YLsXwkWoHVO'
- }, {
- title: 'RSAES-OAEP Encryption Example 3.2',
- message: 'RlOsrxcZYLAfUqe+Y6OrIdw2jsQ7UNguw3geBA==',
- seed: 'tCkdZWdVCEjMFWlnyAm6q2ylB/C0KR1lZ1UISMwVaWc=',
- encrypted: 'ARCj8j/hSsscyXtuINlyU0HuC+d7wZc7bSekF60BJFWKeKa1p28d4KsJXmdqI22sxha7PgkI9bgpfgdBd8KHp12g5y68uXiwRyPOvv8s6YDKmJFhbW13LHbE3iZHch2YG1eHi/20M/IrsAqCuk/W5Q/dP5eSVM1hLT9LBVsX3rIH'
- }, {
- title: 'RSAES-OAEP Encryption Example 3.3',
- message: '2UzQ4I+kBO2J',
- seed: 'zoko9gWVWCVACLrdl5T63NL9H2XOiSj2BZVYJUAIut0=',
- encrypted: 'Anfa/o/QML7UxLCHcSUWFPUWhcp955u97b5wLqXuLnWqoeQ3POhwasFh3/ow2lkzjjIdU47jkYJEk6A0dNgYiBuDg57/KN5yS2Px/QOSV+2nYEzPgSUHGyZacrHVkj/ZVyZ+ni7Iyf/QkNTfvPGxqmZtX6cq095jgdG1ELgYsTdr'
- }, {
- title: 'RSAES-OAEP Encryption Example 3.4',
- message: 'bMZBtrYeb5Y5dNrSOpATKE7x',
- seed: 'bil59S1oFKV9g7CQBUiI8RmluaNuKXn1LWgUpX2DsJA=',
- encrypted: 'AalUnNYX91mP0FrqphpfhU22832WgnjDNRU1pkpSrd5eD7t7Q1YhYE+pKds6glA8i1AE/li216hJs2IbCJMddyaXrDzT8V9/UfIUaSkLfcRYBrTn9DEDOTjY1Xnn38poLOFykpZbAz5hdbOh0qG39qFgl5QZG0+aTBd1tmlMZBfO'
- }, {
- title: 'RSAES-OAEP Encryption Example 3.5',
- message: '31FRgyth9PJYkftBcvMo0u3fg3H/z9vpl5OSlfMOymkYAXz9oRU796avh1kyIw==',
- seed: 'LXYL/jjFneNM3IuMeKOOZihKLSctdgv+OMWd40zci4w=',
- encrypted: 'AGgQQYTuy9dW6e3SwV5UFYbEtqQD7TDtxcrMYOmYlTPgTwIFpo4GbQbtgD9BMFAW7a1lIzLxKEld49jH6m95Xgtq/BAVFl/gXin5MMbiZfRTOl38miBTg5a6IS9w6tcrWIBeY5Z5n4iCuUqF9r/m9TqvxWF0aMP2VGVKZn+LHMVj'
- }, {
- title: 'RSAES-OAEP Encryption Example 3.6',
- message: 'PDutiTxUSm1SCrAiMZGIyNUEt6eIuFCQO4WXLqoYVS4RNKetYJiCYlT/erZys9jrMVj6xtTLrvE=',
- seed: '8XR3nF/Tz+AHuty3o2ybVb/Pvw7xdHecX9PP4Ae63Lc=',
- encrypted: 'Aps8BQrRkPPwpNIjHw3NBznsDvp1hIHmlbG5wRERr9+Ar4ervO2GA/MMUVNijdZEtFnCGjbLwpM6RKzCk96jJX1bIgzq7hnmIzwKmq2Ue4qqO29rQL39jpCS87BBo/YKMbkYsPc2yYSDMBMOe9VDG63pvDgFGrlk/3Yfz1km3+/Y'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha256', examples);
-
- // Example 4: A 1027-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'BRJAtswABPpI0BNGccB4x8jew7Pi8lvCVkRnM52ziFPQa4XupbLeNTv/QqwuRryX+uaslhjalTelyPVTweNXYlmR1hCNzXiF+zolQT9T78rZSMs1zZua6cHGdibRE9V93kxb6na7W7felsANBzculoWm11z50jn6FI1wkxtfP7A5';
- exponent = 'AQAB';
- d = 'BBH/yjt8penpvn/jioUQXjU4ltsFxXlq7NKnJRYes2UchimpuGK5BNewx7N/jLWhwrVAAQGKAKHrLK/k7k6UksNIvCvtq0ueu/Bk6O/zIrkAn47sZTkF9A34ijzcSdRWf3VifUGspiQSm0agt8aY5eZfK3uhAsdJoQE1tlQNBAE=';
- p = 'AnRYwZ7BY2kZ5zbJryXWCaUbj1YdGca/aUPdHuGriko/IyEAvUC4jezGuiNVSLbveSoRyd6CPQp5IscJW266VwE=';
- q = 'AhDumzOrYXFuJ9JRvUZfSzWhojLi2gCQHClL8iNQzkkNCZ9kK1N1YS22O6HyA4ZJK/BNNLPCK865CdE0QbU7UTk=';
- dP = 'OfoCi4JuiMESG3UKiyQvqaNcW2a9/R+mN9PMSKhKT0V6GU53J+Sfe8xuWlpBJlf8RwxzIuvDdBbvRYwweowJAQ==';
- dQ = 'AV2ZqEGVlDl5+p4b4sPBtp9DL0b9A+R9W++7v9ax0Tcdg++zMKPgIJQrL+0RXl0CviT9kskBnRzs1t1M8eVMyJk=';
- qInv = 'AfC3AVFws/XkIiO6MDAcQabYfLtw4wy308Z9JUc9sfbL8D4/kSbj6XloJ5qGWywrQmUkz8UqaD0x7TDrmEvkEro=';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 4.1',
- message: 'SoZglTTuQ0psvKP36WLnbUVeMmTBn2Bfbl/2E3xlxW1/s0TNUryTN089FmyfDG+cUGutGTMJctI=',
- seed: 'HKwZzpk971X5ggP2hSiWyVzMofMcrBnOmT3vVfmCA/Y=',
- encrypted: 'AooWJVOiXRikAgxb8XW7nkDMKIcrCgZNTV0sY352+QatjTq4go6/DtieHvIgUgb/QYBYlOPOZkdiMWXtOFdapIMRFraGeq4mKhEVmSM8G5mpVgc62nVR0jX49AXeuw7kMGxnKTV4whJanPYYQRoOb0L4Mf+8uJ5QdqBE03Ohupsp'
- /* FIXME: could not convert 4.2', to SHA-256, message too long
- }, {
- title: 'RSAES-OAEP Encryption Example 4.2',
- message: 'sK3E8/4R2lnOmSdz2QWZQ8AwRkl+6dn5oG3xFm20bZj1jSfsB0wC7ubL4kSci5/FCAxcP0QzCSUS7EaqeTdDyA==',
- seed: '9UXViXWF49txqgy42nbFHQMq6WM=',
- encrypted: 'AJe2mMYWVkWzA0hvv1oqRHnA7oWIm1QabwuFjWtll7E7hU60+DmvAzmagNeb2mV4yEH5DWRXFbKA03FDmS3RhsgLlJt3XK6XNw5OyXRDE2xtpITpcP/bEyOiCEeCHTsYOB3hO7SarqZlMMSkuCcfPq4XLNNm4H5mNvEBnSoortFe'
- */
- }, {
- title: 'RSAES-OAEP Encryption Example 4.3',
- message: 'v21C5wFwex0CBrDItFoccmQf8SiJIZqCveqWW155qWsNAWPtnVeOya2iDy+88eo8QInYNBm6gbDGDzYG2pk=',
- seed: 'rZl/7vcw1up75g0NxS5y6sv90nWtmX/u9zDW6nvmDQ0=',
- encrypted: 'AtYYko32Vmzn3ZtrsDQH9Mw/cSQk9pePdwQZJ6my7gYXWYpBdhbEN/fH7LMmvjtHnKLLTDazfF1HT0tTG6E+TY002cy+fMUvdRn0rfmFkNeHeqVOABP2EmI4eXFCBbbIlpshLxbA3vDTzPPZZqwMN+KPG4O11wmS9DcyHYtpsIOU'
- }, {
- title: 'RSAES-OAEP Encryption Example 4.4',
- message: '+y7xEvXnZuuUAZKXk0eU974vb8HFjg==',
- seed: 'E2RU31cw9zyAen5A2MGjEqxbndMTZFTfVzD3PIB6fkA=',
- encrypted: 'AZX8z/njjTP/ApNNF+BNGUjlczSK/7iKULnZhiAKo4LJ0XaTzTtvL9jacr+OkRxSPUCpQeK36wXdi9qjsl3SO9D7APyzN1nNE5Nu5YstiAfEMVNpdRYGdgpUasEZ4jshBRGXYW28uTMcFWRtzrlol9Lc7IhIkldTXZsR9zg11KFn'
- }, {
- title: 'RSAES-OAEP Encryption Example 4.5',
- message: 'KMzUR7uehRZtq7nlt9GtrcS5058gTpbV5EDOmtkovBwihA==',
- seed: 'vKgFf4JLLqJX8oYUB+72PTMghoG8qAV/gksuolfyhhQ=',
- encrypted: 'A8GIo5X2qOS6MdKjYJg+h3hi2endxxeb3F5A8v+MbC7/8WbBJnzOvKLb6YMukOfAqutJiGGzdPQM9fopdhbRwS/Ovw4ksvmNBVM+Q26CFPqvdhV8P0WxmeYTxGFGrLgma+fwxpe7L6mj300Jq6Y/5kfTEJSXNdKuLRn0JsIg8LSD'
- }, {
- title: 'RSAES-OAEP Encryption Example 4.6',
- message: '8iJCdR7GsQ==',
- seed: 'Ln4eF/ZHtd3QM+FUcvkPaBLzrE4ufh4X9ke13dAz4VQ=',
- encrypted: 'AM9cnO14EVBadGQYTnkkbm/vYwqmnYvnAutrc4bZR3XC0DNhhuUlzFosUSmaC1LrjKcFfcqZOwzlev5uZycR7tUlLihC6lf4o0khAjUb03Dj+ubNsDKNCOA6vP63N3p6jSVIak7EPu0KtBLuNpIyW5mdkMuwssV7CNLOQ6qG7zxZ'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha256', examples);
-
- // Example 5: A 1028-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'Cq3z+cEl5diR8xrESOmT3v5YD4ArRfnX8iulAh6cR1drWh5oAxup205tq+TZah1vPSZyaM/0CABfEY78rbmYiNHCNEZxZrKiuEmgWoicBgrA2gxfrotV8wm6YucDdC+gMm8tELARAhSJ/0l3cBkNiV/Tn1IpPDnv1zppi9q58Q7Z';
- exponent = 'AQAB';
- d = 'AlbrTLpwZ/LSvlQNzf9FgqNrfTHRyQmbshS3mEhGaiaPgPWKSawEwONkiTSgIGwEU3wZsjZkOmCCcyFE33X6IXWI95RoK+iRaCdtxybFwMvbhNMbvybQpDr0lXF/fVKKz+40FWH2/zyuBcV4+EcNloL5wNBy+fYGi1bViA9oK+LF';
- p = 'A7DTli9tF1Scv8oRKUNI3PDn45+MK8aCTyFktgbWh4YNrh5jI5PP7fUTIoIpBp4vYOSs1+YzpDYGP4I4X0iZNwc=';
- q = 'AuTDLi9Rcmm3ByMJ8AwOMTZffOKLI2uCkS3yOavzlXLPDtYEsCmC5TVkxS1qBTl95cBSov3cFB73GJg2NGrrMx8=';
- dP = 'AehLEZ0lFh+mewAlalvZtkXSsjLssFsBUYACmohiKtw/CbOurN5hYat83iLCrSbneX31TgcsvTsmc4ALPkM429U=';
- dQ = '65CqGkATW0zqBxl87ciBm+Hny/8lR2YhFvRlpKn0h6sS87pP7xOCImWmUpfZi3ve2TcuP/6Bo4s+lgD+0FV1Tw==';
- qInv = 'AS9/gTj5QEBi64WkKSRSCzj1u4hqAZb0i7jc6mD9kswCfxjngVijSlxdX4YKD2wEBxp9ATEsBlBi8etIt50cg8s=';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 5.1',
- message: 'r3GpAeOmHTEy8Pwf20dPnqZXklf/wk0WQXAUWz296A==',
- seed: 'RMkuKD93uUmcYD2WNmDIfS+TlGFEyS4oP3e5SZxgPZY=',
- encrypted: 'BOGyBDRo+2G7OC79yDEzJwwLMPuhIduDVaaBdb5svHj/ZAkVlyGVnH0j+ECliT42Nhvp4kZts+9cJ0W+ui7Q9KXbjmX033MpxrvSV1Ik//kHhX6xTn51UGpaOTiqofjM3QTTi9DVzRtAarWd/c8oAldrGok1vs+tJEDbcA5KvZz7'
- }, {
- title: 'RSAES-OAEP Encryption Example 5.2',
- message: 'o7hEoII5qKxBYFrxemz9pNNQE2WFkDpBenkmh2BRmktKwzA+xz8Ph8+zI5k=',
- seed: 'yyj1hgZZ/O7knD7q/OYlpwgDvTLLKPWGBln87uScPuo=',
- encrypted: 'AeleoSbRCOqBTpyWGLCrZ2G3mfjCYzMvupBy+q+sOKAfBzaLCjCehEUmIZFhe+CvtmVvyKGFqOwHUWgvks9vFU7Gfi580aZm7d4FtaGGVHBO6Q32/6IS7a+KSk7L6rPWwBTI+kyxb5SW12HTEowheKkFTda06tU0l4Ji45xP2tyh'
- }, {
- title: 'RSAES-OAEP Encryption Example 5.3',
- message: 'MIsOy9LHbLd/xvcMXt0jP9LyCSnWKfAmlTu2Ko9KOjFL3hld6FtfgW2iqrB00my2rN3zI647nGeKw88S+93n',
- seed: 'IoX0DXcEgvmp76LHLLOsVXFtwMoihfQNdwSC+anvosc=',
- encrypted: 'Ci3TBMV4P0o59ap6Wztb9LQHfJzYSOAaYaiXjk85Q9FYhAREaeS5YXhegKbbphMIS5i1SYJShmwpYu/t8SGHiX/72v6NnRgafDKzttROuF/HJoFkTBKH6C9NKke+mxoDy/YVZ9qYzFY6PwzB4pTDwku9s5Ha4DmRBlFdA/z713a4'
- }, {
- title: 'RSAES-OAEP Encryption Example 5.4',
- message: 'FcW57hGF',
- seed: 'SfpF06eN0Q39V3OZ0esAr37tVRNJ+kXTp43RDf1Xc5k=',
- encrypted: 'AcMQiclY0MMdT9K4kPqZ7JYHTaSolc8B3huHcQ4U5mG11/9XjzWjTLha8Liy0w909aaPbaB7+ZQTebg7x3F4yeWFRmnAJMaIFGBW/oA952mEaJ+FR2HO0xfRPzCRCaaU7cyOxy0gnR8d9FMunt9fhbffM9TvOfR6YDE5Duz6Jg0W'
- }, {
- title: 'RSAES-OAEP Encryption Example 5.5',
- message: 'IQJuaADH+nKPyqug0ZauKNeirE/9irznlPCYX2DIpnNydzZdP+oR24kjogKa',
- seed: '8Ch0EyNMxQNHJKCUxFhrh6/xM/zwKHQTI0zFA0ckoJQ=',
- encrypted: 'A/gvyZ/MNHUG3JGcisvAw/h1bhviZsqIsEM5+gBpLfj7d8iq28yZa6z5cnS4cJWywHxyQMgt9BAd37im/f5WcIcB+TZS9uegFSdgaetpYf4ft/1wMlcdc1ReCrTrCKPFHLLczeifyrnJSVvQD84kQY21b4fW9uLbSiGO0Ly94il1'
- }, {
- title: 'RSAES-OAEP Encryption Example 5.6',
- message: 'VB43totsiHK4TAI=',
- seed: '2fukXJbyHm4m0p6yzctlhb6cs0HZ+6RclvIebibSnrI=',
- encrypted: 'AWmTYpBHOqRBGy1h5mF88hMmBVNLN++kXAqQr4PKszqorigNQZbvwbOdWYNLsXydyvKi55ds8tTvXf4rRBswyuNmbtT0t2FVCTnTjNzA1cMSahInbdKfL/1wib3CjyQmC0TbbIa3kkAdXkiYytSafDxwNyan1OWtJcMLkJ6l8WRm'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha256', examples);
-
- // Example 6: A 1029-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'ErF/ba0uzRn/RtwT94YPCeDgz7Z3s4pSWSMFzq8CLBZtuQ0ErCnjP33RLZ+vZuCBa7Y+rSZ8x9RsF8N74hS8oqItcjpk5EQHQ2tvyWVymu/CVU83bNXc6mgpN4CmK/OdAClIWhYLu55dwJctIaUE9S5e4CiqQWMy9RCy6c/19yKv';
- exponent = 'AQAB';
- d = 'ApXso1YGGDaVWc7NMDqpz9r8HZ8GlZ33X/75KaqJaWG80ZDcaZftp/WWPnJNB7TcEfMGXlrpfZaDURIoC5CEuxTyoh69ToidQbnEEy7BlW/KuLsv7QV1iEk2Uixf99MyYZBIJOfK3uTguzctJFfPeOK9EoYij/g/EHMc5jyQz/P5';
- p = 'BKbOi3NY36ab3PdCYXAFr7U4X186WKJO90oiqMBct8w469TMnZqdeJpizQ9g8MuUHTQjyWku+k/jrf8pDEdJo4s=';
- q = 'BATJqAM3H+20xb4588ALAJ5eCKY74eQANc2spQEcxwHPfuvLmfD/4Xz9Ckv3vv0t1TaslG23l/28Sr6PKTSbke0=';
- dP = 'A5Ycj3YKor1RVMeq/XciWzus0BOa57WUjqMxH8zYb7lcda+nZyhLmy3lWVcvFdjQRMfrg6G+X63yzDd8DYR1KUs=';
- dQ = 'AiGX4GZ0IZaqvAP6L+605wsVy3h9YXrNMbt1x7wjStcG98SNIYLR8P+cIo3PQZZ7bAum0sCtEQobhXgx7CReLLE=';
- qInv = 'BAHEwMU9RdvbXp2W0P7PQnXfCXS8Sgc2tKdMMmkFPvtoas4kBuIsngWN20rlQGJ64v2wgmHo5+S8vJlNqvowXEU=';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 6.1',
- message: 'QEbKi6ozR8on9J4NgfnMHXG+m6UX1A==',
- seed: '3Q9s/kFeiOWkaaUfu6bf1ArbQ4TdD2z+QV6I5aRppR8=',
- encrypted: 'C3d3hdR81ybq+Wuf6QUfy2KHVuQjrsvVH2HuE2LbJT2o2ZPdrDHIoGphdGj+GWNTrcV/d8iPLJlZ0CR3O2e2b7wLUVPMorv1HidYA8B8eJxkg5FIsPuK836LchnGqQlE7ObiWOjSuIw4lZ/ULCfOYejelr6PJXSxWgQUlV78sbvP'
- }, {
- title: 'RSAES-OAEP Encryption Example 6.2',
- message: 'XMcsYCMd8Ds9QPm1eTG8MRCflyUn8osZ50gMcojLPJKyJRIhTkvmyRR5Ldq99X+qiqc=',
- seed: 'jRS9lGoTURSPXK4u2aDGU+hevYWNFL2UahNRFI9cri4=',
- encrypted: 'DXAHBh/uWFjxl/kIwrzm0MXeHNH5MSmoPc0mjn00UcCUFmOwTQipPmLmephH+rNOOfCQVvwP5wysU3/w2hjmk/rl6Jb4qNc+KqDiij7fKSKhPGTvY3aiXZ2LflnJ3yv4LdT9KvvWsZrHEWfsEG+fQZW4c1OMEpOMC4N44nc88yRm'
- }, {
- title: 'RSAES-OAEP Encryption Example 6.3',
- message: 'sg5lEwMJL0vMtDBwwPhtIwSTYu2WZC/FYywn20pS49gx8qsGiyOxSYecAC9r8/7ul1kRElYs',
- seed: 'bAdbxFUg8WXAv16kxd8ZG8nvDkRsB1vEVSDxZcC/XqQ=',
- encrypted: 'AMe1ZPYbk4lABLKDLhwJMM4AfK46Jyilp/vQ9M921AamJzanoNGdlj6ZEFkbIO68hc/Wp4Qr43iWtjcasgpLw2NS0vroRi91VI5k9BZgXtgNG7Z9FBOtPjM61Um2PWSFpAyfaZS7zoJlfRKciEa+XUKa4VGly4fYSXXAbUJV2YHc'
- }, {
- title: 'RSAES-OAEP Encryption Example 6.4',
- message: 'aE4wOMXAQfc=',
- seed: 'O7w71mN9/hKEaQECm/WwwHEDQ5w7vDvWY33+EoRpAQI=',
- encrypted: 'AJS/vpVJKJuLwnnzENVQChT5MCBa0mLxw/a9nt+6Zj4FL8nucIl7scjXSOkwBDPcyCWr7gqdtjjZ9z6RCQv0HfjmVKI2M6AxI2MYuzwftIQldbhCRqo8AlyK3XKjfcK+Rzvii53W8Xw4Obbsv9OCLnCrrbK8aO3XKgrHPmDthH7x'
- }, {
- title: 'RSAES-OAEP Encryption Example 6.5',
- message: 'MkiMsmLQQdbk3TX5h788ppbbHwasKaRGkw==',
- seed: 'tGtBiT6L7zJvZ1k4OoMHHa5/yry0a0GJPovvMm9nWTg=',
- encrypted: 'CmNUKnNQco5hWHxCISdwN5M7LbL7YJ0u7bfH82LulE32VdATd3vcJmRiFtcczNNudMlHVhl6/ZsDVY1zymLrK2kLIYWeG9Iag3rQ5xhjLAdpMYBBuwjrJ8Oqc4+2qH57bBveynuE5xRpd9p+CkkiRP7x7g4B/iAwrmFxPtrxV/q/'
- }, {
- title: 'RSAES-OAEP Encryption Example 6.6',
- message: 'ULoUvoRicgJ5wwa6',
- seed: 'CiQDMSpB49UvBg+8E6Z95c92CacKJAMxKkHj1S8GD7w=',
- encrypted: 'DpQAu4uQ4zbkpP/f698+a5f3MhAXCi3QTcP7vXmQVlkH0CFlCnDESNG36Jk2ybe3VmzE2deBHBKI9a5cHUzM9Lsa/AoxnbD5qd2fJt9k19dSRtDWZUR/Bn/AdVHwstzsX/vRLe6qOk9Kf01OZcvKrmlWh2IBLs8/6sEJhBWXNAKj'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha256', examples);
-
- // Example 7: A 1030-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'MRF58Lz8m508oxXQDvMNe906LPrpkRv+3LlIs6R4LQcytqtEqkvwN0GmRNwBvsPmmwGgM+Z12KzXxJJcaxrsMRkFHf2Jdi0hXUVHX/y1n5CBSGI/NxdxVvauht16fF9D3B4fkIJUBYooSl8GwAIXk6h/GsX+/33K7mnF5Ro3ieNz';
- exponent = 'AQAB';
- d = 'Bwz8/y/rgnbidDLEXf7kj0m3kX1lMOHwyjRg8y4CdhdEh8VuIqRdJQDXd1SVIZ19Flqc872Swyr5qY2NycwpaACtyUoKVPtA80KRv4TujqErbxCTWcbTVCpQ+cdn9c//BaaBwuZW+3fKqttL6UaNirzU35j1jobSBT+hNJ90jiGx';
- p = 'B0kmLBEc1HDsJWbms3MvwJMpRpqhkHHTucAZBlFMbx0muqFL6rCXHIt+YRpPeQCdb+p3aSjKJShbDeNkPRo/jHE=';
- q = 'BrweUOlsAr9jbp7qi4mbvr92Ud533UdMPpvCO62BgrYZBMfZffvr+x4AEIh4tuZ+QVOR1nlCwrK/m0Q1+IsMsCM=';
- dP = 'A7x+p/CqsUOrxs6LlxGGNqMBcuTP4CyPoN2jt7qvkPgJKYKYVSX0iL38tL1ybiJjmsZKMJKrf/y/HVM0z6ULW/E=';
- dQ = 'AmKmqinCo8Z9xTRsBjga/Zh6o8yTz7/s9U/dn514fX9ZpSPTmJedoTei9jgf6UgB98lNohUY3DTLQIcMRpeZStk=';
- qInv = 'ZJ1MF7buFyHnctA4mlWcPTzflVDUV8RrA3t0ZBsdUhZq+KITyDliBs37pEIvGNb2Hby10hTJcb9IKuuXanNwwg==';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 7.1',
- message: 'R6rpCQ==',
- seed: 'Q90JoH/0ysccqkYy7l4cHa7kzY9D3Qmgf/TKxxyqRjI=',
- encrypted: 'CdXefX8LEW8SqnT1ly7/dvScQdke1rrSIBF4NcFO/G+jg0u7yjsqLLfTa8voI44Ue3W6lVuj5SkVYaP9i7VPmCWA4nFfeleuy23gbHylm4gokcCmzcAm2RLfPQYPnxIb3hoQ2C3wXo/aWoLIMFPYzI19g5uY90XMEchAci3FVC/a'
- }, {
- title: 'RSAES-OAEP Encryption Example 7.2',
- message: 'HZsuIiPZvBO/ufFiznNdtIunxo9oIqChp7auFlg05w==',
- seed: 'Opw87HuE+b063svGc+yZ1UsivJs6nDzse4T5vTrey8Y=',
- encrypted: 'DDar5/aikhAVropPgT3SVzSMRtdS9sEmVBEqg9my/3na0Okz51EcAy436TOZVsM0exezvKYsVbDQhtOM0Mn9r6oyBsqzUR4lx6Gt2rYDYC4X1aMsJSVcQs9pDqeAWfIAmDIIQH/3IN2uJ6u4Xl2+gFCpp8RP0F//Rj2llnEsnRsl'
- }, {
- title: 'RSAES-OAEP Encryption Example 7.3',
- message: '2Xb8',
- seed: 'dqdeW2FXpVbPiIS7LkXCk91UXPV2p15bYVelVs+IhLs=',
- encrypted: 'GpTkYrRFNyD9Jw1Pc1TSPSfc9Yb8k4Fw1l4kCwqPodlAboKMJe+yuXoGgVeB7Jb7JTQklGpQc1keZUzUUVZO0Q4qYUelFFe5lWM2uhq21VCbvcchrMTP6Wjts05hVgJHklLKF5cOtBGpQC0FlkwCYoXUAk//wejNycM/ZXw+ozkB'
- }, {
- title: 'RSAES-OAEP Encryption Example 7.4',
- message: '1HOGI98iOqQ4Q9+EZ1NMQdAT4MgDxiTiY2ZrI5veQKXymuuN5549qmHdA3D0m9SwE4NLmCEq72scXuNzs8s=',
- seed: 'eGYxSmrW8rJQo1lB2yj1hktYWFl4ZjFKatbyslCjWUE=',
- encrypted: 'G5GJEPP4ifUCg+3OHEq41DFvaucXwgdSGyuDX6/yQ1+e30d0OIjIFv4JTUXv6Oi8/uADg+EN5Ug+lEyf0RNSS4wfKgRfAaXK6x1U8dh48g/bED27ZCZ+MjhAkUcjMO0h4m3nNfLxAju7nxO2cJzNI9n1TBCMngJBco0zzhOvMZaN'
- }, {
- title: 'RSAES-OAEP Encryption Example 7.5',
- message: 'u0cjHKXqHTrUbJk0XZqKYQ==',
- seed: 'shZu1HLVjbEMqyxrAAzM8Qp9xQmyFm7UctWNsQyrLGs=',
- encrypted: 'HebBc/6i18c2FbG7ibWuxyQgtiN1uhtxyNsXw1Kuz8zo7RkBkt5JZEwucKyXFSwI6drZlK6QaqCRZwPQsdc2wnZlQzbkilVf1TiACqzDdpKX5i+SbCTUsOyGETV3vtxFe7/SatEKseFSLEWkIfZxAFcisIs5hWmLJdqfWQeYuMrK'
- }, {
- title: 'RSAES-OAEP Encryption Example 7.6',
- message: 'IYSCcJXTXD+G9gDo5ZdUATKW',
- seed: 'Umc73iyhZsKqRhMawdyAjWfX07FSZzveLKFmwqpGExo=',
- encrypted: 'DX+W3vsdnJfe63BVUFYgCAG1VmTqG/DbQ4nZgWTUGHhuijUshLtz07dHar21GJ9Ory8QQPX67PgKGnBMp0fJBnqKO3boMOEcc52HEnQxOWIW2h2rgmDtnaYtvK85pddXzhbuXkXg4DDnoMy+4XzgbLfArK12deGB0wruBbQyv3Ar'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha256', examples);
-
- // Example 8: A 1031-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'W98OMNMh3aUUf4gkCPppGVSA34+A0/bov1gYUE82QnypsfVUC5xlqPaXTPhEeiRNkoAgG7Sfy75jeNGUTNIn4jD5bj0Q+Bnc7ydsZKALKktnAefQHeX6veOx6aDfgvRjE1nNImaWR/uxcXJGE07XtJfP/73EK1nHOpbtkBZiEt/3';
- exponent = 'AQAB';
- d = 'D30enlqqJf0T5KBmOuFE4NFfXNGLzbCd8sx+ZOPF6RWtYmRTBBYdCYxxW7eri9AdB+rz/tfH7QivKopi70SrFrMg4Ur3Kkj5av4mKgrkz2XmNekQeQzU7lzqdopLJjn35vZ3s/C7a+MrdXR9iQkDbwJk9Y1AHNuhMXFhV6dez2Mx';
- p = 'CgLvhEjZ+ti70NAEyMKql1HvlyHBsNAyNqVLDflHy67VolXuno4g1JHqFyP+CUcEqXYuiK/RbrtZlEEsqWbcT58=';
- q = 'CS02Ln7ToL/Z6f0ObAMBtt8pFZz1DMg7mwz01u6nGmHgArRuCuny3mLSW110UtSYuByaxvxYWT1MP7T11y37sKk=';
- dP = 'B8cUEK8QOWLbNnQE43roULqk6cKd2SFFgVKUpnx9HG3tJjqgMKm2M65QMD4UA10a8BQSPrpoeCAwjY68hbaVfX0=';
- dQ = 'rix1OAwCwBatBYkbMwHeiB8orhFxGCtrLIO+p8UV7KnKKYx7HKtYF6WXBo/IUGDeTaigFjeKrkPH+We8w3kEuQ==';
- qInv = 'BZjRBZ462k9jIHUsCdgF/30fGuDQF67u6c76DX3X/3deRLV4Mi9kBdYhHaGVGWZqqH/cTNjIj2tuPWfpYdy7o9A=';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 8.1',
- message: 'BQt1Xl5ogPe56daSp0w3quRJsxv+pt7/g3R6iX9sLIJbsa2/hQo8lplLXeWzPLx9SheROnln',
- seed: 'dwb/yh7PsevuKlXlxuJM0nl6QSV3Bv/KHs+x6+4qVeU=',
- encrypted: 'DZZvGJ61GU6OOkaPl2t8iLNAB1VwLjl3RKd/tcu19Vz9j68fjCFBQvASq9FK6Sul/N6sXIVsi4ypx/1m77bErYJqiGwkE8sQz/g4ViwQmeCvpfbCoq00B5LxklezvhnM5OeSxFtO/8AtYimLrJ3sUmDYk7xkDI20/Lb8/pyOFsjH'
- }, {
- title: 'RSAES-OAEP Encryption Example 8.2',
- message: 'TraNzZPKmxnfERvUNgj1VwJv5KodXPrCJ6PrWrlUjBigbd7SP4GCWYay/NcRCezvfv+Ihz8HXCqgxGn2nJK8',
- seed: 'o3F9oUO03P+8dCZlqPqVBYVUg0OjcX2hQ7Tc/7x0JmU=',
- encrypted: 'DwsnkHG2jNLgSU4LEvbkOuSaQ9+br9t3dwen8KDGmLkKVJgWGu+TNxyyo2gsBCw7S4eqEFrl49ENEhMehdjrHCBLrEBrhbHxgncKrwIXmcjX1DOCrQXEfbT4keig8TaXkasow5qby9Ded6MWcLu1dZnXPfiuiXaOYajMGJ1D3/y7'
- }, {
- title: 'RSAES-OAEP Encryption Example 8.3',
- message: 'hgSsVjKMGrWtkXhh',
- seed: '7gYgkHPMoCa7Jk5Rhb+MaLdzn4buBiCQc8ygJrsmTlE=',
- encrypted: 'PAKF3K/lSKcZKWQDr56LmmVqSltcaKEfS7G6+rwG239qszt8eKG6fMYJsP4h7ZfXyV1zuIZXTVhXgiRQbA9os0AhkWiMJJouhsAn60R20BOLQOtQxlXxVOvUMPGuG5EP2O+nTI0VCXky5kHNJdfJolSW+pJLVdSu4mX9Ooga1CSx'
- }, {
- title: 'RSAES-OAEP Encryption Example 8.4',
- message: '/dpfv27DYanZpKxoryFqBob0OLHg5cNrlV904QfznA3dzA==',
- seed: 'mQrVc9xIqXMjW22CVDYY8ulVEF2ZCtVz3EipcyNbbYI=',
- encrypted: 'LcCLDDj2S5ZOKwpvobOk6rfBWMBbxs3eWR+Edk3lKaoEAFFD5sQv0AaIs3r7yI8sOir9HvS6GKf+jc9t31zIDCIJc3sKVyrNZfEeUFSvihjbPZDo6IaZ8Jau8woE2p1z7n9rG+cbMwKuILRPSEN4hE0QSA/qz0wcye6bjb6NbK20'
- }, {
- title: 'RSAES-OAEP Encryption Example 8.5',
- message: 'Sl9JFL7iXePGk0HeBw==',
- seed: '7MY7KPB1byL1Ksjm7BJRpuwwRxjsxjso8HVvIvUqyOY=',
- encrypted: 'U+PBTMw6peNHnFQ3pwix/KvVeWu1nSKQGcr9QPpYNgHhuFZK6ARR7XhKxFtDoUMP+iVTXprcow4lr1Uaw4PnEx+cPe0Khl15R8GLiuh5Vm9p3lTPW1u58iP2Oa81pQZTB5AuFiD0fnFZsl+BYfjDVah3cMIu83KOBRPOdLY0j8iq'
- }, {
- title: 'RSAES-OAEP Encryption Example 8.6',
- message: 'jgfWb3uICnJWOrzT81CSvDNAn7f4jyRyvg==',
- seed: 'OSXHGzYtQKCm3kIUVXm6Hn3UWfw5JccbNi1AoKbeQhQ=',
- encrypted: 'WK9hbyje7E0PLeXtWaJxqD4cFkdL5x4vawlKJSOO1OKyZ6uaY8vMYBhBO47xRIqtab5Ul5UGCwdvwPR69PpARsiiSfJHVavkihXixHGgZViGTMU/7J7ftSiNT9hAwrj4JL4f1+8RhTp6WKRzsXAEKpvLK0TrzQL3ioF3QtTsiu/a'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha256', examples);
-
- // Example 9: A 1536-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'zyzUHjTKOnKOpcuK/2TDbSe971Nk4zb9aNMSPFoZaowocBPoU9UVbVjRUZVFIPtPbXsXq7aBd2WQnFdhGWWdkCsZBu2KKxDBVcJNEkUo2rnurjeb6sZuSkEXhty4/QBi68Aw3hIZoEwqjBt90xMeTWtsruLjGl7UGsFQmy7x7iqxg2S+VoypQcJezIT/nWQ7XsGqrhAqINc/R5t4D9bakQdSEtnqwDoGdNiZ66LkMfTES2Fba6IjK9SzO67XPWJd';
- exponent = 'AQAB';
- d = 'GYwUHiNxWpK8z2oRmlvBE4lGjSgR9UjXJ+F7SrDrmG1vIR77U7cffMvqh+5px17mFQCMUzLetSvzkKvfv+N9cgU2gVmyY4wd4ybiHSIlHw+1hIs78VAF0qdDMPCv6RbuYszBNE0dg6cJ5gZ2JzhA9/N3QkpeCk2nXwGzH/doGc+cv90hUkPDkXwD7zgZkxLlZ7O/eu06tFfzce+KFCP0W2jG4oLsERu6KDO5h/1p+tg7wbjGE8Xh6hbBHtEl6n7B';
- p = '/I1sBL7E65qBksp5AMvlNuLotRnezzOyRZeYxpCd9PF2230jGQ/HK4hlpxiviV8bzZFFKYAnQjtgXnCkfPWDkKjD6I/IxI6LMuPaIQ374+iB6lZ0tqNIwh6T+eVepl79';
- q = '0gDUXniKrOpgakAdBGD4fdXBAn4S3BoNdYbok52c94m0D1GsBEKWHefSHMIeBcgxVcHyqpGTOHz9+VbLSNFTuicEBvm7ulN9SYfZ4vmULXoUy//+p0/s3ako0j4ln17h';
- dP = '2xaAL3mi8NRfNY1p/TPkS4H66ChiLpOlQlPpl9AbB0N1naDoErSqTmyL6rIyjVQxlVpBimf/JqjFyAel2jVOBe8xzIz3WPRjcylQsD4mVyb7lOOdalcqJiRKsI23V1Kt';
- dQ = 'oKMXz+ffFCP4em3uhFH04rSmflSX8ptPHk6DC5+t2UARZwJvVZblo5yXgX4PXxbifhnsmQLgHX6m+5qjx2Cv7h44G2neasnAdYWgatnEugC/dcitL6iYpHnoCuKU/tKh';
- qInv = 'CyHzNcNTNC60TDqiREV4DC1lW5QBdMrjjHyKTmSTwLqf0wN0gmewg7mnpsth5C2zYrjJiW23Bk4CrVrmFYfaFbRknJBZSQn+s328tlS+tyaOyAHlqLSqORG+vYhULwW+';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 9.1',
- message: '9zX9VbqSWSw7Urj5xPaaqhy++P6IrdCVWVQSRn+c9OwLiWxZ7aFiEOdUnIq7EM28IaEuyba1uP0vEDmetg==',
- seed: 'jsll8TSj7Jkx6SocoNyBadXqcFyOyWXxNKPsmTHpKhw=',
- encrypted: 'kuBqApUSIPP0yfNvL0I57K2hReD8CcPhiYZFlPPmdM0cVFQHvdPMjQ2GcEekoBMk2+JR2H3IY6QF0JcANECuoepAuEvks/XolStfJNyUVUO3vLbWGlA1JOOSPiWElIdM0hmLN5In0DizqQit7R0mzH3Y1vUGPBhzOnNgNVQgrWVvqJugjG1SPY7LaZxIjhnz3O/8EkCpxLWcyWkFLX+ujnxIKxAqjmvEztiwLLlcWbJKILOy7KE1lctyh58wYP6e'
- }, {
- title: 'RSAES-OAEP Encryption Example 9.2',
- message: 'gbkGYFAVpjqr5C3fEeGXiRL1QEx0dLJtzj7Ugr+WHsyBi/QgxUZZ',
- seed: '7LG4sl+lDNqwjlYEKGf0r1gm0WzssbiyX6UM2rCOVgQ=',
- encrypted: 'iNEGT/cssEWuXX1C+SWyMK1hhUjRdNz9l8FeCBhftw8I5JUY1EDXPi2hUpESGxbJOjbyricua+QVvfP/UeoPfOxCcpRSoA3DlviB0ExCJTpCb2NSv9qXtw6Z7qEqk2YyQD7mAsGb2/Y3ug3KkKrF68MAxsWFV3tmL2NV2h+yfW6qz1dVAbAIUZeRuLIbaLdY9F7O4yPC68zkaX9NcTg0tOtnAJth9fMAOFX8sVbvKBgeOuVHV1A8HcAbmqkLMIyp'
- }, {
- title: 'RSAES-OAEP Encryption Example 9.3',
- message: '/TJkKd+biQ4JtUsYuPNPHiQ=',
- seed: '6JuwMsbOYiy9tTvJRmAU6nf3d8Dom7Ayxs5iLL21O8k=',
- encrypted: 'JiwfWprF58xVjVRR9B9r0mhomwU5IzkxXCZDgYJwYUcacmrz+KRLKMmtCMN7DLA2lOsfK+72mU+RLmhwfAAhBYmLGR8dLLstazb5xzU9wIM9u3jAl5iyyMLSo6wk/3SH0f7vC2bnFtMkhoHsd3VSTpzl5Q+SqX/4Q1JAMGWMMiHdyjCH+WaXNdTrboPEnPVtTcBGthkkYu8r/G0IkBR6OMPCZFgl/J4uiRTGCRbZx7UC02g6+qNMQY+ksygV6R8w'
- }, {
- title: 'RSAES-OAEP Encryption Example 9.4',
- message: '8UWbXwyS8BoPcjouVmJITY+MCiD8KdrWrNQ7tfPv/fThtj4H/f5mKNDXTKGb8taeSgq/htKTklp5Z3L4CI4=',
- seed: 'YG87mcC5zNdx6qKeoOTIhPMYnMxgbzuZwLnM13Hqop4=',
- encrypted: 'YXo+2y1QMWzjHkLtCW6DjdJ6fS5qdm+VHALYLFhG/dI1GmOwGOiOrFqesc5KPtWE73N5nJ680e6iYQYdFIsny6a4VH9mq/2Lr6qasMgM27znPzK8l6uQ1pTcDu1fJ4gCJABshzVEXzeTWx6OyKZsOFL8eXiNCwQpyfP9eH0tRjc+F75H3dnzX6AEVff4t0yKjDqp7aRMxFZGidcMJ6KetiNXUg1dhs/lHzItdQ7oMSUAgMnHYAvJDGqy5L4F8XXM'
- }, {
- title: 'RSAES-OAEP Encryption Example 9.5',
- message: 'U+boxynW+cMZ3TF+dLDbjkzMol88gwV0bhN6xjpj7zc557WVq7lujVXlT3vUGrQzN4/7kR0=',
- seed: '/LxCFALp7KvGCCr6QLpfJlIshA78vEIUAunsq8YIKvo=',
- encrypted: 'fwY+yhF2kyhotPKPlHEXcTOqVRG8Kg9bDJE/cSPUOoyVoiV0j57o9xpEYtZBuM5RanPUsTDcYNvorKqP5mbN81JV3SmEkIRTL7JoHGpJAMDHFjXBfpAwgUCPhfJ2+CUCIyOoPZqlt4w+K9l+WeFZYDatr0HC1NO+stbvWq358HRdX27TexTocG5OEB4l9gqhnUYD2JHNlGidsm0vzFQJoIMaH26x9Kgosg6tZQ0t3jdoeLbTCSxOMM9dDQjjK447'
- }, {
- title: 'RSAES-OAEP Encryption Example 9.6',
- message: 'trKOohmNDBAIvGQ=',
- seed: 'I6reDh4Iu5uaeNIwKlL5whsuG6Ijqt4OHgi7m5p40jA=',
- encrypted: 'PISd/61VECapJ7gfG4J2OroSl69kvIZD2uuqmiro3E4pmXfpdOW/q+1WCr574Pjsj/xrIUdgmNMAl8QjciO/nArYi0IFco1tCRLNZqMDGjzZifHIcDNCsvnKg/VRmkPrjXbndebLqMtw7taeVztYq1HKVAoGsdIvLkuhmsK0Iaesp+/8xka40c9hWwcXHsG+I7pevwFarxQQbuUjXSkZ2ObWgzgGSiGCw9QNUGpO0usATLSd0AFkeE+IM/KAwJCy'
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha256', examples);
-
- // Example 10: A 2048-bit RSA Key Pair
- // Components of the RSA Key Pair
- modulus = 'rkXtV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zVkVx0A+xXQij3plXpQkV1xJulELaz0K8guhi5Wc/9qAI7U0uN0YX34nxehYLQ7f9qctra3QhhgmBX31FyiY8FZqjLSctEn+vS8jKLXc3jorrGbCtfaPLPeCucxSYD2K21LCoddHfA8G645zNgz72zX4tlSi/CE0flp55Tp9sE=';
- dQ = 'Jlizf235wQML4dtoEX+p2H456itpO35tOi9wlHQT7sYULhj7jfy2rFRdfIagrUj4RXFw8O+ya8SBJsU+/R0WkgGY3CoRB9woLbaoDNMGI2C6P6E/cOQxL/GmzWuPxM2cXD2xfG1qVyEvc64p9hkye61ZsVOFhYW6Tii2CmKkXkk=';
- qInv = 'bzhSazklCFU07z5BWoNu3ouGFYosfL/sywvYNDBP7Gg7qNT0ecQz1DQW5jJpYjzqEAd22Fr/QB0//2EO5lQRzjsTY9Y6lwnu3kJkfOpWFJPVRXCoecGGgs2XcQuWIF7DERfXO182Ij+t1ui6kN18DuYdROFjJR4gx/ZuswURfLg=';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- examples = [{
- title: 'RSAES-OAEP Encryption Example 10.1',
- message: 'i7pr+CpsD4bV8XVul5VocLCJU7BrTrIFvBaU7g==',
- seed: 'R+GrcRn+5WyV7l6q2G9A0KpjvTNH4atxGf7lbJXuXqo=',
- encrypted: 'iXCnHvFRO1zd7U4HnjDMCLRvnKZj6OVRMZv8VZCAyxdA1T4AUORzxWzAtAAA541iVjEs1n5MIrDkymBDk3cM1oha9XCGsXeazZpW2z2+4aeaM3mv/oz3QYfEGiet415sHNnikAQ9ZmYg2uzBNUOS90h0qRAWFdUV5Tyxo1HZ0slg37Ikvyu2d6tgWRAAjgiAGK7IzlU4muAfQ4GiLpvElfm+0vch7lhlrk7t5TErhEF7RWQe16lVBva7azIxlGyyrqOhYrmQ+6JQpmPnsmEKYpSxTUP2tLzoSH5e+Y0CSaD7ZB20PWILB+7PKRueJ23hlMYmnAgQBePWSUdsljXAgA=='
- }, {
- title: 'RSAES-OAEP Encryption Example 10.2',
- message: '5q0YHwU7WKkE8kV1EDc+Vw==',
- seed: 'bRf1tMH/rDUdGVv3sJ0J8JpAec9tF/W0wf+sNR0ZW/c=',
- encrypted: 'I3uBbIiYuvEYFA5OtRycm8zxMuuEoZMNRsPspeKZIGhcnQkqH8XEM8iJMeL6ZKA0hJm3jj4z1Xz7ra3tqMyTiw3vGKocjsYdXchK+ar3Atj/jXkdJLeIiqfTBA+orCKoPbrBXLllt4dqkhc3lbq0Z5lTBeh6caklDnmJGIMnxkiG3vON/uVpIR6LMBg+IudMCMOv2f++RpBhhrI8iJOsPbnebdMIrxviVaVxT22GUNehadT8WrHI/qKv+p1rCpD3AAyXAhJy7KKp1l+nPCy1IY1prey+YgBxCAnlHuHv2V7q1FZTRXMJe3iKubLeiX6SfAKU1sivpoqk5ntMSMgAfw=='
- }, {
- title: 'RSAES-OAEP Encryption Example 10.3',
- message: 'UQos9g6Gb6I0BVPJTqOfvCVjEeg+lEVLQSQ=',
- seed: 'OFOHUU3szHx0DdjN+druSaHL/VQ4U4dRTezMfHQN2M0=',
- encrypted: 'n3scq/IYyBWbaN4Xd+mKJ0bZQR10yiSYzdjV1D1K3xiH11Tvhbj59PdRQXflSxE1QMhxN0jp9/tsErIlXqSnBH2XsTX6glPwJmdgXj7gZ1Aj+wsl15PctCcZv0I/4imvBBOSEd5TRmag3oU7gmbpKQCSHi6Hp2z5H/xEHekrRZemX7Dwl6A8tzVhCBpPweKNpe34OLMrHcdyb0k/uyabEHtzoZLpiOgHRjqi7SHr2ene9PPOswH7hc87xkiKtiFOpCeCScF6asFeiUTn5sf5tuPHVGqjKskwxcm/ToW3hm7ChnQdYcPRlnHrMeLBJt6o6xdrg6+SvsnNzctLxes0gA=='
- }, {
- title: 'RSAES-OAEP Encryption Example 10.4',
- message: 'vN0ZDaO30wDfmgbiLKrip18QyR/2Z7fBa96LUwZKJkmpQEXJ',
- seed: 'XKymoPdkFhqWhPhdkrbg7zfKi2VcrKag92QWGpaE+F0=',
- encrypted: 'KWbozLkoxbGfY0Dixr8GE/JD+MDAXIUFzm7K5AYscTvyAh9EDkLfDc/i8Y9Cjz/GXWsrRAlzO9PmLj4rECjbaNdkyzgYUiXSVV0SWmEF62nhZcScf+5QWHgsv6syu2VXdkz9nW4O3LWir2M/HqJ6kmpKVm5o7TqeYZ7GrY25FUnFDM8DpXOZqOImHVAoh8Tim9d2V9lk2D2Av6Tdsa4SIyBDj5VcX3OVoTbqdkKj5It9ANHjXaqGwqEyj7j1cQrRzrbGVbib3qzvoFvGWoo5yzr3D8J8z/UXJ4sBkumcjrphFTDe9qQcJ5FI82ZZsChJssRcZl4ApFosoljixk0WkA=='
- }, {
- title: 'RSAES-OAEP Encryption Example 10.5',
- message: 'p91sfcJLRvndXx6RraTDs9+UfodyMqk=',
- seed: 'lbyp44WYlLPdhp+n7NW7xkAb8+SVvKnjhZiUs92Gn6c=',
- encrypted: 'D7UPhV1nPwixcgg47HSlk/8yDLEDSXxoyo6H7MMopUTYwCmAjtnpWp4oWGg0sACoUlzKpR3PN21a4xru1txalcOkceylsQI9AIFvLhZyS20HbvQeExT9zQGyJaDhygC/6gPifgELk7x5QUqsd+TL/MQdgBZqbLO0skLOqNG3KrTMmN0oeWgxgjMmWnyBH0qkUpV5SlRN2P3nIHd/DZrkDn/qJG0MpXh6AeNHhvSgv8gyDG2Vzdf04OgvZLJTJaTdqHuXz93t7+PQ+QfKOG0wCEf5gOaYpkFarorv9XPLhzuOauN+Dd2IPzgKH5+wjbTZlZzEn+xRyDXK7s6GL/XOZw=='
- }, {
- title: 'RSAES-OAEP Encryption Example 10.6',
- message: '6vGnOhsMRglTfeac2SKLvPuajKjGw++vBW/kp/RjTtALfDnsaSLXuOosBOus',
- seed: 'n0fd9C6X7qhWqb28cU6zrCL26zKfR930LpfuqFapvbw=',
- encrypted: 'FO6Mv81w3SW/oVGIgdfAbIOW1eK8/UFdwryWg3ek0URFK09jNQtAaxT+66Yn5EJrTWh8fgRn1spnAOUsY5eq7iGpRsPGE86MLNonOvrBIht4Z+IDum55EgmwCrlfyiGe2fX4Xv1ifCQMSHd3OJTujAosVI3vPJaSsbTW6FqOFkM5m9uPqrdd+yhQ942wN4m4d4TG/YPx5gf62fbCRHOfvA5qSpO0XGQ45u+sWBAtOfzxmaYtf7WRAlu+JvIjTp8I2lAfVEuuW9+TJattx9RXN8jaWOBsceLIOfE6bkgad50UX5PyEtapnJOG1j0bh5PZ//oKtIASarB3PwdWM1EQTQ=='
- }];
- checkOAEPEncryptExamples(pubkey, privateKey, 'sha256', examples);
- }
-
- function _bytesToBigInteger(bytes) {
- var buffer = UTIL.createBuffer(bytes);
- var hex = buffer.toHex();
- return new BigInteger(hex, 16);
- }
-
- function _base64ToBn(s) {
- var decoded = UTIL.decode64(s);
- return _bytesToBigInteger(decoded);
- }
-
- function checkOAEPEncryptExamples(publicKey, privateKey, md, examples) {
- if(md === 'sha1') {
- md = MD.sha1.create();
- } else if(md === 'sha256') {
- md = MD.sha256.create();
- }
-
- for(var i = 0; i < examples.length; ++i) {
- var ex = examples[i];
- it('should test ' + ex.title, function() {
- checkOAEPEncrypt(
- publicKey, privateKey, md, ex.message, ex.seed, ex.encrypted);
- });
- }
- }
-
- function checkOAEPEncrypt(
- publicKey, privateKey, md, message, seed, expected) {
- var message = UTIL.decode64(message);
- var seed = UTIL.decode64(seed);
- var encoded = PKCS1.encode_rsa_oaep(
- publicKey, message, {seed: seed, md: md});
- var ciphertext = publicKey.encrypt(encoded, null);
- ASSERT.equal(expected, UTIL.encode64(ciphertext));
-
- var decrypted = privateKey.decrypt(ciphertext, null);
- var decoded = PKCS1.decode_rsa_oaep(privateKey, decrypted, {md: md});
- ASSERT.equal(message, decoded);
-
- // test with higher-level API, default label, and generating a seed
- ciphertext = publicKey.encrypt(message, 'RSA-OAEP', {md: md});
- decoded = privateKey.decrypt(ciphertext, 'RSA-OAEP', {md: md});
- ASSERT.equal(message, decoded);
- }
-
- function decodeBase64PublicKey(modulus, exponent) {
- modulus = _base64ToBn(modulus);
- exponent = _base64ToBn(exponent);
- return PKI.setRsaPublicKey(modulus, exponent);
- }
-
- function decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv) {
- modulus = _base64ToBn(modulus);
- exponent = _base64ToBn(exponent);
- d = _base64ToBn(d);
- p = _base64ToBn(p);
- q = _base64ToBn(q);
- dP = _base64ToBn(dP);
- dQ = _base64ToBn(dQ);
- qInv = _base64ToBn(qInv);
- return PKI.setRsaPrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
- }
-
- function makeKey() {
- var modulus, exponent, d, p, q, dP, dQ, qInv, pubkey, privateKey;
-
- // Example 1: A 1024-bit RSA Key Pair
- modulus = 'qLOyhK+OtQs4cDSoYPFGxJGfMYdjzWxVmMiuSBGh4KvEx+CwgtaTpef87Wdc9GaFEncsDLxkp0LGxjD1M8jMcvYq6DPEC/JYQumEu3i9v5fAEH1VvbZi9cTg+rmEXLUUjvc5LdOq/5OuHmtme7PUJHYW1PW6ENTP0ibeiNOfFvs=';
- exponent = 'AQAB';
- d = 'UzOc/befyEZqZVxzFqyoXFX9j23YmP2vEZUX709S6P2OJY35P+4YD6DkqylpPNg7FSpVPUrE0YEri5+lrw5/Vf5zBN9BVwkm8zEfFcTWWnMsSDEW7j09LQrzVJrZv3y/t4rYhPhNW+sEck3HNpsx3vN9DPU56c/N095lNynq1dE=';
- p = '0yc35yZ//hNBstXA0VCoG1hvsxMr7S+NUmKGSpy58wrzi+RIWY1BOhcu+4AsIazxwRxSDC8mpHHcrSEurHyjnQ==';
- q = 'zIhT0dVNpjD6wAT0cfKBx7iYLYIkpJDtvrM9Pj1cyTxHZXA9HdeRZC8fEWoN2FK+JBmyr3K/6aAw6GCwKItddw==';
- dP = 'DhK/FxjpzvVZm6HDiC/oBGqQh07vzo8szCDk8nQfsKM6OEiuyckwX77L0tdoGZZ9RnGsxkMeQDeWjbN4eOaVwQ==';
- dQ = 'lSl7D5Wi+mfQBwfWCd/U/AXIna/C721upVvsdx6jM3NNklHnkILs2oZu/vE8RZ4aYxOGt+NUyJn18RLKhdcVgw==';
- qInv = 'T0VsUCSTvcDtKrdWo6btTWc1Kml9QhbpMhKxJ6Y9VBHOb6mNXb79cyY+NygUJ0OBgWbtfdY2h90qjKHS9PvY4Q==';
- pubkey = decodeBase64PublicKey(modulus, exponent);
- privateKey = decodeBase64PrivateKey(modulus, exponent, d, p, q, dP, dQ, qInv);
-
- return {publicKey: pubkey, privateKey: privateKey};
- }
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/pki',
- 'forge/pkcs1',
- 'forge/md',
- 'forge/jsbn',
- 'forge/util'
- ], function(PKI, PKCS1, MD, JSBN, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- PKI(),
- PKCS1(),
- MD(),
- JSBN(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/pki')(),
- require('../../js/pkcs1')(),
- require('../../js/md')(),
- require('../../js/jsbn')(),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/pkcs12.js b/school/node_modules/node-forge/nodejs/test/pkcs12.js
deleted file mode 100644
index 70f482c..0000000
--- a/school/node_modules/node-forge/nodejs/test/pkcs12.js
+++ /dev/null
@@ -1,687 +0,0 @@
-(function() {
-
-function Tests(ASSERT, FORGE) {
- var forge = FORGE();
- var PKCS12 = forge.pkcs12;
- var ASN1 = forge.asn1;
- var PEM = forge.pem;
- var PKI = forge.pki;
- var UTIL = forge.util;
-
- var _data;
- describe('pkcs12', function() {
- it('should create certificate-only p12', function() {
- var p12Asn = PKCS12.toPkcs12Asn1(null, _data.certificate, null, {
- useMac: false,
- generateLocalKeyId: false
- });
- var p12Der = ASN1.toDer(p12Asn).getBytes();
-
- /* The generated PKCS#12 file lacks a MAC, therefore pass -nomacver to
- OpenSSL: openssl pkcs12 -nomacver -nodes -in pkcs12_certonly.p12 */
- ASSERT.equal(p12Der, UTIL.decode64(_data.p12certonly));
- });
-
- it('should create key-only p12', function() {
- var privateKey = PKI.privateKeyFromPem(_data.privateKey);
- var p12Asn = PKCS12.toPkcs12Asn1(privateKey, null, null, {
- useMac: false,
- generateLocalKeyId: false
- });
- var p12Der = ASN1.toDer(p12Asn).getBytes();
-
- /* The generated PKCS#12 file lacks a MAC, therefore pass -nomacver to
- OpenSSL: openssl pkcs12 -nomacver -nodes -in pkcs12_keyonly.p12 */
- ASSERT.equal(p12Der, UTIL.decode64(_data.p12keyonly));
- });
-
- it('should create encrypted-key-only p12', function() {
- /* Note we need to mock the PRNG, since the PKCS#12 file uses encryption
- which otherwise would differ each time due to the randomized IV. */
- var oldRandomGenerate = forge.random.generate;
- forge.random.generate = function(num) {
- return UTIL.createBuffer().fillWithByte(0, num).getBytes();
- };
-
- var privateKey = PKI.privateKeyFromPem(_data.privateKey);
- var p12Asn = PKCS12.toPkcs12Asn1(privateKey, null, 'nopass', {
- useMac: false,
- generateLocalKeyId: false
- });
- var p12Der = ASN1.toDer(p12Asn).getBytes();
-
- // restore old random function
- forge.random.generate = oldRandomGenerate;
-
- /* The generated PKCS#12 file lacks a MAC, therefore pass -nomacver to
- OpenSSL: openssl pkcs12 -nomacver -in pkcs12_enckeyonly.p12 */
- ASSERT.equal(p12Der, UTIL.decode64(_data.p12enckeyonly));
- });
-
- it('should import certificate-only p12', function() {
- var p12Der = UTIL.decode64(_data.p12certonly);
- var p12Asn1 = ASN1.fromDer(p12Der);
- var p12 = PKCS12.pkcs12FromAsn1(p12Asn1);
- ASSERT.equal(p12.version, 3);
-
- // PKCS#12 PFX has exactly one SafeContents; it is not encrypted
- ASSERT.equal(p12.safeContents.length, 1);
- ASSERT.equal(p12.safeContents[0].encrypted, false);
-
- // SafeContents has one SafeBag which has one CertBag with the cert
- ASSERT.equal(p12.safeContents[0].safeBags.length, 1);
- ASSERT.equal(p12.safeContents[0].safeBags[0].type, PKI.oids.certBag);
-
- // check cert's serial number
- ASSERT.equal(
- p12.safeContents[0].safeBags[0].cert.serialNumber,
- '00d4541c40d835e2f3');
- });
-
- it('should import key-only p12', function() {
- var p12Der = UTIL.decode64(_data.p12keyonly);
- var p12Asn1 = ASN1.fromDer(p12Der);
- var p12 = PKCS12.pkcs12FromAsn1(p12Asn1);
- ASSERT.equal(p12.version, 3);
-
- // PKCS#12 PFX has exactly one SafeContents; it is not encrypted
- ASSERT.equal(p12.safeContents.length, 1);
- ASSERT.equal(p12.safeContents[0].encrypted, false);
-
- // SafeContents has one SafeBag which has one KeyBag with the key
- ASSERT.equal(p12.safeContents[0].safeBags.length, 1);
- ASSERT.equal(p12.safeContents[0].safeBags[0].type, PKI.oids.keyBag);
-
- // compare the key from the PFX by comparing both primes
- var expected = PKI.privateKeyFromPem(_data.privateKey);
- ASSERT.deepEqual(p12.safeContents[0].safeBags[0].key.p, expected.p);
- ASSERT.deepEqual(p12.safeContents[0].safeBags[0].key.q, expected.q);
- });
-
- it('should import encrypted-key-only p12', function() {
- var p12Der = UTIL.decode64(_data.p12enckeyonly);
- var p12Asn1 = ASN1.fromDer(p12Der);
- var p12 = PKCS12.pkcs12FromAsn1(p12Asn1, 'nopass');
- ASSERT.equal(p12.version, 3);
-
- // PKCS#12 PFX has exactly one SafeContents; it is *not* encrypted,
- // only the key itself is encrypted (shrouded)
- ASSERT.equal(p12.safeContents.length, 1);
- ASSERT.equal(p12.safeContents[0].encrypted, false);
-
- // SafeContents has one SafeBag which has one shrouded KeyBag with the key
- ASSERT.equal(p12.safeContents[0].safeBags.length, 1);
- ASSERT.equal(
- p12.safeContents[0].safeBags[0].type, PKI.oids.pkcs8ShroudedKeyBag);
-
- // compare the key from the PFX by comparing both primes
- var expected = PKI.privateKeyFromPem(_data.privateKey);
- ASSERT.deepEqual(p12.safeContents[0].safeBags[0].key.p, expected.p);
- ASSERT.deepEqual(p12.safeContents[0].safeBags[0].key.q, expected.q);
- });
-
- it('should import an encrypted-key-only p12', function() {
- var p12Der = UTIL.decode64(_data.p12enckeyonly);
- var p12Asn1 = ASN1.fromDer(p12Der);
- var p12 = PKCS12.pkcs12FromAsn1(p12Asn1, 'nopass');
- ASSERT.equal(p12.version, 3);
-
- // PKCS#12 PFX has exactly one SafeContents; it is *not* encrypted,
- // only the key itself is encrypted (shrouded)
- ASSERT.equal(p12.safeContents.length, 1);
- ASSERT.equal(p12.safeContents[0].encrypted, false);
-
- // SafeContents has one SafeBag which has one shrouded KeyBag with the key
- ASSERT.equal(p12.safeContents[0].safeBags.length, 1);
- ASSERT.equal(
- p12.safeContents[0].safeBags[0].type, PKI.oids.pkcs8ShroudedKeyBag);
-
- // compare the key from the PFX by comparing both primes
- var expected = PKI.privateKeyFromPem(_data.privateKey);
- ASSERT.deepEqual(p12.safeContents[0].safeBags[0].key.p, expected.p);
- ASSERT.deepEqual(p12.safeContents[0].safeBags[0].key.q, expected.q);
- });
-
- it('should import an encrypted p12 with keys and certificates', function() {
- var p12Der = UTIL.decode64(_data.p12encmixed);
- var p12Asn1 = ASN1.fromDer(p12Der);
- var p12 = PKCS12.pkcs12FromAsn1(p12Asn1, '123456');
- ASSERT.equal(p12.version, 3);
-
- // PKCS#12 PFX has two SafeContents; first is *not* encrypted but
- // contains two shrouded keys, second is encrypted and has six
- // certificates
- ASSERT.equal(p12.safeContents.length, 2);
-
- ASSERT.equal(p12.safeContents[0].encrypted, false);
- ASSERT.equal(p12.safeContents[0].safeBags.length, 2);
- ASSERT.equal(p12.safeContents[0].safeBags[0].type, PKI.oids.pkcs8ShroudedKeyBag);
- ASSERT.equal(p12.safeContents[0].safeBags[0].attributes.friendlyName.length, 1);
- ASSERT.equal(p12.safeContents[0].safeBags[0].attributes.friendlyName[0], 'encryptionkey');
- ASSERT.equal(p12.safeContents[0].safeBags[0].attributes.localKeyId.length, 1);
- ASSERT.equal(p12.safeContents[0].safeBags[0].attributes.localKeyId[0], 'Time 1311855238964');
-
- ASSERT.equal(p12.safeContents[0].safeBags[1].type, PKI.oids.pkcs8ShroudedKeyBag);
- ASSERT.equal(p12.safeContents[0].safeBags[1].attributes.friendlyName.length, 1);
- ASSERT.equal(p12.safeContents[0].safeBags[1].attributes.friendlyName[0], 'signaturekey');
- ASSERT.equal(p12.safeContents[0].safeBags[1].attributes.localKeyId.length, 1);
- ASSERT.equal(p12.safeContents[0].safeBags[1].attributes.localKeyId[0], 'Time 1311855238863');
-
- ASSERT.equal(p12.safeContents[1].encrypted, true);
- ASSERT.equal(p12.safeContents[1].safeBags.length, 6);
-
- ASSERT.equal(p12.safeContents[1].safeBags[0].type, PKI.oids.certBag);
- ASSERT.equal(p12.safeContents[1].safeBags[0].attributes.friendlyName.length, 1);
- ASSERT.equal(p12.safeContents[1].safeBags[0].attributes.friendlyName[0], 'CN=1002753325,2.5.4.5=#130b3130303237353333323543');
- ASSERT.equal(p12.safeContents[1].safeBags[0].attributes.localKeyId.length, 1);
- ASSERT.equal(p12.safeContents[1].safeBags[0].attributes.localKeyId[0], 'Time 1311855238964');
-
- ASSERT.equal(p12.safeContents[1].safeBags[1].type, PKI.oids.certBag);
- ASSERT.equal(p12.safeContents[1].safeBags[1].attributes.friendlyName.length, 1);
- ASSERT.equal(p12.safeContents[1].safeBags[1].attributes.friendlyName[0], 'CN=ElsterSoftTestCA,OU=CA,O=Elster,C=DE');
-
- ASSERT.equal(p12.safeContents[1].safeBags[2].type, PKI.oids.certBag);
- ASSERT.equal(p12.safeContents[1].safeBags[2].attributes.friendlyName.length, 1);
- ASSERT.equal(p12.safeContents[1].safeBags[2].attributes.friendlyName[0], 'CN=ElsterRootCA,OU=RootCA,O=Elster,C=DE');
-
- ASSERT.equal(p12.safeContents[1].safeBags[3].type, PKI.oids.certBag);
- ASSERT.equal(p12.safeContents[1].safeBags[3].attributes.friendlyName.length, 1);
- ASSERT.equal(p12.safeContents[1].safeBags[3].attributes.friendlyName[0], 'CN=1002753325,2.5.4.5=#130b3130303237353333323541');
- ASSERT.equal(p12.safeContents[1].safeBags[3].attributes.localKeyId.length, 1);
- ASSERT.equal(p12.safeContents[1].safeBags[3].attributes.localKeyId[0], 'Time 1311855238863');
-
- ASSERT.equal(p12.safeContents[1].safeBags[4].type, PKI.oids.certBag);
- ASSERT.equal(p12.safeContents[1].safeBags[4].attributes.friendlyName.length, 1);
- ASSERT.equal(p12.safeContents[1].safeBags[4].attributes.friendlyName[0], 'CN=ElsterSoftTestCA,OU=CA,O=Elster,C=DE');
-
- ASSERT.equal(p12.safeContents[1].safeBags[5].type, PKI.oids.certBag);
- ASSERT.equal(p12.safeContents[1].safeBags[5].attributes.friendlyName.length, 1);
- ASSERT.equal(p12.safeContents[1].safeBags[5].attributes.friendlyName[0], 'CN=ElsterRootCA,OU=RootCA,O=Elster,C=DE');
- });
-
- it('should get bags by friendly name', function() {
- var p12Der = UTIL.decode64(_data.p12encmixed);
- var p12Asn1 = ASN1.fromDer(p12Der);
- var p12 = PKCS12.pkcs12FromAsn1(p12Asn1, '123456');
- var bags = p12.getBags({friendlyName: 'signaturekey'});
-
- ASSERT.equal(bags.friendlyName.length, 1);
- ASSERT.equal(bags.friendlyName[0].attributes.friendlyName[0], 'signaturekey');
- });
-
- it('should get cert bags by friendly name', function() {
- var p12Der = UTIL.decode64(_data.p12encmixed);
- var p12Asn1 = ASN1.fromDer(p12Der);
- var p12 = PKCS12.pkcs12FromAsn1(p12Asn1, '123456');
- var bags = p12.getBags({
- friendlyName: 'CN=1002753325,2.5.4.5=#130b3130303237353333323543',
- bagType: PKI.oids.certBag
- });
-
- ASSERT.equal(bags.friendlyName.length, 1);
- ASSERT.equal(bags.friendlyName[0].attributes.friendlyName[0], 'CN=1002753325,2.5.4.5=#130b3130303237353333323543');
- });
-
- it('should get all cert bags', function() {
- var p12Der = UTIL.decode64(_data.p12encmixed);
- var p12Asn1 = ASN1.fromDer(p12Der);
- var p12 = PKCS12.pkcs12FromAsn1(p12Asn1, '123456');
- var bags = p12.getBags({
- bagType: PKI.oids.certBag
- });
-
- ASSERT.equal(bags[PKI.oids.certBag].length, 6);
- for(var i = 0; i < bags[PKI.oids.certBag].length; ++i) {
- ASSERT.equal(bags[PKI.oids.certBag][i].type, PKI.oids.certBag);
- }
- });
-
- it('should get bags by local key ID', function() {
- var p12Der = UTIL.decode64(_data.p12encmixed);
- var p12Asn1 = ASN1.fromDer(p12Der);
- var p12 = PKCS12.pkcs12FromAsn1(p12Asn1, '123456');
- var bags = p12.getBags({localKeyId: 'Time 1311855238863'});
-
- ASSERT.equal(bags.localKeyId.length, 2);
- ASSERT.equal(bags.localKeyId[0].attributes.localKeyId[0], 'Time 1311855238863');
- ASSERT.equal(bags.localKeyId[1].attributes.localKeyId[0], 'Time 1311855238863');
- });
-
- it('should get cert bags by local key ID', function() {
- var p12Der = UTIL.decode64(_data.p12encmixed);
- var p12Asn1 = ASN1.fromDer(p12Der);
- var p12 = PKCS12.pkcs12FromAsn1(p12Asn1, '123456');
- var bags = p12.getBags({
- localKeyId: 'Time 1311855238863',
- bagType: PKI.oids.certBag
- });
-
- ASSERT.equal(bags.localKeyId.length, 1);
- ASSERT.equal(bags.localKeyId[0].attributes.localKeyId[0], 'Time 1311855238863');
- ASSERT.equal(bags.localKeyId[0].type, PKI.oids.certBag);
- });
-
- it('should generate a PKCS#12 mac key', function() {
- var salt = 'A15D6AA8F8DAFC352F9EE1C192F09966EB85D17B';
- salt = UTIL.createBuffer(UTIL.hexToBytes(salt));
- var expected = '03e46727268575c6ebd6bff828d0d09b0c914201263ca543';
- var key = PKCS12.generateKey('123456', salt, 1, 1024, 24);
- ASSERT.equal(key.toHex(), expected);
- });
-
- it('should load a PKCS#12 with an ECDSA key in a certificate (unsupported key format)', function() {
- var p12Der = UTIL.decode64(_data.p12ecdsa);
- var p12Asn1 = ASN1.fromDer(p12Der);
- var p12 = PKCS12.pkcs12FromAsn1(p12Asn1, '123321');
- var bags = p12.getBags({bagType: PKI.oids.certBag});
-
- ASSERT.equal(bags[PKI.oids.certBag].length, 1);
- var bag = bags[PKI.oids.certBag][0];
- ASSERT.equal(bag.cert, null);
- ASSERT.equal('asn1' in bag, true);
-
- // convert to ASN.1, then DER, then PEM-encode
- var msg = {
- type: 'CERTIFICATE',
- body: ASN1.toDer(bag.asn1).getBytes()
- };
- var pem = PEM.encode(msg);
- ASSERT.equal(pem, _data.p12ecdsaCert);
- });
- });
-
- _data = {
- certificate: '-----BEGIN CERTIFICATE-----\r\n' +
- 'MIIDtDCCApwCCQDUVBxA2DXi8zANBgkqhkiG9w0BAQUFADCBmzELMAkGA1UEBhMC\r\n' +
- 'REUxEjAQBgNVBAgMCUZyYW5jb25pYTEQMA4GA1UEBwwHQW5zYmFjaDEVMBMGA1UE\r\n' +
- 'CgwMU3RlZmFuIFNpZWdsMRIwEAYDVQQLDAlHZWllcmxlaW4xFjAUBgNVBAMMDUdl\r\n' +
- 'aWVybGVpbiBERVYxIzAhBgkqhkiG9w0BCQEWFHN0ZXNpZUBicm9rZW5waXBlLmRl\r\n' +
- 'MB4XDTEyMDMxODIyNTc0M1oXDTEzMDMxODIyNTc0M1owgZsxCzAJBgNVBAYTAkRF\r\n' +
- 'MRIwEAYDVQQIDAlGcmFuY29uaWExEDAOBgNVBAcMB0Fuc2JhY2gxFTATBgNVBAoM\r\n' +
- 'DFN0ZWZhbiBTaWVnbDESMBAGA1UECwwJR2VpZXJsZWluMRYwFAYDVQQDDA1HZWll\r\n' +
- 'cmxlaW4gREVWMSMwIQYJKoZIhvcNAQkBFhRzdGVzaWVAYnJva2VucGlwZS5kZTCC\r\n' +
- 'ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMsAbQ4fWevHqP1K1y/ewpMS\r\n' +
- '3vYovBto7IsKBq0v3NmC2kPf3NhyaSKfjOOS5uAPONLffLck+iGdOLLFia6OSpM6\r\n' +
- '0tyQIV9lHoRh7fOEYORab0Z+aBUZcEGT9yotBOraX1YbKc5f9XO+80eG4XYvb5ua\r\n' +
- '1NHrxWqe4w2p3zGJCKO+wHpvGkbKz0nfu36jwWz5aihfHi9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'MAoGA1UEBwwDSWxlMQ0wCwYDVQQKDARlcmRmMSIwIAYDVQQDDBluaXphci5hYmRl\r\n' +
- 'bm5lYmlAZ21haWwuY29tMSgwJgYJKoZIhvcNAQkBFhluaXphci5hYmRlbm5lYmlA\r\n' +
- 'Z21haWwuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAELqy3xekJMWlXzq5g\r\n' +
- '5ao7Z8PH3iL0I2Tj28SGrDIdZ07f5x/rAbwjbcfp2YsJecEJOoaE3/jgbI8/mc1p\r\n' +
- 'wWJtm6NQME4wHQYDVR0OBBYEFINzYXPWdpiaoDaLBiObKSezqjYSMB8GA1UdIwQY\r\n' +
- 'MBaAFINzYXPWdpiaoDaLBiObKSezqjYSMAwGA1UdEwQFMAMBAf8wCQYHKoZIzj0E\r\n' +
- 'AQNIADBFAiEA9Q+TJyUHEn7lhjEkF1OUb0hEwejAWny+mvqQ0XNHup4CIAeOLjEs\r\n' +
- 'mthwYiI/c1op4Y+H0xLUp2v8iLWHIDqAZA89\r\n' +
- '-----END CERTIFICATE-----\r\n'
- };
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/forge'
- ], function(FORGE) {
- Tests(
- // Global provided by test harness
- ASSERT,
- FORGE
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/forge'));
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/pkcs7.js b/school/node_modules/node-forge/nodejs/test/pkcs7.js
deleted file mode 100644
index 2c4e793..0000000
--- a/school/node_modules/node-forge/nodejs/test/pkcs7.js
+++ /dev/null
@@ -1,350 +0,0 @@
-(function() {
-
-function Tests(ASSERT, PKCS7, PKI, AES, DES, UTIL) {
- var _pem = {
- p7: '-----BEGIN PKCS7-----\r\n' +
- 'MIICTgYJKoZIhvcNAQcDoIICPzCCAjsCAQAxggHGMIIBwgIBADCBqTCBmzELMAkG\r\n' +
- 'A1UEBhMCREUxEjAQBg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VMY/ddquJ5O3N\r\n' +
- 'rDEqqJuHB+KPIsW1kxrdplU=\r\n' +
- '-----END PKCS7-----\r\n'
- };
-
- describe('pkcs7', function() {
- it('should import message from PEM', function() {
- var p7 = PKCS7.messageFromPem(_pem.p7);
-
- ASSERT.equal(p7.type, PKI.oids.envelopedData);
- ASSERT.equal(p7.version, 0);
-
- ASSERT.equal(p7.recipients.length, 1);
- ASSERT.equal(p7.recipients[0].version, 0);
- ASSERT.equal(p7.recipients[0].serialNumber, '00d4541c40d835e2f3');
-
- // Test converted RDN, which is constructed of seven parts.
- ASSERT.equal(p7.recipients[0].issuer.length, 7);
- ASSERT.equal(p7.recipients[0].issuer[0].type, '2.5.4.6');
- ASSERT.equal(p7.recipients[0].issuer[0].value, 'DE');
- ASSERT.equal(p7.recipients[0].issuer[1].type, '2.5.4.8');
- ASSERT.equal(p7.recipients[0].issuer[1].value, 'Franconia');
- ASSERT.equal(p7.recipients[0].issuer[2].type, '2.5.4.7');
- ASSERT.equal(p7.recipients[0].issuer[2].value, 'Ansbach');
- ASSERT.equal(p7.recipients[0].issuer[3].type, '2.5.4.10');
- ASSERT.equal(p7.recipients[0].issuer[3].value, 'Stefan Siegl');
- ASSERT.equal(p7.recipients[0].issuer[4].type, '2.5.4.11');
- ASSERT.equal(p7.recipients[0].issuer[4].value, 'Geierlein');
- ASSERT.equal(p7.recipients[0].issuer[5].type, '2.5.4.3');
- ASSERT.equal(p7.recipients[0].issuer[5].value, 'Geierlein DEV');
- ASSERT.equal(p7.recipients[0].issuer[6].type, '1.2.840.113549.1.9.1');
- ASSERT.equal(p7.recipients[0].issuer[6].value, 'stesie@brokenpipe.de');
-
- ASSERT.equal(p7.recipients[0].encryptedContent.algorithm, PKI.oids.rsaEncryption);
- ASSERT.equal(p7.recipients[0].encryptedContent.content.length, 256);
-
- ASSERT.equal(p7.encryptedContent.algorithm, PKI.oids['aes256-CBC']);
- ASSERT.equal(p7.encryptedContent.parameter.data.length, 16); // IV
- });
-
- it('should import indefinite length message from PEM', function() {
- ASSERT.doesNotThrow(function() {
- var p7 = PKCS7.messageFromPem(_pem.p7IndefiniteLength);
- ASSERT.equal(p7.type, PKI.oids.envelopedData);
- ASSERT.equal(p7.encryptedContent.parameter.toHex(), '536da6a06653733d');
- ASSERT.equal(p7.encryptedContent.content.length(), 80);
- });
- });
-
- it('should find recipient by serial number', function() {
- var p7 = PKCS7.messageFromPem(_pem.p7);
- var cert = PKI.certificateFromPem(_pem.certificate);
-
- var ri = p7.findRecipient(cert);
- ASSERT.equal(ri.serialNumber, '00d4541c40d835e2f3');
-
- // modify certificate so it doesn't match recipient any more
- cert.serialNumber = '1234567890abcdef42';
- ri = p7.findRecipient(cert);
- ASSERT.equal(ri, null);
- });
-
- it('should aes-decrypt message', function() {
- var p7 = PKCS7.messageFromPem(_pem.p7);
- var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
- p7.decrypt(p7.recipients[0], privateKey);
-
- // symmetric key must be 32 bytes long (AES 256 key)
- ASSERT.equal(p7.encryptedContent.key.data.length, 32);
- ASSERT.equal(
- p7.content,
- 'Today is Boomtime, the 9th day of Discord in the YOLD 3178\r\n');
- });
-
- it('should 3des-decrypt message', function() {
- var p7 = PKCS7.messageFromPem(_pem.p73des);
- var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
- p7.decrypt(p7.recipients[0], privateKey);
-
- // symmetric key must be 24 bytes long (DES3 key)
- ASSERT.equal(p7.encryptedContent.key.data.length, 24);
- ASSERT.equal(
- p7.content,
- 'Today is Prickle-Prickle, ' +
- 'the 16th day of Discord in the YOLD 3178\r\n');
- });
-
- it('should add a recipient', function() {
- var p7 = PKCS7.createEnvelopedData();
-
- // initially there should be no recipients
- ASSERT.equal(p7.recipients.length, 0);
-
- var cert = PKI.certificateFromPem(_pem.certificate);
- p7.addRecipient(cert);
-
- ASSERT.equal(p7.recipients.length, 1);
- ASSERT.deepEqual(p7.recipients[0].serialNumber, cert.serialNumber);
- ASSERT.deepEqual(p7.recipients[0].issuer, cert.subject.attributes);
- ASSERT.deepEqual(p7.recipients[0].encryptedContent.key, cert.publicKey);
- });
-
- it('should aes-encrypt a message', function() {
- var p7 = PKCS7.createEnvelopedData();
- var cert = PKI.certificateFromPem(_pem.certificate);
- var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
-
- p7.addRecipient(cert);
- p7.content = UTIL.createBuffer('Just a little test');
-
- // pre-condition, PKCS#7 module should default to AES-256-CBC
- ASSERT.equal(p7.encryptedContent.algorithm, PKI.oids['aes256-CBC']);
- p7.encrypt();
-
- // since we did not provide a key, a random key should have been created
- // automatically, AES256 requires 32 bytes of key material
- ASSERT.equal(p7.encryptedContent.key.data.length, 32);
-
- // furthermore an IV must be generated, AES256 has 16 byte IV
- ASSERT.equal(p7.encryptedContent.parameter.data.length, 16);
-
- // content is 18 bytes long, AES has 16 byte blocksize,
- // with padding that makes 32 bytes
- ASSERT.equal(p7.encryptedContent.content.data.length, 32);
-
- // RSA encryption should yield 256 bytes
- ASSERT.equal(p7.recipients[0].encryptedContent.content.length, 256);
-
- // rewind Key & IV
- p7.encryptedContent.key.read = 0;
- p7.encryptedContent.parameter.read = 0;
-
- // decryption of the asym. encrypted data should reveal the symmetric key
- var decryptedKey = privateKey.decrypt(
- p7.recipients[0].encryptedContent.content);
- ASSERT.equal(decryptedKey, p7.encryptedContent.key.data);
-
- // decryption of sym. encrypted data should reveal the content
- var ciph = AES.createDecryptionCipher(decryptedKey);
- ciph.start(p7.encryptedContent.parameter);
- ciph.update(p7.encryptedContent.content);
- ciph.finish();
- ASSERT.equal(ciph.output, 'Just a little test');
- });
-
- it('should 3des-ede-encrypt a message', function() {
- var p7 = PKCS7.createEnvelopedData();
- var cert = PKI.certificateFromPem(_pem.certificate);
- var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
-
- p7.addRecipient(cert);
- p7.content = UTIL.createBuffer('Just a little test');
- p7.encryptedContent.algorithm = PKI.oids['des-EDE3-CBC'];
- p7.encrypt();
-
- // since we did not provide a key, a random key should have been created
- // automatically, 3DES-EDE requires 24 bytes of key material
- ASSERT.equal(p7.encryptedContent.key.data.length, 24);
-
- // furthermore an IV must be generated, DES3 has 8 byte IV
- ASSERT.equal(p7.encryptedContent.parameter.data.length, 8);
-
- // content is 18 bytes long, DES has 8 byte blocksize,
- // with padding that makes 24 bytes
- ASSERT.equal(p7.encryptedContent.content.data.length, 24);
-
- // RSA encryption should yield 256 bytes
- ASSERT.equal(p7.recipients[0].encryptedContent.content.length, 256);
-
- // rewind Key & IV
- p7.encryptedContent.key.read = 0;
- p7.encryptedContent.parameter.read = 0;
-
- // decryption of the asym. encrypted data should reveal the symmetric key
- var decryptedKey = privateKey.decrypt(
- p7.recipients[0].encryptedContent.content);
- ASSERT.equal(decryptedKey, p7.encryptedContent.key.data);
-
- // decryption of sym. encrypted data should reveal the content
- var ciph = DES.createDecryptionCipher(decryptedKey);
- ciph.start(p7.encryptedContent.parameter);
- ciph.update(p7.encryptedContent.content);
- ciph.finish();
- ASSERT.equal(ciph.output, 'Just a little test');
- });
-
- it('should export message to PEM', function() {
- var p7 = PKCS7.createEnvelopedData();
- p7.addRecipient(PKI.certificateFromPem(_pem.certificate));
- p7.content = UTIL.createBuffer('Just a little test');
- p7.encrypt();
-
- var pem = PKCS7.messageToPem(p7);
-
- // convert back from PEM to new PKCS#7 object, decrypt, and test
- p7 = PKCS7.messageFromPem(pem);
- p7.decrypt(p7.recipients[0], PKI.privateKeyFromPem(_pem.privateKey));
- ASSERT.equal(p7.content, 'Just a little test');
- });
-
- it('should decrypt encrypted data from PEM', function() {
- var result = '1f8b08000000000000000b2e494d4bcc5308ce4c4dcfd15130b0b430d4b7343732b03437d05170cc2b4e4a4cced051b034343532d25170492d2d294ecec849cc4b0100bf52f02437000000';
- var key = 'b96e4a4c0a3555d31e1b295647cc5cfe74081918cb7f797b';
- key = UTIL.createBuffer(UTIL.hexToBytes(key));
-
- ASSERT.doesNotThrow(function() {
- var p7 = PKCS7.messageFromPem(_pem.encryptedData);
- ASSERT.equal(p7.type, PKI.oids.encryptedData);
- ASSERT.equal(p7.encryptedContent.algorithm, PKI.oids['des-EDE3-CBC']);
- ASSERT.equal(p7.encryptedContent.parameter.toHex(), 'ba9305a2ee57dc35');
- ASSERT.equal(p7.encryptedContent.content.length(), 80);
-
- p7.decrypt(key);
- ASSERT.equal(p7.content.toHex(), result);
- });
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/pkcs7',
- 'forge/pki',
- 'forge/aes',
- 'forge/des',
- 'forge/util'
- ], function(PKCS7, PKI, AES, DES, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- PKCS7(),
- PKI(),
- AES(),
- DES(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/pkcs7')(),
- require('../../js/pki')(),
- require('../../js/aes')(),
- require('../../js/des')(),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/random.js b/school/node_modules/node-forge/nodejs/test/random.js
deleted file mode 100644
index efeec2b..0000000
--- a/school/node_modules/node-forge/nodejs/test/random.js
+++ /dev/null
@@ -1,70 +0,0 @@
-(function() {
-
-function Tests(ASSERT, RANDOM, UTIL) {
- var random = RANDOM();
-
- describe('random', function() {
- it('should generate 10 random bytes', function() {
- random.getBytes(16);
- random.getBytes(24);
- random.getBytes(32);
-
- var b = random.getBytes(10);
- ASSERT.equal(b.length, 10);
- });
-
- it('should use a synchronous seed file', function() {
- var rand = RANDOM();
- rand.seedFileSync = function(needed) {
- return UTIL.fillString('a', needed);
- };
- var b = rand.getBytes(10);
- ASSERT.equal(UTIL.bytesToHex(b), '80a7901a239c3e606319');
- });
-
- it('should use an asynchronous seed file', function(done) {
- var rand = RANDOM();
- rand.seedFile = function(needed, callback) {
- callback(null, UTIL.fillString('a', needed));
- };
- rand.getBytes(10, function(err, b) {
- ASSERT.equal(err, null);
- ASSERT.equal(UTIL.bytesToHex(b), '80a7901a239c3e606319');
- done();
- });
- });
-
- it('should collect some random bytes', function() {
- var rand = RANDOM();
- rand.seedFileSync = function(needed) {
- return UTIL.fillString('a', needed);
- };
- rand.collect('bbb');
- var b = rand.getBytes(10);
- ASSERT.equal(UTIL.bytesToHex(b), 'ff8d213516047c94ca46');
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/random',
- 'forge/util'
- ], function(RANDOM, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- RANDOM,
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/random'),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/rc2.js b/school/node_modules/node-forge/nodejs/test/rc2.js
deleted file mode 100644
index 2acbe7b..0000000
--- a/school/node_modules/node-forge/nodejs/test/rc2.js
+++ /dev/null
@@ -1,109 +0,0 @@
-(function() {
-
-function Tests(ASSERT, RC2, UTIL) {
- describe('rc2', function() {
- it('should expand a 128-bit key', function() {
- var key = UTIL.hexToBytes('88bca90e90875a7f0f79c384627bafb2');
- var expect = '71ab26462f0b9333609d4476e48ab72438c2194b70a47085d84b6af1dc72119023b94fe80aee2b6b45f27f923d9be1570da3ce8b16ad7f78db166ffbc28a836a4392cf0b748085dae4b69bdc2a4679cdfc09d84317016987e0c5b765c91dc612b1f44d7921b3e2c46447508bd2ac02e119e0f42a89c719675da320cf3e8958cd';
- ASSERT.equal(RC2.expandKey(key).toHex(), expect);
- });
-
- it('should expand a 40-bit key', function() {
- var key = UTIL.hexToBytes('88bca90e90');
- var expect = 'af136d2243b94a0878d7a604f8d6d9fd64a698fd6ebc613e641f0d1612055ef6cb55966db8f32bfd9246dae99880be8a91433adf54ea546d9daad62db7a55f6c7790aa87ba67de0e9ea9128dfc7ccdddd7c47c33d2bb7f823729977f083b5dc1f5bb09000b98e12cdaaf22f80dcc88c37d2c2fd80402f8a30a9e41d356669471';
- ASSERT.equal(RC2.expandKey(key, 40).toHex(), expect);
- });
-
- it('should rc2-ecb encrypt zeros', function() {
- var key = UTIL.hexToBytes('88bca90e90875a7f0f79c384627bafb2');
- var input = new UTIL.createBuffer().fillWithByte(0, 8);
- var cipher = RC2.startEncrypting(key, null, null);
- cipher.update(input);
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), '2269552ab0f85ca6e35b3b2ce4e02191');
- });
-
- it('should rc2-ecb encrypt: vegan', function() {
- var key = UTIL.hexToBytes('88bca90e90875a7f0f79c384627bafb2');
- var input = new UTIL.createBuffer('vegan');
- var cipher = RC2.startEncrypting(key, null, null);
- cipher.update(input);
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), '2194adaf4d517e3a');
- });
-
- it('should rc2-ecb decrypt: 2194adaf4d517e3a', function() {
- var key = UTIL.hexToBytes('88bca90e90875a7f0f79c384627bafb2');
- var input = new UTIL.createBuffer(UTIL.hexToBytes('2194adaf4d517e3a'));
- var cipher = RC2.startDecrypting(key, null, null);
- cipher.update(input);
- cipher.finish();
- ASSERT.equal(cipher.output.getBytes(), 'vegan');
- });
-
- it('should rc2-cbc encrypt: revolution', function() {
- var key = UTIL.hexToBytes('88bca90e90875a7f0f79c384627bafb2');
- var iv = new UTIL.createBuffer(UTIL.hexToBytes('0123456789abcdef'));
- var input = new UTIL.createBuffer('revolution');
- var cipher = RC2.startEncrypting(key, iv, null);
- cipher.update(input);
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), '50cfd16e0fd7f20b17a622eb2a469b7e');
- });
-
- it('should rc2-cbc decrypt: 50cfd16e0fd7f20b17a622eb2a469b7e', function() {
- var key = UTIL.hexToBytes('88bca90e90875a7f0f79c384627bafb2');
- var iv = new UTIL.createBuffer(UTIL.hexToBytes('0123456789abcdef'));
- var input = new UTIL.createBuffer(
- UTIL.hexToBytes('50cfd16e0fd7f20b17a622eb2a469b7e'));
- var cipher = RC2.startDecrypting(key, iv, null);
- cipher.update(input);
- cipher.finish();
- ASSERT.equal(cipher.output, 'revolution');
- });
-
- it('should rc2-cbc encrypt w/binary string iv: revolution', function() {
- var key = UTIL.hexToBytes('88bca90e90875a7f0f79c384627bafb2');
- var iv = UTIL.hexToBytes('0123456789abcdef');
- var input = new UTIL.createBuffer('revolution');
- var cipher = RC2.startEncrypting(key, iv, null);
- cipher.update(input);
- cipher.finish();
- ASSERT.equal(cipher.output.toHex(), '50cfd16e0fd7f20b17a622eb2a469b7e');
- });
-
- it('should rc2-cbc decrypt w/binary string iv: 50cfd16e0fd7f20b17a622eb2a469b7e', function() {
- var key = UTIL.hexToBytes('88bca90e90875a7f0f79c384627bafb2');
- var iv = UTIL.hexToBytes('0123456789abcdef');
- var input = new UTIL.createBuffer(
- UTIL.hexToBytes('50cfd16e0fd7f20b17a622eb2a469b7e'));
- var cipher = RC2.startDecrypting(key, iv, null);
- cipher.update(input);
- cipher.finish();
- ASSERT.equal(cipher.output, 'revolution');
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/rc2',
- 'forge/util'
- ], function(RC2, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- RC2(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/rc2')(),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/rsa.js b/school/node_modules/node-forge/nodejs/test/rsa.js
deleted file mode 100644
index 434d7a3..0000000
--- a/school/node_modules/node-forge/nodejs/test/rsa.js
+++ /dev/null
@@ -1,602 +0,0 @@
-(function() {
-
-function Tests(ASSERT, PKI, RSA, MD, MGF, PSS, RANDOM, UTIL) {
- var _pem = {
- privateKey: '-----BEGIN RSA PRIVATE KEY-----\r\n' +
- 'MIICXQIBAAKBgQDL0EugUiNGMWscLAVM0VoMdhDZEJOqdsUMpx9U0YZI7szokJqQ\r\n' +
- 'NIwokiQ6EonNnWSMlIvy46AhnlRYn+ezeTeU7eMGTkP3VF29vXBo+dLq5e+8VyAy\r\n' +
- 'Q3FzM1wI4ts4hRACF8w6mqygXQ7i/SDu8/rXqRGtvnM+z0MYDdKo80efzwIDAQAB\r\n' +
- 'AoGAIzkGONi5G+JifmXlLJdplom486p3upf4Ce2/7mqfaG9MnkyPSairKD/JXvfh\r\n' +
- 'NNWkkN8DKKDKBcVVElPgORYT0qwrWc7ueLBMUCbRXb1ZyfEulimG0R3kjUh7NYau\r\n' +
- 'DaIkVgfykXGSQMZx8FoaT6L080zd+0emKDDYRrb+/kgJNJECQQDoUZoiC2K/DWNY\r\n' +
- 'h3/ppZ0ane2y4SBmJUHJVMPQ2CEgxsrJTxet668ckNCKaOP/3VFPoWC41f17DvKq\r\n' +
- 'noYINNntAkEA4JbZBZBVUrQFhHlrpXT4jzqtO2RlKZzEq8qmFZfEErxOT1WMyyCi\r\n' +
- 'lAQ5gUKardo1Kf0omC8Xq/uO9ZYdED55KwJBALs6cJ65UFaq4oLJiQPzLd7yokuE\r\n' +
- 'dcj8g71PLBTW6jPxIiMFNA89nz3FU9wIVp+xbMNhSoMMKqIPVPC+m0Rn260CQQDA\r\n' +
- 'I83fWK/mZWUjBM33a68KumRiH238v8XyQxj7+C8i6D8G2GXvkigFAehAkb7LZZd+\r\n' +
- 'KLuGFyPlWv3fVWHf99KpAkBQFKk3MRMl6IGJZUEFQe4l5whm8LkGU4acSqv9B3xt\r\n' +
- 'qROkCrsFrMPqjuuzEmyHoQZ64r2PLJg7FOuyhBnQUOt4\r\n' +
- '-----END RSA PRIVATE KEY-----\r\n',
- privateKeyInfo: '-----BEGIN PRIVATE KEY-----\r\n' +
- 'MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMvQS6BSI0Yxaxws\r\n' +
- 'BUzRWgx2ENkQk6p2xQynH1TRhkjuzOiQmpA0jCiSJDoSic2dZIyUi/LjoCGeVFif\r\n' +
- '57N5N5Tt4wZOQ/dUXb29cGj50url77xXIDJDcXMzXAji2ziFEAIXzDqarK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'vnM+z0MYDdKo80efzwIDAQAB\r\n' +
- '-----END PUBLIC KEY-----\r\n'
- };
- var _signature =
- '9200ece65cdaed36bcc20b94c65af852e4f88f0b4fe5b249d54665f815992ac4' +
- '3a1399e65d938c6a7f16dd39d971a53ca66523209dbbfbcb67afa579dbb0c220' +
- '672813d9e6f4818f29b9becbb29da2032c5e422da97e0c39bfb7a2e7d568615a' +
- '5073af0337ff215a8e1b2332d668691f4fb731440055420c24ac451dd3c913f4';
-
- describe('rsa', function() {
- it('should generate 512 bit key pair', function() {
- var pair = RSA.generateKeyPair(512);
- ASSERT.equal(PKI.privateKeyToPem(pair.privateKey).indexOf('-----BEGIN RSA PRIVATE KEY-----'), 0);
- ASSERT.equal(PKI.publicKeyToPem(pair.publicKey).indexOf('-----BEGIN PUBLIC KEY-----'), 0);
-
- // sign and verify
- var md = MD.sha1.create();
- md.update('0123456789abcdef');
- var signature = pair.privateKey.sign(md);
- ASSERT.ok(pair.publicKey.verify(md.digest().getBytes(), signature));
- });
-
- it('should generate the same 512 bit key pair', function() {
- var prng = RANDOM.createInstance();
- prng.seedFileSync = function(needed) {
- return UTIL.fillString('a', needed);
- };
- var pair = RSA.generateKeyPair(512, {prng: prng});
- var pem = {
- privateKey: PKI.privateKeyToPem(pair.privateKey),
- publicKey: PKI.publicKeyToPem(pair.publicKey)
- };
- ASSERT.equal(pem.privateKey.indexOf('-----BEGIN RSA PRIVATE KEY-----'), 0);
- ASSERT.equal(pem.publicKey.indexOf('-----BEGIN PUBLIC KEY-----'), 0);
-
- // sign and verify
- var md = MD.sha1.create();
- md.update('0123456789abcdef');
- var signature = pair.privateKey.sign(md);
- ASSERT.ok(pair.publicKey.verify(md.digest().getBytes(), signature));
-
- // create same key pair by using same PRNG
- prng = RANDOM.createInstance();
- prng.seedFileSync = function(needed) {
- return UTIL.fillString('a', needed);
- };
- var pair2 = RSA.generateKeyPair(512, {prng: prng});
- var pem2 = {
- privateKey: PKI.privateKeyToPem(pair2.privateKey),
- publicKey: PKI.publicKeyToPem(pair2.publicKey)
- };
- ASSERT.equal(pem.privateKey, pem2.privateKey);
- ASSERT.equal(pem.publicKey, pem2.publicKey);
- });
-
- it('should convert private key to/from PEM', function() {
- var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
- ASSERT.equal(PKI.privateKeyToPem(privateKey), _pem.privateKey);
- });
-
- it('should convert public key to/from PEM', function() {
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- ASSERT.equal(PKI.publicKeyToPem(publicKey), _pem.publicKey);
- });
-
- it('should convert a PKCS#8 PrivateKeyInfo to/from PEM', function() {
- var privateKey = PKI.privateKeyFromPem(_pem.privateKeyInfo);
- var rsaPrivateKey = PKI.privateKeyToAsn1(privateKey);
- var pki = PKI.wrapRsaPrivateKey(rsaPrivateKey);
- ASSERT.equal(PKI.privateKeyInfoToPem(pki), _pem.privateKeyInfo);
- });
-
- (function() {
- var algorithms = ['aes128', 'aes192', 'aes256', '3des', 'des'];
- for(var i = 0; i < algorithms.length; ++i) {
- var algorithm = algorithms[i];
- it('should PKCS#8 encrypt and decrypt private key with ' + algorithm, function() {
- var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
- var encryptedPem = PKI.encryptRsaPrivateKey(
- privateKey, 'password', {algorithm: algorithm});
- privateKey = PKI.decryptRsaPrivateKey(encryptedPem, 'password');
- ASSERT.equal(PKI.privateKeyToPem(privateKey), _pem.privateKey);
- });
- }
- })();
-
- (function() {
- var algorithms = ['aes128', 'aes192', 'aes256', '3des', 'des'];
- for(var i = 0; i < algorithms.length; ++i) {
- var algorithm = algorithms[i];
- it('should legacy (OpenSSL style) encrypt and decrypt private key with ' + algorithm, function() {
- var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
- var encryptedPem = PKI.encryptRsaPrivateKey(
- privateKey, 'password', {algorithm: algorithm, legacy: true});
- privateKey = PKI.decryptRsaPrivateKey(encryptedPem, 'password');
- ASSERT.equal(PKI.privateKeyToPem(privateKey), _pem.privateKey);
- });
- }
- })();
-
- it('should verify signature', function() {
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var md = MD.sha1.create();
- md.update('0123456789abcdef');
- var signature = UTIL.hexToBytes(_signature);
- ASSERT.ok(publicKey.verify(md.digest().getBytes(), signature));
- });
-
- it('should sign and verify', function() {
- var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var md = MD.sha1.create();
- md.update('0123456789abcdef');
- var signature = privateKey.sign(md);
- ASSERT.ok(publicKey.verify(md.digest().getBytes(), signature));
- });
-
- it('should generate missing CRT parameters, sign, and verify', function() {
- var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
-
- // remove dQ, dP, and qInv
- privateKey = RSA.setPrivateKey(
- privateKey.n, privateKey.e, privateKey.d,
- privateKey.p, privateKey.q);
-
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var md = MD.sha1.create();
- md.update('0123456789abcdef');
- var signature = privateKey.sign(md);
- ASSERT.ok(publicKey.verify(md.digest().getBytes(), signature));
- });
-
- it('should sign and verify with a private key containing only e, n, and d parameters', function() {
- var privateKey = PKI.privateKeyFromPem(_pem.privateKey);
-
- // remove all CRT parameters from private key, so that it consists
- // only of e, n and d (which make a perfectly valid private key, but its
- // operations are slower)
- privateKey = RSA.setPrivateKey(
- privateKey.n, privateKey.e, privateKey.d);
-
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var md = MD.sha1.create();
- md.update('0123456789abcdef');
- var signature = privateKey.sign(md);
- ASSERT.ok(publicKey.verify(md.digest().getBytes(), signature));
- });
-
- (function() {
- var tests = [{
- keySize: 1024,
- privateKeyPem: '-----BEGIN RSA PRIVATE KEY-----\r\n' +
- 'MIICWwIBAAKBgQDCjvkkLWNTeYXqEsqGiVCW/pDt3/qAodNMHcU9gOU2rxeWwiRu\r\n' +
- 'OhhLqmMxXHLi0oP5Xmg0m7zdOiLMEyzzyRzdp21aqp3k5qtuSDkZcf1prsp1jpYm\r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tiRuv\r\n' +
- 'vIyue7ETq6VjXrOUHQIDAQAB\r\n' +
- '-----END PUBLIC KEY-----\r\n',
- encrypted: 'jsej3OoacmJ1VjWrlw68F+drnQORAuKAqVu6RMbz1xSXjzA355vctrJZXolRU0mvzuu/6VuNynkKGGyRJ6DHt85CvwTMChw4tOMV4Dy6bgnUt3j+DZA2sWTwFhOlpzvNQMK70QpuqrXtOZmAO59EwoDeJkW/iH6t4YzNOVYo9Jg=',
- signature: 'GT0/3EV2zrXxPd1ydijJq3R7lkI4c0GtcprgpG04dSECv/xyXtikuzivxv7XzUdHpu6QiYmM0xE4D4i7LK3Mzy+f7aB4o/dg8XXO3htLiBzVI+ZJCRh06RdYctPtclAWmyZikZ8Etw3NnA/ldKuG4jApbwRb21UFm5gYLrJ4SP4=',
- signaturePss: 'F4xffaANDBjhFxeSJx8ANuBbdhaWZjUHRQh4ueYQMPPCaR2mpwdqxE04sbgNgIiZzBuLIAI4HpTMMoDk3Rruhjefx3+9UhzTxgB0hRI+KzRChRs+ToltWWDZdYzt9T8hfTlELeqT4V8HgjDuteO/IAvIVlRIBwMNv53Iebu1FY4=',
- signatureWithAbcSalt: 'GYA/Zp8G+jqG2Fu7Um+XP7Cr/yaVdzJN8lyt57Lw6gFflia2CPbOVMLyqLzD7fKoE8UD0Rc6DF8k04xhEu60sudw2nxGHeDvpL4M9du0uYra/WSr9kv7xNjAW62NyNerDngHD2J7O8gQ07TZiTXkrfS724vQab5xZL/+FhvisMY=',
- signatureWithCustomPrng: 'LzWcUpUYK+URDp72hJbz1GVEp0rG0LHjd+Pdh2w5rfQFbUThbmXDl3X6DUT5UZr5RjUSHtc2usvH+w49XskyIJJO929sUk9EkMJMK/6QAnYYEp5BA+48pdGNNMZyjIbhyl9Y4lInzFPX8XYMM8o+tdSK+hj+dW5OPdnwWbDtR7U='
- }, {
- keySize: 1025,
- privateKeyPem: '-----BEGIN RSA PRIVATE KEY-----\r\n' +
- 'MIICXgIBAAKBgQGIkej4PDlAigUh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zB1COJ5o0DwZw/NR+CNy7NUrly+vmh2YPwsa\r\n' +
- 'qN+AsYBF9qsF93oN8/TBtaL/GRoRGpDcCglkj1kZnDaWR79NsG8mC0TrvQCkcCLO\r\n' +
- 'P0c2Ux1hRbntOetGXwIDAQAB\r\n' +
- '-----END PUBLIC KEY-----\r\n',
- encrypted: 'AOVeCUN8BOVkZvt4mxyNn/yCYE1MZ40A3e/osh6EvCBcJ09hyYbx7bzKSrdkhRnDyW0pGtgP352CollasllQZ9HlfI2Wy9zKM0aYZZn8OHBA+60Tc3xHHDGznLZqggUKuhoNpj+faVZ1uzb285eTpQQa+4mLUue2svJD4ViM8+ng',
- signature: 'AFSx0axDYXlF2rO3ofgUhYSI8ZlIWtJUUZ62PhgdBp9O5zFqMX3DXoiov1e7NenSOz1khvTSMctFWzKP3GU3F0yewe+Yd3UAZE0dM8vAxigSSfAchUkBDmp9OFuszUie63zwWwpG+gXtvyfueZs1RniBvW1ZmXJvS+HFgX4ouzwd',
- signaturePss: 'AQvBdhAXDpu+7RpcybMgwuTUk6w+qa08Lcq3G1xHY4kC7ZUzauZd/Jn9e0ePKApDqs7eDNAOV+dQkU2wiH/uBg6VGelzb0hFwcpSLyBW92Vw0q3GlzY7myWn8qnNzasrt110zFflWQa1GiuzH/C8f+Z82/MzlWDxloJIYbq2PRC8',
- signatureWithAbcSalt: 'AW4bKnG/0TGvAZgqX5Dk+fXpUNgX7INFelE46d3m+spaMTG5XalY0xP1sxWfaE/+Zl3FmZcfTNtfOCo0eNRO1h1+GZZfp32ZQZmZvkdUG+dUQp318LNzgygrVf/5iIX+QKV5/soSDuAHBzS7yDfMgzJfnXNpFE/zPLOgZIoOIuLq',
- signatureWithCustomPrng: 'AVxfCyGC/7Y3kz//eYFEuWQijjR7eR05AM36CwDlLsVkDRtXoeVzz2yTFBdP+i+QgQ73C/I3lLtvXTwfleorvIX9YncVBeGDQXssmULxzqsM3izaLfJXCRAGx9ErL1Az10+fAqPZpq954OVSDqrR/61Q7CsMY7CiQO3nfIIaxgVL'
- }, {
- keySize: 1031,
- privateKeyPem: '-----BEGIN RSA PRIVATE KEY-----\r\n' +
- 'MIICXwIBAAKBgWyeKqA2oA4klYrKT9hjjutYQksJNN0cxwaQwIm9AYiLxOsYtT/C\r\n' +
- 'ovJx5Oy1EvkbYQbfvYsGISUx9bW8yasZkTHR55IbW3+UptvQjTDtdxBQTgQOpsAh\r\n' +
- 'BJtZYY3OmyH9Sj3F3oB//oyriNoj0QYyfsvlO8UsMmLzpnf6qfZBDHA/9QIDAQAB\r\n' +
- 'AoGBBj/3ne5muUmbnTfU7lOUNrCGaADonMx6G0ObAJHyk6PPOePbEgcmDyNEk+Y7\r\n' +
- 'aEAODjIzmttIbvZ39/Qb+o9nDmCSZC9VxiYPP+rjOzPglCDT5ks2Xcjwzd3If6Ya\r\n' +
- 'Uw6P31Y760OCYeTb4Ib+8zz5q51CkjkdX5Hq/Yu+lZn0Vx7BAkENo83VfL+bwxTm\r\n' +
- 'V7vR6gXqTD5IuuIGHL3uTmMNNURAP6FQDHu//duipys83iMChcOeXtboE16qYrO0\r\n' +
- '9KC0cqL4JQJBB/aYo/auVUGZA6f50YBp0b2slGMk9TBQG0iQefuuSyH4kzKnt2e3\r\n' +
- 'Q40SBmprcM+DfttWJ11bouec++goXjz+95ECQQyiTWYRxulgKVuyqCYnvpLnTEnR\r\n' +
- '0MoYlVTHBriVPkLErYaYCYgse+SNM1+N4p/Thv6KmkUcq/Lmuc5DSRfbl1iBAkEE\r\n' +
- '7GKtJQvd7EO1bfpXnARQx+tWhwHHkgpFBBVHReMZ0rQEFhJ5o2c8HZEiZFNvGO2c\r\n' +
- '1fErP14zlu2JFZ03vpCI8QJBCQz9HL28VNjafSAF2mon/SNjKablRjoGGKSoSdyA\r\n' +
- 'DHDZ/LeRsTp2dg8+bSiG1R+vPqw0f/BT+ux295Sy9ocGEM8=\r\n' +
- '-----END RSA PRIVATE KEY-----\r\n',
- publicKeyPem: '-----BEGIN PUBLIC KEY-----\r\n' +
- 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgWyeKqA2oA4klYrKT9hjjutYQksJ\r\n' +
- 'NN0cxwaQwIm9AYiLxOsYtT/CovJx5Oy1EvkbYQbfvYsGISUx9bW8yasZkTHR55Ib\r\n' +
- 'W3+UptvQjTDtdxBQTgQOpsAhBJtZYY3OmyH9Sj3F3oB//oyriNoj0QYyfsvlO8Us\r\n' +
- 'MmLzpnf6qfZBDHA/9QIDAQAB\r\n' +
- '-----END PUBLIC KEY-----\r\n',
- encrypted: 'ShSS4/fEAkuS6XiQakhOpWp82IXaaCaDNtsndU4uokvriqgCGZyqc+IkIk3eVmZ8bn4vVIRR43ydFuvGgsptVjizOdLGZudph3TJ1clcYEMcCXk4z5HaEu0bx5SW9jmzHhE/z+WV8PB48q7y7C2qtmPmfttG2NMsNLBvkiaDopRO',
- signature: 'Z3vYgRdezrWmdA3NC1Uz2CcHRTcE+/C2idGZA1FjUGqFztAHQ31k0QW/F5zuJdKvg8LQU45S3KxW+OQpbGPL98QbzJLhml88mFGe6OinLXJbi7UQWrtXwamc2jMdiXwovSLbXaXy6PX2QW089iC8XuAZftVi3T/IKV0458FQQprg',
- signaturePss: 'R6QsK6b3QinIPZPamm/dP0Zndqti1TzAkFTRSZJaRSa1u2zuvZC5QHF4flDjEtHosWeDyxrBE7PHGQZ0b1bHv9qgHGsJCMwaQPj3AWj9fjYmx7b86KM2vHr8q/vqDaa9pTvVRSSwvD6fwoZPc9twQEfdjdDBAiy23yLDzk/zZiwM',
- signatureWithAbcSalt: 'Ep9qx4/FPNcWTixWhvL2IAyJR69o5I4MIJi3cMAhDmpuTvAaL/ThQwFWkBPPOPT4Jbumnu6ELjPNjo72wa00e5k64qnZgy1pauBPMlXRlKehRc9UJZ6+xot642z8Qs+rt89OgbYTsvlyr8lzXooUHz/lPpfawYCqd7maRMs8YlYM',
- signatureWithCustomPrng: 'NHAwyn2MdM5ez/WbDNbu2A2JNS+cRiWk/zBoh0lg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X\r\n' +
- '4yDoXSM5A/xQu2BJbXO4jPe3PnDvCVCEyKpbCK6bWbe26Y7zuw==\r\n' +
- '-----END RSA PRIVATE KEY-----\r\n',
- publicKeyPem: '-----BEGIN PUBLIC KEY-----\r\n' +
- 'MIGgMA0GCSqGSIb3DQEBAQUAA4GOADCBigKBggDPhzn5I3GecxWt5DKbP+VhM2AF\r\n' +
- 'NSOL0+VbYEOR1hnlZdLbxGK4cPQzMr2qT6dyttJcsgWr3xKobPkz7vsTZzQATSie\r\n' +
- 'km5Js5dGpaj5lrq/x2+WTZvn55x9M5Y5dlpusDMKcC3KaIX/axc+MbvPFzo6Eli7\r\n' +
- 'JLCWdBg01eKo30knil0CAwEAAQ==\r\n' +
- '-----END PUBLIC KEY-----\r\n',
- encrypted: 'pKTbv+xgXPDc+wbjsANFu1/WTcmy4aZFKXKnxddHbU5S0Dpdj2OqCACiBwu1oENPMgPAJ27XRbFtKG+eS8tX47mKP2Fo0Bi+BPFtzuQ1bj3zUzTwzjemT+PU+a4Tho/eKjPhm6xrwGAoQH2VEDEpvcYf+SRmGFJpJ/zPUrSxgffj',
- signature: 'R9WBFprCfcIC4zY9SmBpEM0E+cr5j4gMn3Ido5mktoR9VBoJqC6eR6lubIPvZZUz9e4yUSYX0squ56Q9Y0yZFQjTHgsrlmhB2YW8kpv4h8P32Oz2TLcMJK9R2tIh9vvyxwBkd/Ml1qG60GnOFUFzxUad9VIlzaF1PFR6EfnkgBUW',
- signaturePss: 'v9UBd4XzBxSRz8yhWKjUkFpBX4Fr2G+ImjqbePL4sAZvYw1tWL+aUQpzG8eOyMxxE703VDh9nIZULYI/uIb9HYHQoGYQ3WoUaWqtZg1x8pZP+Ad7ilUWk5ImRl57fTznNQiVdwlkS5Wgheh1yJCES570a4eujiK9OyB0ba4rKIcM',
- signatureWithAbcSalt: 'HCm0FI1jE6wQgwwi0ZwPTkGjssxAPtRh6tWXhNd2J2IoJYj9oQMMjCEElnvQFBa/l00sIsw2YV1tKyoTABaSTGV4vlJcDF+K0g/wiAf30TRUZo72DZKDNdyffDlH0wBDkNVW+F6uqdciJqBC6zz+unNh7x+FRwYaY8xhudIPXdyP',
- signatureWithCustomPrng: 'AGyN8xu+0yfCR1tyB9mCXcTGb2vdLnsX9ro2Qy5KV6Hw5YMVNltAt65dKR4Y8pfu6D4WUyyJRUtJ8td2ZHYzIVtWY6bG1xFt5rkjTVg4v1tzQgUQq8AHvRE2qLzwDXhazJ1e6Id2Nuxb1uInFyRC6/gLmiPga1WRDEVvFenuIA48'
- }];
- for(var i = 0; i < tests.length; ++i) {
- createTests(tests[i]);
- }
-
- it('should ensure maximum message length for a 1024-bit key is exceeded', function() {
- /* For PKCS#1 v1.5, the message must be padded with at least eight bytes,
- two zero bytes and one byte telling what the block type is. This is 11
- extra bytes are added to the message. The test uses a message of 118
- bytes.Together with the 11 extra bytes the encryption block needs to be
- at least 129 bytes long. This requires a key of 1025-bits. */
- var key = PKI.publicKeyFromPem(tests[0].publicKeyPem);
- var message = UTIL.createBuffer().fillWithByte(0, 118);
- ASSERT.throws(function() {
- key.encrypt(message.getBytes());
- });
- });
-
- it('should ensure maximum message length for a 1025-bit key is not exceeded', function() {
- var key = PKI.publicKeyFromPem(tests[1].publicKeyPem);
- var message = UTIL.createBuffer().fillWithByte(0, 118);
- ASSERT.doesNotThrow(function() {
- key.encrypt(message.getBytes());
- });
- });
-
- /**
- * Creates RSA encryption & decryption tests.
- *
- * Uses different key sizes (1024, 1025, 1031, 1032). The test functions are
- * generated from "templates" below, one for each key size to provide sensible
- * output.
- *
- * Key material in was created with OpenSSL using these commands:
- *
- * openssl genrsa -out rsa_1024_private.pem 1024
- * openssl rsa -in rsa_1024_private.pem -out rsa_1024_public.pem \
- * -outform PEM -pubout
- * echo 'too many secrets' | openssl rsautl -encrypt \
- * -inkey rsa_1024_public.pem -pubin -out rsa_1024_encrypted.bin
- *
- * echo -n 'just testing' | openssl dgst -sha1 -binary > tosign.sha1
- * openssl pkeyutl -sign -in tosign.sha1 -inkey rsa_1024_private.pem \
- * -out rsa_1024_sig.bin -pkeyopt digest:sha1
- * openssl pkeyutl -sign -in tosign.sha1 -inkey rsa_1024_private.pem \
- * -out rsa_1024_sigpss.bin -pkeyopt digest:sha1 \
- * -pkeyopt rsa_padding_mode:pss -pkeyopt rsa_pss_saltlen:20
- *
- * OpenSSL commands for signature verification:
- *
- * openssl pkeyutl -verify -in tosign.sha1 -sigfile rsa_1024_sig.bin \
- * -pubin -inkey rsa_1024_public.pem -pkeyopt digest:sha1
- * openssl pkeyutl -verify -in tosign.sha1 -sigfile rsa_1025_sigpss.bin \
- * -pubin -inkey rsa_1025_public.pem -pkeyopt digest:sha1 \
- * -pkeyopt rsa_padding_mode:pss -pkeyopt rsa_pss_saltlen:20
- */
- function createTests(params) {
- var keySize = params.keySize;
-
- it('should rsa encrypt using a ' + keySize + '-bit key', function() {
- var message = "it need's to be about 20% cooler"; // it need's better grammar too
-
- /* First step, do public key encryption */
- var key = PKI.publicKeyFromPem(params.publicKeyPem);
- var data = key.encrypt(message);
-
- /* Second step, use private key decryption to verify successful
- encryption. The encrypted message differs every time, since it is
- padded with random data. Therefore just rely on the decryption
- routine to work, which is tested seperately against an externally
- provided encrypted message. */
- key = PKI.privateKeyFromPem(params.privateKeyPem);
- ASSERT.equal(key.decrypt(data), message);
- });
-
- it('should rsa decrypt using a ' + keySize + '-bit key', function() {
- var data = UTIL.decode64(params.encrypted);
- var key = PKI.privateKeyFromPem(params.privateKeyPem);
- ASSERT.equal(key.decrypt(data), 'too many secrets\n');
- });
-
- it('should rsa sign using a ' + keySize + '-bit key and PKCS#1 v1.5 padding', function() {
- var key = PKI.privateKeyFromPem(params.privateKeyPem);
-
- var md = MD.sha1.create();
- md.start();
- md.update('just testing');
-
- var signature = UTIL.decode64(params.signature);
- ASSERT.equal(key.sign(md), signature);
- });
-
- it('should verify an rsa signature using a ' + keySize + '-bit key and PKCS#1 v1.5 padding', function() {
- var signature = UTIL.decode64(params.signature);
- var key = PKI.publicKeyFromPem(params.publicKeyPem);
-
- var md = MD.sha1.create();
- md.start();
- md.update('just testing');
-
- ASSERT.equal(key.verify(md.digest().getBytes(), signature), true);
- });
-
- /* Note: signatures are *not* deterministic (the point of RSASSA-PSS),
- so they can't be compared easily -- instead they are just verified
- using the verify() function which is tested against OpenSSL-generated
- signatures. */
- it('should rsa sign using a ' + keySize + '-bit key and PSS padding', function() {
- var privateKey = PKI.privateKeyFromPem(params.privateKeyPem);
- var publicKey = PKI.publicKeyFromPem(params.publicKeyPem);
-
- var md = MD.sha1.create();
- md.start();
- md.update('just testing');
-
- // create signature
- var pss = PSS.create(
- MD.sha1.create(), MGF.mgf1.create(MD.sha1.create()), 20);
- var signature = privateKey.sign(md, pss);
-
- // verify signature
- md.start();
- md.update('just testing');
- ASSERT.equal(
- publicKey.verify(md.digest().getBytes(), signature, pss), true);
- });
-
- it('should verify an rsa signature using a ' + keySize + '-bit key and PSS padding', function() {
- var signature = UTIL.decode64(params.signaturePss);
- var key = PKI.publicKeyFromPem(params.publicKeyPem);
-
- var md = MD.sha1.create();
- md.start();
- md.update('just testing');
-
- var pss = PSS.create(
- MD.sha1.create(), MGF.mgf1.create(MD.sha1.create()), 20);
- ASSERT.equal(
- key.verify(md.digest().getBytes(), signature, pss), true);
- });
-
- it('should rsa sign using a ' + keySize + '-bit key and PSS padding using pss named-param API', function() {
- var privateKey = PKI.privateKeyFromPem(params.privateKeyPem);
- var publicKey = PKI.publicKeyFromPem(params.publicKeyPem);
-
- var md = MD.sha1.create();
- md.start();
- md.update('just testing');
-
- // create signature
- var pss = PSS.create({
- md: MD.sha1.create(),
- mgf: MGF.mgf1.create(MD.sha1.create()),
- saltLength: 20
- });
- var signature = privateKey.sign(md, pss);
-
- // verify signature
- md.start();
- md.update('just testing');
- ASSERT.equal(
- publicKey.verify(md.digest().getBytes(), signature, pss), true);
- });
-
- it('should verify an rsa signature using a ' + keySize + '-bit key and PSS padding using pss named-param API', function() {
- var signature = UTIL.decode64(params.signaturePss);
- var key = PKI.publicKeyFromPem(params.publicKeyPem);
-
- var md = MD.sha1.create();
- md.start();
- md.update('just testing');
-
- var pss = PSS.create({
- md: MD.sha1.create(),
- mgf: MGF.mgf1.create(MD.sha1.create()),
- saltLength: 20
- });
- ASSERT.equal(
- key.verify(md.digest().getBytes(), signature, pss), true);
- });
-
- it('should rsa sign using a ' + keySize + '-bit key and PSS padding using salt "abc"', function() {
- var privateKey = PKI.privateKeyFromPem(params.privateKeyPem);
-
- var md = MD.sha1.create();
- md.start();
- md.update('just testing');
-
- // create signature
- var pss = PSS.create({
- md: MD.sha1.create(),
- mgf: MGF.mgf1.create(MD.sha1.create()),
- salt: UTIL.createBuffer('abc')
- });
- var signature = privateKey.sign(md, pss);
- var b64 = UTIL.encode64(signature);
- ASSERT.equal(b64, params.signatureWithAbcSalt);
- });
-
- it('should verify an rsa signature using a ' + keySize + '-bit key and PSS padding using salt "abc"', function() {
- var signature = UTIL.decode64(params.signatureWithAbcSalt);
- var key = PKI.publicKeyFromPem(params.publicKeyPem);
-
- var md = MD.sha1.create();
- md.start();
- md.update('just testing');
-
- var pss = PSS.create({
- md: MD.sha1.create(),
- mgf: MGF.mgf1.create(MD.sha1.create()),
- saltLength: 3
- });
- ASSERT.equal(
- key.verify(md.digest().getBytes(), signature, pss), true);
- });
-
- it('should rsa sign using a ' + keySize + '-bit key and PSS padding using custom PRNG', function() {
- var prng = RANDOM.createInstance();
- prng.seedFileSync = function(needed) {
- return UTIL.fillString('a', needed);
- };
- var privateKey = PKI.privateKeyFromPem(params.privateKeyPem);
-
- var md = MD.sha1.create();
- md.start();
- md.update('just testing');
-
- // create signature
- var pss = PSS.create({
- md: MD.sha1.create(),
- mgf: MGF.mgf1.create(MD.sha1.create()),
- saltLength: 20,
- prng: prng
- });
- var signature = privateKey.sign(md, pss);
- var b64 = UTIL.encode64(signature);
- ASSERT.equal(b64, params.signatureWithCustomPrng);
- });
-
- it('should verify an rsa signature using a ' + keySize + '-bit key and PSS padding using custom PRNG', function() {
- var prng = RANDOM.createInstance();
- prng.seedFileSync = function(needed) {
- return UTIL.fillString('a', needed);
- };
- var signature = UTIL.decode64(params.signatureWithCustomPrng);
- var key = PKI.publicKeyFromPem(params.publicKeyPem);
-
- var md = MD.sha1.create();
- md.start();
- md.update('just testing');
-
- var pss = PSS.create({
- md: MD.sha1.create(),
- mgf: MGF.mgf1.create(MD.sha1.create()),
- saltLength: 20,
- prng: prng
- });
- ASSERT.equal(
- key.verify(md.digest().getBytes(), signature, pss), true);
- });
- }
- })();
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/pki',
- 'forge/rsa',
- 'forge/md',
- 'forge/mgf',
- 'forge/pss',
- 'forge/random',
- 'forge/util'
- ], function(PKI, RSA, MD, MGF, PSS, RANDOM, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- PKI(),
- RSA(),
- MD(),
- MGF(),
- PSS(),
- RANDOM(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/pki')(),
- require('../../js/rsa')(),
- require('../../js/md')(),
- require('../../js/mgf')(),
- require('../../js/pss')(),
- require('../../js/random')(),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/sha1.js b/school/node_modules/node-forge/nodejs/test/sha1.js
deleted file mode 100644
index 3ffd985..0000000
--- a/school/node_modules/node-forge/nodejs/test/sha1.js
+++ /dev/null
@@ -1,75 +0,0 @@
-(function() {
-
-function Tests(ASSERT, SHA1, UTIL) {
- describe('sha1', function() {
- it('should digest the empty string', function() {
- var md = SHA1.create();
- ASSERT.equal(
- md.digest().toHex(), 'da39a3ee5e6b4b0d3255bfef95601890afd80709');
- });
-
- it('should digest "abc"', function() {
- var md = SHA1.create();
- md.update('abc');
- ASSERT.equal(
- md.digest().toHex(), 'a9993e364706816aba3e25717850c26c9cd0d89d');
- });
-
- it('should digest "The quick brown fox jumps over the lazy dog"', function() {
- var md = SHA1.create();
- md.update('The quick brown fox jumps over the lazy dog');
- ASSERT.equal(
- md.digest().toHex(), '2fd4e1c67a2d28fced849ee1bb76e7391b93eb12');
- });
-
- it('should digest "c\'\u00e8"', function() {
- var md = SHA1.create();
- md.update("c\'\u00e8", 'utf8');
- ASSERT.equal(
- md.digest().toHex(), '98c9a3f804daa73b68a5660d032499a447350c0d');
- });
-
- it('should digest "THIS IS A MESSAGE"', function() {
- var md = SHA1.create();
- md.start();
- md.update('THIS IS ');
- md.update('A MESSAGE');
- // do twice to check continuing digest
- ASSERT.equal(
- md.digest().toHex(), '5f24f4d6499fd2d44df6c6e94be8b14a796c071d');
- ASSERT.equal(
- md.digest().toHex(), '5f24f4d6499fd2d44df6c6e94be8b14a796c071d');
- });
-
- it('should digest a long message', function() {
- // Note: might be too slow on old browsers
- var md = SHA1.create();
- md.update(UTIL.fillString('a', 1000000));
- ASSERT.equal(
- md.digest().toHex(), '34aa973cd4c4daa4f61eeb2bdbad27316534016f');
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/sha1',
- 'forge/util'
- ], function(SHA1, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- SHA1(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/sha1')(),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/sha256.js b/school/node_modules/node-forge/nodejs/test/sha256.js
deleted file mode 100644
index 2d5eb8a..0000000
--- a/school/node_modules/node-forge/nodejs/test/sha256.js
+++ /dev/null
@@ -1,81 +0,0 @@
-(function() {
-
-function Tests(ASSERT, SHA256, UTIL) {
- describe('sha256', function() {
- it('should digest the empty string', function() {
- var md = SHA256.create();
- ASSERT.equal(
- md.digest().toHex(),
- 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855');
- });
-
- it('should digest "abc"', function() {
- var md = SHA256.create();
- md.update('abc');
- ASSERT.equal(
- md.digest().toHex(),
- 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad');
- });
-
- it('should digest "The quick brown fox jumps over the lazy dog"', function() {
- var md = SHA256.create();
- md.update('The quick brown fox jumps over the lazy dog');
- ASSERT.equal(
- md.digest().toHex(),
- 'd7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592');
- });
-
- it('should digest "c\'\u00e8"', function() {
- var md = SHA256.create();
- md.update("c\'\u00e8", 'utf8');
- ASSERT.equal(
- md.digest().toHex(),
- '1aa15c717afffd312acce2217ce1c2e5dabca53c92165999132ec9ca5decdaca');
- });
-
- it('should digest "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"', function() {
- var md = SHA256.create();
- md.start();
- md.update('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq');
- // do twice to check continuing digest
- ASSERT.equal(
- md.digest().toHex(),
- '248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1');
- ASSERT.equal(
- md.digest().toHex(),
- '248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1');
- });
-
- it('should digest a long message', function() {
- // Note: might be too slow on old browsers
- var md = SHA256.create();
- md.update(UTIL.fillString('a', 1000000));
- ASSERT.equal(
- md.digest().toHex(),
- 'cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0');
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/sha256',
- 'forge/util'
- ], function(SHA256, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- SHA256(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/sha256')(),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/sha512.js b/school/node_modules/node-forge/nodejs/test/sha512.js
deleted file mode 100644
index 3cbc4dc..0000000
--- a/school/node_modules/node-forge/nodejs/test/sha512.js
+++ /dev/null
@@ -1,174 +0,0 @@
-(function() {
-
-function Tests(ASSERT, SHA512, UTIL) {
- describe('sha512', function() {
- it('should digest the empty string', function() {
- var md = SHA512.create();
- ASSERT.equal(
- md.digest().toHex(),
- 'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e');
- });
-
- it('should digest "abc"', function() {
- var md = SHA512.create();
- md.update('abc');
- ASSERT.equal(
- md.digest().toHex(),
- 'ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f');
- });
-
- it('should digest "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"', function() {
- var md = SHA512.create();
- md.update('abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu');
- ASSERT.equal(
- md.digest().toHex(),
- '8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909');
- });
-
- it('should digest "The quick brown fox jumps over the lazy dog"', function() {
- var md = SHA512.create();
- md.update('The quick brown fox jumps over the lazy dog');
- ASSERT.equal(
- md.digest().toHex(),
- '07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6');
- });
-
- it('should digest "c\'\u00e8"', function() {
- var md = SHA512.create();
- md.update("c\'\u00e8", 'utf8');
- ASSERT.equal(
- md.digest().toHex(),
- '9afdc0390dd91e81c63f858d1c6fcd9f949f3fc89dbdaed9e4211505bad63d8e8787797e2e9ea651285eb6954e51c4f0299837c3108cb40f1420bca1d237355c');
- });
-
- it('should digest "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"', function() {
- var md = SHA512.create();
- md.start();
- md.update('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq');
- // do twice to check continuing digest
- ASSERT.equal(
- md.digest().toHex(),
- '204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445');
- ASSERT.equal(
- md.digest().toHex(),
- '204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445');
- });
- });
-
- SHA384 = SHA512.sha384;
-
- describe('sha384', function() {
- it('should digest the empty string', function() {
- var md = SHA384.create();
- ASSERT.equal(
- md.digest().toHex(),
- '38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b');
- });
-
- it('should digest "abc"', function() {
- var md = SHA384.create();
- md.update('abc');
- ASSERT.equal(
- md.digest().toHex(),
- 'cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7');
- });
-
- it('should digest "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"', function() {
- var md = SHA384.create();
- md.update('abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu');
- ASSERT.equal(
- md.digest().toHex(),
- '09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039');
- });
-
- it('should digest "The quick brown fox jumps over the lazy dog"', function() {
- var md = SHA384.create();
- md.update('The quick brown fox jumps over the lazy dog');
- ASSERT.equal(
- md.digest().toHex(),
- 'ca737f1014a48f4c0b6dd43cb177b0afd9e5169367544c494011e3317dbf9a509cb1e5dc1e85a941bbee3d7f2afbc9b1');
- });
-
- it('should digest "c\'\u00e8"', function() {
- var md = SHA384.create();
- md.update("c\'\u00e8", 'utf8');
- ASSERT.equal(
- md.digest().toHex(),
- '382ec8a92d50abf57f7d0f934ff3969d6d354d30c96f1616678a920677867aba49521d2d535c0f285a3c2961c2034ea3');
- });
-
- it('should digest "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"', function() {
- var md = SHA384.create();
- md.start();
- md.update('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq');
- // do twice to check continuing digest
- ASSERT.equal(
- md.digest().toHex(),
- '3391fdddfc8dc7393707a65b1b4709397cf8b1d162af05abfe8f450de5f36bc6b0455a8520bc4e6f5fe95b1fe3c8452b');
- ASSERT.equal(
- md.digest().toHex(),
- '3391fdddfc8dc7393707a65b1b4709397cf8b1d162af05abfe8f450de5f36bc6b0455a8520bc4e6f5fe95b1fe3c8452b');
- });
- });
-
- SHA256 = SHA512.sha256;
-
- describe('sha512/256', function() {
- it('should digest the empty string', function() {
- var md = SHA256.create();
- ASSERT.equal(
- md.digest().toHex(),
- 'c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a');
- });
-
- it('should digest "The quick brown fox jumps over the lazy dog"', function() {
- var md = SHA256.create();
- md.update('The quick brown fox jumps over the lazy dog');
- ASSERT.equal(
- md.digest().toHex(),
- 'dd9d67b371519c339ed8dbd25af90e976a1eeefd4ad3d889005e532fc5bef04d');
- });
- });
-
- SHA224 = SHA512.sha224;
-
- describe('sha512/224', function() {
- it('should digest the empty string', function() {
- var md = SHA224.create();
- ASSERT.equal(
- md.digest().toHex(),
- '6ed0dd02806fa89e25de060c19d3ac86cabb87d6a0ddd05c333b84f4');
- });
-
- it('should digest "The quick brown fox jumps over the lazy dog"', function() {
- var md = SHA224.create();
- md.update('The quick brown fox jumps over the lazy dog');
- ASSERT.equal(
- md.digest().toHex(),
- '944cd2847fb54558d4775db0485a50003111c8e5daa63fe722c6aa37');
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/sha512',
- 'forge/util'
- ], function(SHA512, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- SHA512(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/sha512')(),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/ssh.js b/school/node_modules/node-forge/nodejs/test/ssh.js
deleted file mode 100644
index c90eb26..0000000
--- a/school/node_modules/node-forge/nodejs/test/ssh.js
+++ /dev/null
@@ -1,193 +0,0 @@
-(function() {
-
-function Tests(ASSERT, forge) {
-
- // Original RSA key generated by openssh
- var keystr =
- '-----BEGIN RSA PRIVATE KEY-----\r\n' +
- 'MIIEogIBAAKCAQEA301O+LBnd6ngw9i0Pb5iTwlQ1s37ay3DNpisjh+jPDDvaIZq\r\n' +
- 'PC+44YV7RaR1ib2wEoQfg4DwqVw5wlA2x97Txngb+sJe0yUfmM9vMTxhXWuURVR6\r\n' +
- '6DGd8t2eOBN8qDoYlpvdVf8Go5Btrb6NCexUbZtFS1AmumK2zQKxIizgVLK8dx4G\r\n' +
- 'NYbqxibUxgYHbwRpu8ROrogVrZbMW1cOb4JE+DzG1FvfHSdzkxb9e5ARcsuLxCdP\r\n' +
- 'ItUMVY8jjgER6b5lK+Nzr57hFdr08RjWGBldNGrCFqDdm+1WkGAHTRrg/i/MD8BU\r\n' +
- '8NCFUBpQTSrhALkGqBdGZPN/PrXonXjhcd11awIDAQABAoIBAHGMESUaJnLN2jIc\r\n' +
- 'RoLDBaBk/0tLEJaOfZ6Mgen/InUf+Q0wlGKobZ2Xz3g5SV9SKm8v6gpnjXjBIcmy\r\n' +
- 'GjkGEK/yMWAQaEF7thZxHHxv1J65bnrWm2zolgWCNcsT9aZ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785rc35885dsaXChZx1+7rfZ+AclyisRsmES9UfqL6M\r\n' +
- '+SuluaBSWJQUBS7iaHazUeXmy5t+HBjSSLuAOHoZUckwDWD3EM7GHjFlWJOCArI3\r\n' +
- 'hOYlsXSyl07rApzg/t+HxXcNpLZGJTgRwrRGF2OipUL0VPlTdRc=\r\n' +
- '-----END RSA PRIVATE KEY-----\r\n';
-
- var key = forge.pki.privateKeyFromPem(keystr);
-
- describe('ssh', function() {
- it('should convert keys to openssh public keys', function() {
- var expect =
- 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfTU74sGd3qeDD2LQ9vmJPCVD' +
- 'WzftrLcM2mKyOH6M8MO9ohmo8L7jhhXtFpHWJvbAShB+DgPCpXDnCUDbH3tPGeB' +
- 'v6wl7TJR+Yz28xPGFda5RFVHroMZ3y3Z44E3yoOhiWm91V/wajkG2tvo0J7FRtm' +
- '0VLUCa6YrbNArEiLOBUsrx3HgY1hurGJtTGBgdvBGm7xE6uiBWtlsxbVw5vgkT4' +
- 'PMbUW98dJ3OTFv17kBFyy4vEJ08i1QxVjyOOARHpvmUr43OvnuEV2vTxGNYYGV0' +
- '0asIWoN2b7VaQYAdNGuD+L8wPwFTw0IVQGlBNKuEAuQaoF0Zk838+teideOFx3X' +
- 'Vr A comment';
-
- ASSERT.equal(forge.ssh.publicKeyToOpenSSH(key, 'A comment'), expect);
- });
-
- it('should convert keys to putty unencrypted keys', function() {
- var expect =
- 'PuTTY-User-Key-File-2: ssh-rsa\r\n' +
- 'Encryption: none\r\n' +
- 'Comment: imported-openssh-key\r\n' +
- 'Public-Lines: 6\r\n' +
- 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDfTU74sGd3qeDD2LQ9vmJPCVDWzftrLcM2\r\n' +
- 'mKyOH6M8MO9ohmo8L7jhhXtFpHWJvbAShB+DgPCpXDnCUDbH3tPGeBv6wl7TJR+Y\r\n' +
- 'z28xPGFda5RFVHroMZ3y3Z44E3yoOhiWm91V/wajkG2tvo0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AIB1hEbU8iQDOO6Hvzmtzfnzzl2xpcKFnHX7ut9n4ByXKKxGyYRL1R+ovoz5K6W5\r\n' +
- 'oFJYlBQFLuJodrNR5ebLm34cGNJIu4A4ehlRyTANYPcQzsYeMWVYk4ICsjeE5iWx\r\n' +
- 'dLKXTusCnOD+34fFdw2ktkYlOBHCtEYXY6KlQvRU+VN1Fw==\r\n' +
- 'Private-MAC: 87fa1011848453317d8e41b00c927e9d17dc334e\r\n';
-
- ASSERT.equal(forge.ssh.privateKeyToPutty(key, '', 'imported-openssh-key'), expect);
- });
-
- it('should convert keys to putty encrypted keys', function() {
- var expect =
- 'PuTTY-User-Key-File-2: ssh-rsa\r\n' +
- 'Encryption: aes256-cbc\r\n' +
- 'Comment: imported-openssh-key\r\n' +
- 'Public-Lines: 6\r\n' +
- 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDfTU74sGd3qeDD2LQ9vmJPCVDWzftrLcM2\r\n' +
- 'mKyOH6M8MO9ohmo8L7jhhXtFpHWJvbAShB+DgPCpXDnCUDbH3tPGeBv6wl7TJR+Y\r\n' +
- 'z28xPGFda5RFVHroMZ3y3Z44E3yoOhiWm91V/wajkG2tvo0J7FRtm0VLUCa6YrbN\r\n' +
- 'ArEiLOBUsrx3HgY1hurGJtTGBgdvBGm7xE6uiBWtlsxbVw5vgkT4PMbUW98dJ3OT\r\n' +
- 'Fv17kBFyy4vEJ08i1QxVjyOOARHpvmUr43OvnuEV2vTxGNYYGV00asIWoN2b7VaQ\r\n' +
- 'YAdNGuD+L8wPwFTw0IVQGlBNKuEAuQaoF0Zk838+teideOFx3XVr\r\n' +
- 'Private-Lines: 14\r\n' +
- 'EiVwpacmA7mhmGBTPXeIZZPkeRDtb4LOWzI+68cA5oM7UJTpBxh9zsnpAdWg2knP\r\n' +
- 'snA5gpTSq0CJV9HWb8yAY3R5izflQ493fCbJzuPFTW6RJ2y/D5dUmDWccfMczPNT\r\n' +
- 'GEDOfslCPe+Yz1h0y0y5NI5WwJowxv3nL9FTlQ9KDVrdoSizkVbTh4CJTrvqIc7c\r\n' +
- 'sI/HU25OHS8kcIZPiPL8m40ot254rkbPCWrskm9H4n+EC+BwJNtEic9ZQfGPWOVl\r\n' +
- 't8JxY35mHqGIlfhyVkdts/Rx7kwOHY+GPXDVRnHQZQOkFtVqCFGx8mL83CspIEq0\r\n' +
- 'V8LaHuvxiadA4OEeR0azuDhfVJXvrUpHd4CPjAzJu4doHm98GJAyrz3mtCyxIguH\r\n' +
- 'k8zKVJzbNawy5T43l5x9cR6VKzcl6d4V14vphiovxc8DG/J7RHBd4d1y6wxo5ZMY\r\n' +
- 'qqQ0E6VHtq6auBZjnGzx0P/1lGjpZdxUf4OVTaZ+stCxX5wAH9exF+gdZAlk20Gp\r\n' +
- 'Atg60boQuolHBiH66dQynyHp+6yuLPLKXy74EO+AEB3HvNK7aIQV8rCD7I7HEa12\r\n' +
- 'xxqIH4l0FWQKHXNIrK45uo6Hdg1siYp9zU4FFgDcNGOZJsT6+etPp1sgAeBuBR4F\r\n' +
- 'pnuX1KZzRTbG1kcRrTOjsMh0bKfZAn0+uwyuPBtwEnLziGoCXU+9+XO85zcPF2j1\r\n' +
- 'Ip5AWAOBI82SKMLu51Dpdz1rwSZOPFWnHxRxfnUiQa9Kc7qBGrMxy1UNECAwMGzp\r\n' +
- 'ljKesqZvoANo0voiodALXGs7kSpmXjcbHnUUt0SI/QHyajXabIiLHGf6lfvStYLP\r\n' +
- 'L5bLfswsMqG/2lonYWrPl9YC0WzvfRpbHgpI9G1eLjFFRlaqJ3EpZf5Dy26Z0eh0\r\n' +
- 'Private-MAC: 23aa5b6e2a411107c59e1e6c3bca06247e3c9627\r\n';
-
- ASSERT.equal(forge.ssh.privateKeyToPutty(key, 'passphrase', 'imported-openssh-key'), expect);
- });
-
- it('should convert keys to openssh encrypted private keys', function() {
- var expect =
- '-----BEGIN RSA PRIVATE KEY-----\n' +
- 'Proc-Type: 4,ENCRYPTED\n' +
- 'DEK-Info: AES-128-CBC,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jlre9jTu6lpyN/TkOzHhs/I1/lvKQ\n' +
- 'Uki7BXv65Jq6RqkTbNc5plxBYggdzLGurr0ZIBDsoN6uXkzaM+fCMlJU8+MgAcBb\n' +
- 'x88bj8h3t4akPd/WaSsWKeOzB3Uaw3ztYCpwSVv1F+N0u6C6zGo+9VFAQZh1uKvC\n' +
- 'G9U5hvAG7WEoQ801/fvKj93lqLDhOarPJC8CcfMLwoIqj7zah7TtBYq8VsuF7Fsx\n' +
- 'dEWNFiXhtFqUhgBMt1tcOXGiXA79NucSVzUBNzrRZKlLDYm2TKKyOqEbG9vF/YxL\n' +
- 'ZG3TwmcFj0sko2K61ya7FGpKmfPQCJJoi0tIfnW4eIVcyeRpXYi5B2xqvSXcTdUx\n' +
- '5y5Vpuu1CzrMZr50b3sSOFjcOXE5211RS8SHpOMWY+JDDB4vF4Dv94fqEIgnFtrR\n' +
- 'oQgk3DueWb1x09NcJtEZsW6lT3Jw19ursb++XSejFZ9Xu5ED8fbewgGo2w/N5j1H\n' +
- 'vQEnFkGcL1jLlLqp9PlvPIE4a///wy1y0XbnKMJs+dKxiesKVx1zZ1WDcK2Qgv4r\n' +
- 'G+RsZzHZuCjUyty1+SMVOYM6+3zW6bjXN58xI3XeSxgE/JaJKjLWBZWx5+eU7b6a\n' +
- '04mJDMhnpdLHG97m9p90L1yuudiJfq6ngha41xxv9xLmNatfrtStCrq/DR0KHm0K\n' +
- '-----END RSA PRIVATE KEY-----\n';
-
- // Unable to test -- uses a random IV that I can't control
- //ASSERT.equal(forge.ssh.rsaPrivateKeyAsOpenSSH(key, 'passphrase'), expect);
- });
-
- it('should convert keys to openssh unencrypted private keys', function() {
- var expect = keystr;
- ASSERT.equal(forge.ssh.privateKeyToOpenSSH(key, ''), expect);
- });
-
- it('should get an MD5 SSH fingerprint', function() {
- var fp = forge.ssh.getPublicKeyFingerprint(key);
- ASSERT.equal(fp.toHex(), '46549abeb89422a0955d4041ae7322ec');
- });
-
- it('should get a hex MD5 SSH fingerprint', function() {
- var fp = forge.ssh.getPublicKeyFingerprint(key, {encoding: 'hex'});
- ASSERT.equal(fp, '46549abeb89422a0955d4041ae7322ec');
- });
-
- it('should get a hex, colon-delimited MD5 SSH fingerprint', function() {
- var fp = forge.ssh.getPublicKeyFingerprint(
- key, {encoding: 'hex', delimiter: ':'});
- ASSERT.equal(fp, '46:54:9a:be:b8:94:22:a0:95:5d:40:41:ae:73:22:ec');
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/forge'
- ], function(forge) {
- Tests(
- // Global provided by test harness
- ASSERT,
- forge
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/forge'));
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/tls.js b/school/node_modules/node-forge/nodejs/test/tls.js
deleted file mode 100644
index d9ce944..0000000
--- a/school/node_modules/node-forge/nodejs/test/tls.js
+++ /dev/null
@@ -1,191 +0,0 @@
-(function() {
-
-function Tests(ASSERT, forge) {
- describe('tls', function() {
- it('should test TLS 1.0 PRF', function() {
- // Note: This test vector is originally from:
- // http://www.imc.org/ietf-tls/mail-archive/msg01589.html
- // But that link is now dead.
- var secret = forge.util.createBuffer().fillWithByte(0xAB, 48).getBytes();
- var seed = forge.util.createBuffer().fillWithByte(0xCD, 64).getBytes();
- var bytes = forge.tls.prf_tls1(secret, 'PRF Testvector', seed, 104);
- var expect =
- 'd3d4d1e349b5d515044666d51de32bab258cb521' +
- 'b6b053463e354832fd976754443bcf9a296519bc' +
- '289abcbc1187e4ebd31e602353776c408aafb74c' +
- 'bc85eff69255f9788faa184cbb957a9819d84a5d' +
- '7eb006eb459d3ae8de9810454b8b2d8f1afbc655' +
- 'a8c9a013';
- ASSERT.equal(bytes.toHex(), expect);
- });
-
- it('should establish a TLS connection and transfer data', function(done) {
- var end = {};
- var data = {};
-
- createCertificate('server', data);
- createCertificate('client', data);
- data.client.connection = {};
- data.server.connection = {};
-
- end.client = forge.tls.createConnection({
- server: false,
- caStore: [data.server.cert],
- sessionCache: {},
- cipherSuites: [
- forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA,
- forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA],
- virtualHost: 'server',
- verify: function(c, verified, depth, certs) {
- data.client.connection.commonName =
- certs[0].subject.getField('CN').value;
- data.client.connection.certVerified = verified;
- return true;
- },
- connected: function(c) {
- c.prepare('Hello Server');
- },
- getCertificate: function(c, hint) {
- return data.client.cert;
- },
- getPrivateKey: function(c, cert) {
- return data.client.privateKey;
- },
- tlsDataReady: function(c) {
- end.server.process(c.tlsData.getBytes());
- },
- dataReady: function(c) {
- data.client.connection.data = c.data.getBytes();
- c.close();
- },
- closed: function(c) {
- ASSERT.equal(data.client.connection.commonName, 'server');
- ASSERT.equal(data.client.connection.certVerified, true);
- ASSERT.equal(data.client.connection.data, 'Hello Client');
- done();
- },
- error: function(c, error) {
- ASSERT.equal(error.message, undefined);
- }
- });
-
- end.server = forge.tls.createConnection({
- server: true,
- caStore: [data.client.cert],
- sessionCache: {},
- cipherSuites: [
- forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA,
- forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA],
- connected: function(c) {
- },
- verifyClient: true,
- verify: function(c, verified, depth, certs) {
- data.server.connection.commonName =
- certs[0].subject.getField('CN').value;
- data.server.connection.certVerified = verified;
- return true;
- },
- getCertificate: function(c, hint) {
- data.server.connection.certHint = hint[0];
- return data.server.cert;
- },
- getPrivateKey: function(c, cert) {
- return data.server.privateKey;
- },
- tlsDataReady: function(c) {
- end.client.process(c.tlsData.getBytes());
- },
- dataReady: function(c) {
- data.server.connection.data = c.data.getBytes();
- c.prepare('Hello Client');
- c.close();
- },
- closed: function(c) {
- ASSERT.equal(data.server.connection.certHint, 'server');
- ASSERT.equal(data.server.connection.commonName, 'client');
- ASSERT.equal(data.server.connection.certVerified, true);
- ASSERT.equal(data.server.connection.data, 'Hello Server');
- },
- error: function(c, error) {
- ASSERT.equal(error.message, undefined);
- }
- });
-
- end.client.handshake();
-
- function createCertificate(cn, data) {
- var keys = forge.pki.rsa.generateKeyPair(512);
- var cert = forge.pki.createCertificate();
- cert.publicKey = keys.publicKey;
- cert.serialNumber = '01';
- cert.validity.notBefore = new Date();
- cert.validity.notAfter = new Date();
- cert.validity.notAfter.setFullYear(
- cert.validity.notBefore.getFullYear() + 1);
- var attrs = [{
- name: 'commonName',
- value: cn
- }, {
- name: 'countryName',
- value: 'US'
- }, {
- shortName: 'ST',
- value: 'Virginia'
- }, {
- name: 'localityName',
- value: 'Blacksburg'
- }, {
- name: 'organizationName',
- value: 'Test'
- }, {
- shortName: 'OU',
- value: 'Test'
- }];
- cert.setSubject(attrs);
- cert.setIssuer(attrs);
- cert.setExtensions([{
- name: 'basicConstraints',
- cA: true
- }, {
- name: 'keyUsage',
- keyCertSign: true,
- digitalSignature: true,
- nonRepudiation: true,
- keyEncipherment: true,
- dataEncipherment: true
- }, {
- name: 'subjectAltName',
- altNames: [{
- type: 6, // URI
- value: 'https://myuri.com/webid#me'
- }]
- }]);
- cert.sign(keys.privateKey);
- data[cn] = {
- cert: forge.pki.certificateToPem(cert),
- privateKey: forge.pki.privateKeyToPem(keys.privateKey)
- };
- }
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/forge'
- ], function(forge) {
- Tests(
- // Global provided by test harness
- ASSERT,
- forge
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/forge'));
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/util.js b/school/node_modules/node-forge/nodejs/test/util.js
deleted file mode 100644
index 57104a1..0000000
--- a/school/node_modules/node-forge/nodejs/test/util.js
+++ /dev/null
@@ -1,406 +0,0 @@
-(function() {
-
-function Tests(ASSERT, UTIL) {
- // custom assertion to test array-like objects
- function assertArrayEqual(actual, expected) {
- ASSERT.equal(actual.length, expected.length);
- for (var idx = 0; idx < expected.length; idx++) {
- ASSERT.equal(actual[idx], expected[idx]);
- }
- }
-
- describe('util', function() {
- it('should put bytes into a buffer', function() {
- var b = UTIL.createBuffer();
- b.putByte(1);
- b.putByte(2);
- b.putByte(3);
- b.putByte(4);
- b.putInt32(4);
- b.putByte(1);
- b.putByte(2);
- b.putByte(3);
- b.putInt32(4294967295);
- var hex = b.toHex();
- ASSERT.equal(hex, '0102030400000004010203ffffffff');
-
- var bytes = [];
- while(b.length() > 0) {
- bytes.push(b.getByte());
- }
- ASSERT.deepEqual(
- bytes, [1, 2, 3, 4, 0, 0, 0, 4, 1, 2, 3, 255, 255, 255, 255]);
- });
-
- it('should put bytes from an Uint8Array into a buffer', function() {
- if(typeof Uint8Array === 'undefined') {
- return;
- }
- var data = [1, 2, 3, 4, 0, 0, 0, 4, 1, 2, 3, 255, 255, 255, 255];
- var ab = new Uint8Array(data);
- var b = UTIL.createBuffer(ab);
- var hex = b.toHex();
- ASSERT.equal(hex, '0102030400000004010203ffffffff');
-
- var bytes = [];
- while(b.length() > 0) {
- bytes.push(b.getByte());
- }
- ASSERT.deepEqual(bytes, data);
- });
-
- it('should convert bytes from hex', function() {
- var hex = '0102030400000004010203ffffffff';
- var b = UTIL.createBuffer();
- b.putBytes(UTIL.hexToBytes(hex));
- ASSERT.equal(b.toHex(), hex);
- });
-
- it('should put 0 into a buffer using two\'s complement', function() {
- var b = UTIL.createBuffer();
- b.putSignedInt(0, 8);
- ASSERT.equal(b.toHex(), '00');
- });
-
- it('should put 0 into a buffer using two\'s complement w/2 bytes', function() {
- var b = UTIL.createBuffer();
- b.putSignedInt(0, 16);
- ASSERT.equal(b.toHex(), '0000');
- });
-
- it('should put 127 into a buffer using two\'s complement', function() {
- var b = UTIL.createBuffer();
- b.putSignedInt(127, 8);
- ASSERT.equal(b.toHex(), '7f');
- });
-
- it('should put 127 into a buffer using two\'s complement w/2 bytes', function() {
- var b = UTIL.createBuffer();
- b.putSignedInt(127, 16);
- ASSERT.equal(b.toHex(), '007f');
- });
-
- it('should put 128 into a buffer using two\'s complement', function() {
- var b = UTIL.createBuffer();
- b.putSignedInt(128, 16);
- ASSERT.equal(b.toHex(), '0080');
- });
-
- it('should put 256 into a buffer using two\'s complement', function() {
- var b = UTIL.createBuffer();
- b.putSignedInt(256, 16);
- ASSERT.equal(b.toHex(), '0100');
- });
-
- it('should put -128 into a buffer using two\'s complement', function() {
- var b = UTIL.createBuffer();
- b.putSignedInt(-128, 8);
- ASSERT.equal(b.toHex(), '80');
- });
-
- it('should put -129 into a buffer using two\'s complement', function() {
- var b = UTIL.createBuffer();
- b.putSignedInt(-129, 16);
- ASSERT.equal(b.toHex(), 'ff7f');
- });
-
- it('should get 0 from a buffer using two\'s complement', function() {
- var x = 0;
- var n = 8;
- var b = UTIL.createBuffer();
- b.putSignedInt(x, n);
- ASSERT.equal(b.getSignedInt(x, n), x);
- });
-
- it('should get 127 from a buffer using two\'s complement', function() {
- var x = 127;
- var n = 8;
- var b = UTIL.createBuffer();
- b.putSignedInt(x, n);
- ASSERT.equal(b.getSignedInt(n), x);
- });
-
- it('should get 128 from a buffer using two\'s complement', function() {
- var x = 128;
- var n = 16;
- var b = UTIL.createBuffer();
- b.putSignedInt(x, n);
- ASSERT.equal(b.getSignedInt(n), x);
- });
-
- it('should get 256 from a buffer using two\'s complement', function() {
- var x = 256;
- var n = 16;
- var b = UTIL.createBuffer();
- b.putSignedInt(x, n);
- ASSERT.equal(b.getSignedInt(n), x);
- });
-
- it('should get -128 from a buffer using two\'s complement', function() {
- var x = -128;
- var n = 8;
- var b = UTIL.createBuffer();
- b.putSignedInt(x, n);
- ASSERT.equal(b.getSignedInt(n), x);
- });
-
- it('should get -129 from a buffer using two\'s complement', function() {
- var x = -129;
- var n = 16;
- var b = UTIL.createBuffer();
- b.putSignedInt(x, n);
- ASSERT.equal(b.getSignedInt(n), x);
- });
-
- it('should base64 encode some bytes', function() {
- var s1 = '00010203050607080A0B0C0D0F1011121415161719';
- var s2 = 'MDAwMTAyMDMwNTA2MDcwODBBMEIwQzBEMEYxMDExMTIxNDE1MTYxNzE5';
- ASSERT.equal(UTIL.encode64(s1), s2);
- });
-
- it('should base64 decode some bytes', function() {
- var s1 = '00010203050607080A0B0C0D0F1011121415161719';
- var s2 = 'MDAwMTAyMDMwNTA2MDcwODBBMEIwQzBEMEYxMDExMTIxNDE1MTYxNzE5';
- ASSERT.equal(UTIL.decode64(s2), s1);
- });
-
- it('should base64 encode some bytes using util.binary.base64', function() {
- var s1 = new Uint8Array([
- 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30,
- 0x35, 0x30, 0x36, 0x30, 0x37, 0x30, 0x38, 0x30, 0x41,
- 0x30, 0x42, 0x30, 0x43, 0x30, 0x44, 0x30, 0x46, 0x31,
- 0x30, 0x31, 0x31, 0x31, 0x32, 0x31, 0x34, 0x31, 0x35,
- 0x31, 0x36, 0x31, 0x37, 0x31, 0x39]);
- var s2 = 'MDAwMTAyMDMwNTA2MDcwODBBMEIwQzBEMEYxMDExMTIxNDE1MTYxNzE5';
- ASSERT.equal(UTIL.binary.base64.encode(s1), s2);
- });
-
- it('should base64 encode some odd-length bytes using util.binary.base64', function() {
- var s1 = new Uint8Array([
- 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30,
- 0x35, 0x30, 0x36, 0x30, 0x37, 0x30, 0x38, 0x30, 0x41,
- 0x30, 0x42, 0x30, 0x43, 0x30, 0x44, 0x30, 0x46, 0x31,
- 0x30, 0x31, 0x31, 0x31, 0x32, 0x31, 0x34, 0x31, 0x35,
- 0x31, 0x36, 0x31, 0x37, 0x31, 0x39, 0x31, 0x41, 0x31,
- 0x42]);
- var s2 = 'MDAwMTAyMDMwNTA2MDcwODBBMEIwQzBEMEYxMDExMTIxNDE1MTYxNzE5MUExQg==';
- ASSERT.equal(UTIL.binary.base64.encode(s1), s2);
- });
-
- it('should base64 decode some bytes using util.binary.base64', function() {
- var s1 = new Uint8Array([
- 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30,
- 0x35, 0x30, 0x36, 0x30, 0x37, 0x30, 0x38, 0x30, 0x41,
- 0x30, 0x42, 0x30, 0x43, 0x30, 0x44, 0x30, 0x46, 0x31,
- 0x30, 0x31, 0x31, 0x31, 0x32, 0x31, 0x34, 0x31, 0x35,
- 0x31, 0x36, 0x31, 0x37, 0x31, 0x39]);
- var s2 = 'MDAwMTAyMDMwNTA2MDcwODBBMEIwQzBEMEYxMDExMTIxNDE1MTYxNzE5';
- ASSERT.deepEqual(UTIL.binary.base64.decode(s2), s1);
- });
-
- it('should base64 decode some odd-length bytes using util.binary.base64', function() {
- var s1 = new Uint8Array([
- 0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30,
- 0x35, 0x30, 0x36, 0x30, 0x37, 0x30, 0x38, 0x30, 0x41,
- 0x30, 0x42, 0x30, 0x43, 0x30, 0x44, 0x30, 0x46, 0x31,
- 0x30, 0x31, 0x31, 0x31, 0x32, 0x31, 0x34, 0x31, 0x35,
- 0x31, 0x36, 0x31, 0x37, 0x31, 0x39, 0x31, 0x41, 0x31,
- 0x42]);
- var s2 = 'MDAwMTAyMDMwNTA2MDcwODBBMEIwQzBEMEYxMDExMTIxNDE1MTYxNzE5MUExQg==';
- assertArrayEqual(UTIL.binary.base64.decode(s2), s1);
- });
-
- it('should convert IPv4 0.0.0.0 textual address to 4-byte address', function() {
- var bytes = UTIL.bytesFromIP('0.0.0.0');
- var b = UTIL.createBuffer().fillWithByte(0, 4);
- ASSERT.equal(bytes, b.getBytes());
- });
-
- it('should convert IPv4 127.0.0.1 textual address to 4-byte address', function() {
- var bytes = UTIL.bytesFromIP('127.0.0.1');
- var b = UTIL.createBuffer();
- b.putByte(127);
- b.putByte(0);
- b.putByte(0);
- b.putByte(1);
- ASSERT.equal(bytes, b.getBytes());
- });
-
- it('should convert IPv6 :: textual address to 16-byte address', function() {
- var bytes = UTIL.bytesFromIP('::');
- var b = UTIL.createBuffer().fillWithByte(0, 16);
- ASSERT.equal(bytes, b.getBytes());
- });
-
- it('should convert IPv6 ::0 textual address to 16-byte address', function() {
- var bytes = UTIL.bytesFromIP('::0');
- var b = UTIL.createBuffer().fillWithByte(0, 16);
- ASSERT.equal(bytes, b.getBytes());
- });
-
- it('should convert IPv6 0:: textual address to 16-byte address', function() {
- var bytes = UTIL.bytesFromIP('0::');
- var b = UTIL.createBuffer().fillWithByte(0, 16);
- ASSERT.equal(bytes, b.getBytes());
- });
-
- it('should convert IPv6 ::1 textual address to 16-byte address', function() {
- var bytes = UTIL.bytesFromIP('::1');
- var b = UTIL.createBuffer().fillWithByte(0, 14);
- b.putBytes(UTIL.hexToBytes('0001'));
- ASSERT.equal(bytes, b.getBytes());
- });
-
- it('should convert IPv6 1:: textual address to 16-byte address', function() {
- var bytes = UTIL.bytesFromIP('1::');
- var b = UTIL.createBuffer();
- b.putBytes(UTIL.hexToBytes('0001'));
- b.fillWithByte(0, 14);
- ASSERT.equal(bytes, b.getBytes());
- });
-
- it('should convert IPv6 1::1 textual address to 16-byte address', function() {
- var bytes = UTIL.bytesFromIP('1::1');
- var b = UTIL.createBuffer();
- b.putBytes(UTIL.hexToBytes('0001'));
- b.fillWithByte(0, 12);
- b.putBytes(UTIL.hexToBytes('0001'));
- ASSERT.equal(bytes, b.getBytes());
- });
-
- it('should convert IPv6 1::1:0 textual address to 16-byte address', function() {
- var bytes = UTIL.bytesFromIP('1::1:0');
- var b = UTIL.createBuffer();
- b.putBytes(UTIL.hexToBytes('0001'));
- b.fillWithByte(0, 10);
- b.putBytes(UTIL.hexToBytes('0001'));
- b.putBytes(UTIL.hexToBytes('0000'));
- ASSERT.equal(bytes, b.getBytes());
- });
-
- it('should convert IPv6 2001:db8:0:1:1:1:1:1 textual address to 16-byte address', function() {
- var bytes = UTIL.bytesFromIP('2001:db8:0:1:1:1:1:1');
- var b = UTIL.createBuffer();
- b.putBytes(UTIL.hexToBytes('2001'));
- b.putBytes(UTIL.hexToBytes('0db8'));
- b.putBytes(UTIL.hexToBytes('0000'));
- b.putBytes(UTIL.hexToBytes('0001'));
- b.putBytes(UTIL.hexToBytes('0001'));
- b.putBytes(UTIL.hexToBytes('0001'));
- b.putBytes(UTIL.hexToBytes('0001'));
- b.putBytes(UTIL.hexToBytes('0001'));
- ASSERT.equal(bytes, b.getBytes());
- });
-
- it('should convert IPv4 0.0.0.0 byte address to textual representation', function() {
- var addr = '0.0.0.0';
- var bytes = UTIL.createBuffer().fillWithByte(0, 4).getBytes();
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '0.0.0.0');
- });
-
- it('should convert IPv4 0.0.0.0 byte address to textual representation', function() {
- var addr = '127.0.0.1';
- var bytes = UTIL.bytesFromIP(addr);
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '127.0.0.1');
- });
-
- it('should convert IPv6 :: byte address to canonical textual representation (RFC 5952)', function() {
- var addr = '::';
- var bytes = UTIL.createBuffer().fillWithByte(0, 16).getBytes();
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '::');
- });
-
- it('should convert IPv6 ::1 byte address to canonical textual representation (RFC 5952)', function() {
- var addr = '::1';
- var bytes = UTIL.bytesFromIP(addr);
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '::1');
- });
-
- it('should convert IPv6 1:: byte address to canonical textual representation (RFC 5952)', function() {
- var addr = '1::';
- var bytes = UTIL.bytesFromIP(addr);
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '1::');
- });
-
- it('should convert IPv6 0:0:0:0:0:0:0:1 byte address to canonical textual representation (RFC 5952)', function() {
- var addr = '0:0:0:0:0:0:0:1';
- var bytes = UTIL.bytesFromIP(addr);
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '::1');
- });
-
- it('should convert IPv6 1:0:0:0:0:0:0:0 byte address to canonical textual representation (RFC 5952)', function() {
- var addr = '1:0:0:0:0:0:0:0';
- var bytes = UTIL.bytesFromIP(addr);
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '1::');
- });
-
- it('should convert IPv6 1::1 byte address to canonical textual representation (RFC 5952)', function() {
- var addr = '1::1';
- var bytes = UTIL.bytesFromIP(addr);
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '1::1');
- });
-
- it('should convert IPv6 1:0:0:0:0:0:0:1 byte address to canonical textual representation (RFC 5952)', function() {
- var addr = '1:0:0:0:0:0:0:1';
- var bytes = UTIL.bytesFromIP(addr);
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '1::1');
- });
-
- it('should convert IPv6 1:0000:0000:0000:0000:0000:0000:1 byte address to canonical textual representation (RFC 5952)', function() {
- var addr = '1:0000:0000:0000:0000:0000:0000:1';
- var bytes = UTIL.bytesFromIP(addr);
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '1::1');
- });
-
- it('should convert IPv6 1:0:0:1:1:1:0:1 byte address to canonical textual representation (RFC 5952)', function() {
- var addr = '1:0:0:1:1:1:0:1';
- var bytes = UTIL.bytesFromIP(addr);
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '1::1:1:1:0:1');
- });
-
- it('should convert IPv6 1:0:1:1:1:0:0:1 byte address to canonical textual representation (RFC 5952)', function() {
- var addr = '1:0:1:1:1:0:0:1';
- var bytes = UTIL.bytesFromIP(addr);
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '1:0:1:1:1::1');
- });
-
- it('should convert IPv6 2001:db8:0:1:1:1:1:1 byte address to canonical textual representation (RFC 5952)', function() {
- var addr = '2001:db8:0:1:1:1:1:1';
- var bytes = UTIL.bytesFromIP(addr);
- var addr = UTIL.bytesToIP(bytes);
- ASSERT.equal(addr, '2001:db8:0:1:1:1:1:1');
- });
- });
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/util'
- ], function(UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/util')());
-}
-
-})();
diff --git a/school/node_modules/node-forge/nodejs/test/x509.js b/school/node_modules/node-forge/nodejs/test/x509.js
deleted file mode 100644
index 47a9e7f..0000000
--- a/school/node_modules/node-forge/nodejs/test/x509.js
+++ /dev/null
@@ -1,734 +0,0 @@
-(function() {
-
-function Tests(ASSERT, PKI, MD, UTIL) {
- var _pem = {
- privateKey: '-----BEGIN RSA PRIVATE KEY-----\r\n' +
- 'MIICXQIBAAKBgQDL0EugUiNGMWscLAVM0VoMdhDZEJOqdsUMpx9U0YZI7szokJqQ\r\n' +
- 'NIwokiQ6EonNnWSMlIvy46AhnlRYn+ezeTeU7eMGTkP3VF29vXBo+dLq5e+8VyAy\r\n' +
- 'Q3FzM1wI4ts4hRACF8w6mqygXQ7i/SDu8/rXqRGtvnM+z0MYDdKo80efzwIDAQAB\r\n' +
- 'AoGAIzkGONi5G+JifmXlLJdplom486p3upf4Ce2/7mqfaG9MnkyPSairKD/JXvfh\r\n' +
- 'NNWkkN8DKKDKBcVVElPgORYT0qwrWc7ueLBMUCbRXb1ZyfEulimG0R3kjUh7NYau\r\n' +
- 'DaIkVgfykXGSQMZx8FoaT6L080zd+0emKDDYRrb+/kgJNJECQQDoUZoiC2K/DWNY\r\n' +
- 'h3/ppZ0ane2y4SBmJUHJVMPQ2CEgxsrJTxet668ckNCKaOP/3VFPoWC41f17DvKq\r\n' +
- 'noYINNntAkEA4JbZBZBVUrQFhHlrpXT4jzqtO2RlKZzEq8qmFZfEErxOT1WMyyCi\r\n' +
- 'lAQ5gUKardo1Kf0omC8Xq/uO9ZYdED55KwJBALs6cJ65UFaq4oLJiQPzLd7yokuE\r\n' +
- 'dcj8g71PLBTW6jPxIiMFNA89nz3FU9wIVp+xbMNhSoMMKqIPVPC+m0Rn260CQQDA\r\n' +
- 'I83fWK/mZWUjBM33a68KumRiH238v8XyQxj7+C8i6D8G2GXvkigFAehAkb7LZZd+\r\n' +
- 'KLuGFyPlWv3fVWHf99KpAkBQFKk3MRMl6IGJZUEFQe4l5whm8LkGU4acSqv9B3xt\r\n' +
- 'qROkCrsFrMPqjuuzEmyHoQZ64r2PLJg7FOuyhBnQUOt4\r\n' +
- '-----END RSA PRIVATE KEY-----\r\n',
- publicKey: '-----BEGIN PUBLIC KEY-----\r\n' +
- 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDL0EugUiNGMWscLAVM0VoMdhDZ\r\n' +
- 'EJOqdsUMpx9U0YZI7szokJqQNIwokiQ6EonNnWSMlIvy46AhnlRYn+ezeTeU7eMG\r\n' +
- 'TkP3VF29vXBo+dLq5e+8VyAyQ3FzM1wI4ts4hRACF8w6mqygXQ7i/SDu8/rXqRGt\r\n' +
- 'vnM+z0MYDdKo80efzwIDAQAB\r\n' +
- '-----END PUBLIC KEY-----\r\n',
- certificate: '-----BEGIN CERTIFICATE-----\r\n' +
- 'MIIDIjCCAougAwIBAgIJANE2aHSbwpaRMA0GCSqGSIb3DQEBBQUAMGoxCzAJBgNV\r\n' +
- 'BAYTAlVTMREwDwYDVQQIEwhWaXJnaW5pYTETMBEGA1UEBxMKQmxhY2tzYnVyZzEN\r\n' +
- 'MAsGA1UEChMEVGVzdDENMAsGA1UECxMEVGVzdDEVMBMGA1UEAxMMbXlzZXJ2ZXIu\r\n' +
- 'Y29tMB4XDTEwMDYxOTE3MzYyOFoXDTExMDYxOTE3MzYyOFowajELMAkGA1UEBhMC\r\n' +
- 'VVMxETAPBgNVBAgTCFZpcmdpbmlhMRMwEQYDVQQHEwpCbGFja3NidXJnMQ0wCwYD\r\n' +
- 'VQQKEwRUZXN0MQ0wCwYDVQQLEwRUZXN0MRUwEwYDVQQDEwxteXNlcnZlci5jb20w\r\n' +
- 'gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMvQS6BSI0YxaxwsBUzRWgx2ENkQ\r\n' +
- 'k6p2xQynH1TRhkjuzOiQmpA0jCiSJDoSic2dZIyUi/LjoCGeVFif57N5N5Tt4wZO\r\n' +
- 'Q/dUXb29cGj50url77xXIDJDcXMzXAji2ziFEAIXzDqarKBdDuL9IO7z+tepEa2+\r\n' +
- 'cz7PQxgN0qjzR5/PAgMBAAGjgc8wgcwwHQYDVR0OBBYEFPV1Y+DHXW6bA/r9sv1y\r\n' +
- 'NJ8jAwMAMIGcBgNVHSMEgZQwgZGAFPV1Y+DHXW6bA/r9sv1yNJ8jAwMAoW6kbDBq\r\n' +
- 'MQswCQYDVQQGEwJVUzERMA8GA1UECBMIVmlyZ2luaWExEzARBgNVBAcTCkJsYWNr\r\n' +
- 'c2J1cmcxDTALBgNVBAoTBFRlc3QxDTALBgNVBAsTBFRlc3QxFTATBgNVBAMTDG15\r\n' +
- 'c2VydmVyLmNvbYIJANE2aHSbwpaRMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEF\r\n' +
- 'BQADgYEARdH2KOlJWTC1CS2y/PAvg4uiM31PXMC1hqSdJlnLM1MY4hRfuf9VyTeX\r\n' +
- 'Y6FdybcyDLSxKn9id+g9229ci9/s9PI+QmD5vXd8yZyScLc2JkYB4GC6+9D1+/+x\r\n' +
- 's2hzMxuK6kzZlP+0l9LGcraMQPGRydjCARZZm4Uegln9rh85XFQ=\r\n' +
- '-----END CERTIFICATE-----\r\n'
- };
-
- describe('x509', function() {
- it('should convert certificate to/from PEM', function() {
- var certificate = PKI.certificateFromPem(_pem.certificate);
- ASSERT.equal(PKI.certificateToPem(certificate), _pem.certificate);
- });
-
- it('should verify self-signed certificate', function() {
- var certificate = PKI.certificateFromPem(_pem.certificate);
- ASSERT.ok(certificate.verify(certificate));
- });
-
- it('should generate and verify a self-signed certificate', function() {
- var keys = {
- privateKey: PKI.privateKeyFromPem(_pem.privateKey),
- publicKey: PKI.publicKeyFromPem(_pem.publicKey)
- };
- var attrs = [{
- name: 'commonName',
- value: 'example.org'
- }, {
- name: 'countryName',
- value: 'US'
- }, {
- shortName: 'ST',
- value: 'Virginia'
- }, {
- name: 'localityName',
- value: 'Blacksburg'
- }, {
- name: 'organizationName',
- value: 'Test'
- }, {
- shortName: 'OU',
- value: 'Test'
- }];
- var cert = createCertificate({
- publicKey: keys.publicKey,
- signingKey: keys.privateKey,
- serialNumber: '01',
- subject: attrs,
- issuer: attrs,
- isCA: true
- });
-
- var pem = PKI.certificateToPem(cert);
- cert = PKI.certificateFromPem(pem);
-
- // verify certificate chain
- var caStore = PKI.createCaStore();
- caStore.addCertificate(cert);
- PKI.verifyCertificateChain(caStore, [cert], function(vfd, depth, chain) {
- ASSERT.equal(vfd, true);
- ASSERT.ok(cert.verifySubjectKeyIdentifier());
- return true;
- });
- });
-
- it('should generate and fail to verify a self-signed certificate that is not in the CA store', function() {
- var keys = {
- privateKey: PKI.privateKeyFromPem(_pem.privateKey),
- publicKey: PKI.publicKeyFromPem(_pem.publicKey)
- };
- var attrs = [{
- name: 'commonName',
- value: 'example.org'
- }, {
- name: 'countryName',
- value: 'US'
- }, {
- shortName: 'ST',
- value: 'Virginia'
- }, {
- name: 'localityName',
- value: 'Blacksburg'
- }, {
- name: 'organizationName',
- value: 'Test'
- }, {
- shortName: 'OU',
- value: 'Test'
- }];
- var cert = createCertificate({
- publicKey: keys.publicKey,
- signingKey: keys.privateKey,
- serialNumber: '01',
- subject: attrs,
- issuer: attrs,
- isCA: true
- });
-
- var pem = PKI.certificateToPem(cert);
- cert = PKI.certificateFromPem(pem);
-
- // verify certificate chain
- var caStore = PKI.createCaStore();
- PKI.verifyCertificateChain(caStore, [cert], function(vfd, depth, chain) {
- ASSERT.equal(vfd, PKI.certificateError.unknown_ca);
- return true;
- });
- });
-
- it('should verify certificate chain ending with intermediate certificate from CA store', function() {
- var keys = {
- privateKey: PKI.privateKeyFromPem(_pem.privateKey),
- publicKey: PKI.publicKeyFromPem(_pem.publicKey)
- };
- var entity = [{
- name: 'commonName',
- value: 'example.org'
- }, {
- name: 'countryName',
- value: 'US'
- }, {
- shortName: 'ST',
- value: 'Virginia'
- }, {
- name: 'localityName',
- value: 'Blacksburg'
- }, {
- name: 'organizationName',
- value: 'Test'
- }, {
- shortName: 'OU',
- value: 'Test'
- }];
- var intermediate = [{
- name: 'commonName',
- value: 'intermediate'
- }, {
- name: 'countryName',
- value: 'US'
- }, {
- shortName: 'ST',
- value: 'Virginia'
- }, {
- name: 'localityName',
- value: 'Blacksburg'
- }, {
- name: 'organizationName',
- value: 'Test'
- }, {
- shortName: 'OU',
- value: 'Test'
- }];
- var root = [{
- name: 'commonName',
- value: 'root'
- }, {
- name: 'countryName',
- value: 'US'
- }, {
- shortName: 'ST',
- value: 'Virginia'
- }, {
- name: 'localityName',
- value: 'Blacksburg'
- }, {
- name: 'organizationName',
- value: 'Test'
- }, {
- shortName: 'OU',
- value: 'Test'
- }];
-
- var intermediateCert = createCertificate({
- publicKey: keys.publicKey,
- signingKey: keys.privateKey,
- serialNumber: '01',
- subject: intermediate,
- issuer: root,
- isCA: true
- });
-
- var entityCert = createCertificate({
- publicKey: keys.publicKey,
- signingKey: keys.privateKey,
- serialNumber: '01',
- subject: entity,
- issuer: intermediate,
- isCA: false
- });
-
- // verify certificate chain
- var caStore = PKI.createCaStore();
- caStore.addCertificate(intermediateCert);
- var chain = [entityCert, intermediateCert];
- PKI.verifyCertificateChain(caStore, chain, function(vfd, depth, chain) {
- ASSERT.equal(vfd, true);
- return true;
- });
- });
-
- it('should fail to verify certificate chain ending with non-CA intermediate certificate from CA store', function() {
- var keys = {
- privateKey: PKI.privateKeyFromPem(_pem.privateKey),
- publicKey: PKI.publicKeyFromPem(_pem.publicKey)
- };
- var entity = [{
- name: 'commonName',
- value: 'example.org'
- }, {
- name: 'countryName',
- value: 'US'
- }, {
- shortName: 'ST',
- value: 'Virginia'
- }, {
- name: 'localityName',
- value: 'Blacksburg'
- }, {
- name: 'organizationName',
- value: 'Test'
- }, {
- shortName: 'OU',
- value: 'Test'
- }];
- var intermediate = [{
- name: 'commonName',
- value: 'intermediate'
- }, {
- name: 'countryName',
- value: 'US'
- }, {
- shortName: 'ST',
- value: 'Virginia'
- }, {
- name: 'localityName',
- value: 'Blacksburg'
- }, {
- name: 'organizationName',
- value: 'Test'
- }, {
- shortName: 'OU',
- value: 'Test'
- }];
- var root = [{
- name: 'commonName',
- value: 'root'
- }, {
- name: 'countryName',
- value: 'US'
- }, {
- shortName: 'ST',
- value: 'Virginia'
- }, {
- name: 'localityName',
- value: 'Blacksburg'
- }, {
- name: 'organizationName',
- value: 'Test'
- }, {
- shortName: 'OU',
- value: 'Test'
- }];
-
- var intermediateCert = createCertificate({
- publicKey: keys.publicKey,
- signingKey: keys.privateKey,
- serialNumber: '01',
- subject: intermediate,
- issuer: root,
- isCA: false
- });
-
- var entityCert = createCertificate({
- publicKey: keys.publicKey,
- signingKey: keys.privateKey,
- serialNumber: '01',
- subject: entity,
- issuer: intermediate,
- isCA: false
- });
-
- // verify certificate chain
- var caStore = PKI.createCaStore();
- caStore.addCertificate(intermediateCert);
- var chain = [entityCert, intermediateCert];
- PKI.verifyCertificateChain(caStore, chain, function(vfd, depth, chain) {
- if(depth === 0) {
- ASSERT.equal(vfd, true);
- } else {
- ASSERT.equal(vfd, PKI.certificateError.bad_certificate);
- }
- return true;
- });
- });
-
- it('should verify certificate with sha1WithRSAEncryption signature', function() {
- var certPem = '-----BEGIN CERTIFICATE-----\r\n' +
- 'MIIDZDCCAs2gAwIBAgIKQ8fjjgAAAABh3jANBgkqhkiG9w0BAQUFADBGMQswCQYD\r\n' +
- 'VQQGEwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzEiMCAGA1UEAxMZR29vZ2xlIElu\r\n' +
- 'dGVybmV0IEF1dGhvcml0eTAeFw0xMjA2MjcxMzU5MTZaFw0xMzA2MDcxOTQzMjda\r\n' +
- 'MGcxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1N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z4fniisIWvXEyZ2VxVKfml\r\n' +
- 'UUIuOss4jHg7y/j7lYe8vJD5UDI=\r\n' +
- '-----END CERTIFICATE-----\r\n';
- var cert = PKI.certificateFromPem(certPem, true);
- var issuer = PKI.certificateFromPem(issuerPem);
- ASSERT.ok(issuer.verify(cert));
- });
-
- it('should verify certificate with sha256WithRSAEncryption signature', function() {
- var certPem = '-----BEGIN CERTIFICATE-----\r\n' +
- 'MIIDuzCCAqOgAwIBAgIEO5vZjDANBgkqhkiG9w0BAQsFADBGMQswCQYDVQQGEwJE\r\n' +
- 'RTEPMA0GA1UEChMGRWxzdGVyMQswCQYDVQQLEwJDQTEZMBcGA1UEAxMQRWxzdGVy\r\n' +
- 'U29mdFRlc3RDQTAeFw0xMDA5MTUwNTM4MjRaFw0xMzA5MTUwNTM4MjRaMCsxFDAS\r\n' +
- 'BgNVBAUTCzEwMDIzMTQ5OTRDMRMwEQYDVQQDEwoxMDAyMzE0OTk0MIGfMA0GCSqG\r\n' +
- 'SIb3DQEBAQUAA4GNADCBiQKBgQCLPqjbwjsugzw6+qwwm/pdzDwk7ASIsBYJ17GT\r\n' +
- 'qyT0zCnYmdDDGWsYc+xxFVVIi8xBt6Mlq8Rwj+02UJhY9qm6zRA9MqFZC3ih+HoW\r\n' +
- 'xq7H8N2d10N0rX6h5PSjkF5fU5ugncZmppsRGJ9DNXgwjpf/CsH2rqThUzK4xfrq\r\n' +
- 'jpDS/wIDAQABo4IBTjCCAUowDgYDVR0PAQH/BAQDAgUgMAwGA1UdEwEB/wQCMAAw\r\n' +
- 'HQYDVR0OBBYEFF1h7H37OQivS57GD8+nK6VsgMPTMIGXBgNVHR8EgY8wgYwwgYmg\r\n' +
- 'gYaggYOGgYBsZGFwOi8vMTkyLjE2OC42LjI0OjM4OS9sJTNkQ0ElMjBaZXJ0aWZp\r\n' +
- 'a2F0ZSxvdSUzZENBLGNuJTNkRWxzdGVyU29mdFRlc3RDQSxkYyUzZHdpZXNlbCxk\r\n' +
- 'Yy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' +
- 'ZdOCXzDkOfziKY/RzuUsLNFUhBizCIA0+XcKgm3dSA5ex8fChLJddSYheSLuPua7\r\n' +
- 'iNMuzaU2YnevbMwpdEsl55Qr/uzcc0YM/mCuM4vsNFyFml91SQyPPmdR3VvGOoGl\r\n' +
- 'qS1R0HSoPJUvr0N0kARwD7kO3ikcJ6FxBCsgVLZHGJC+q8PQNZmVMbfgjH4nAyP8\r\n' +
- 'u7Qe03v2WLW0UgKu2g0UcQXWXbovktpZoK0fUOwv3bqsZ0K1IjVvMKG8OysUvA==\r\n' +
- '-----END CERTIFICATE-----\r\n';
- var cert = PKI.certificateFromPem(certPem, true);
- var issuer = PKI.certificateFromPem(issuerPem);
- ASSERT.ok(issuer.verify(cert));
- });
-
- it('should import certificate with sha256 RSASSA-PSS signature', function() {
- var certPem = '-----BEGIN CERTIFICATE-----\r\n' +
- 'MIIERzCCAvugAwIBAgIEO50CcjBBBgkqhkiG9w0BAQowNKAPMA0GCWCGSAFlAwQC\r\n' +
- 'AQUAoRwwGgYJKoZIhvcNAQEIMA0GCWCGSAFlAwQCAQUAogMCASAwRjELMAkGA1UE\r\n' +
- 'BhMCREUxDzANBgNVBAoTBkVsc3RlcjELMAkGA1UECxMCQ0ExGTAXBgNVBAMTEEVs\r\n' +
- 'c3RlclNvZnRUZXN0Q0EwHhcNMTEwNzI4MTIxMzU3WhcNMTQwNzI4MTIxMzU3WjAr\r\n' +
- 'MRQwEgYDVQQFEwsxMDAyNzUzMzI1QzETMBEGA1UEAxMKMTAwMjc1MzMyNTCCASIw\r\n' +
- 'DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALHCogo7LVUkxWsMIc/0jgH2PCLt\r\n' +
- 'ukbATPehxWBG1XUPrz53lWgFJzlZaKLlLVVnXrfULaifuOKlZP6SM1JQlL1JuYgY\r\n' +
- 'AdgZyHjderNIk5NsSTmefwonSn/ukri5IRTH420oHtSjxk6+/DXlWnQy5OzTN6Bq\r\n' +
- 'jVJo8L+TTmf2jW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gplMsTJnUwRfi2hf5KNtP8Xg5DSLMfTEbhw==\r\n' +
- '-----END CERTIFICATE-----\r\n';
- var cert = PKI.certificateFromPem(certPem, true);
-
- ASSERT.equal(cert.signatureOid, PKI.oids['RSASSA-PSS']);
- ASSERT.equal(cert.signatureParameters.hash.algorithmOid, PKI.oids['sha256']);
- ASSERT.equal(cert.signatureParameters.mgf.algorithmOid, PKI.oids['mgf1']);
- ASSERT.equal(cert.signatureParameters.mgf.hash.algorithmOid, PKI.oids['sha256']);
- ASSERT.equal(cert.siginfo.algorithmOid, PKI.oids['RSASSA-PSS']);
- ASSERT.equal(cert.siginfo.parameters.hash.algorithmOid, PKI.oids['sha256']);
- ASSERT.equal(cert.siginfo.parameters.mgf.algorithmOid, PKI.oids['mgf1']);
- ASSERT.equal(cert.siginfo.parameters.mgf.hash.algorithmOid, PKI.oids['sha256']);
- });
-
- it('should export certificate with sha256 RSASSA-PSS signature', function() {
- var certPem = '-----BEGIN CERTIFICATE-----\r\n' +
- 'MIIERzCCAvugAwIBAgIEO50CcjBBBgkqhkiG9w0BAQowNKAPMA0GCWCGSAFlAwQC\r\n' +
- 'AQUAoRwwGgYJKoZIhvcNAQEIMA0GCWCGSAFlAwQCAQUAogMCASAwRjELMAkGA1UE\r\n' +
- 'BhMCREUxDzANBgNVBAoTBkVsc3RlcjELMAkGA1UECxMCQ0ExGTAXBgNVBAMTEEVs\r\n' +
- 'c3RlclNvZnRUZXN0Q0EwHhcNMTEwNzI4MTIxMzU3WhcNMTQwNzI4MTIxMzU3WjAr\r\n' +
- 'MRQwEgYDVQQFEwsxMDAyNzUzMzI1QzETMBEGA1UEAxMKMTAwMjc1MzMyNTCCASIw\r\n' +
- 'DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALHCogo7LVUkxWsMIc/0jgH2PCLt\r\n' +
- 'ukbATPehxWBG1XUPrz53lWgFJzlZaKLlLVVnXrfULaifuOKlZP6SM1JQlL1JuYgY\r\n' +
- 'AdgZyHjderNIk5N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agguTbwfTqt9nt0wDlwZpemsJZ4Vvnvy8d9Jf\r\n' +
- 'zA68EWHbZLr2QP9hb3sHCWJgplMsTJnUwRfi2hf5KNtP8Xg5DSLMfTEbhw==\r\n' +
- '-----END CERTIFICATE-----\r\n';
- var cert = PKI.certificateFromPem(certPem, true);
- ASSERT.equal(PKI.certificateToPem(cert), certPem);
- });
-
- it('should verify certificate with sha256 RSASSA-PSS signature', function() {
- var certPem = '-----BEGIN CERTIFICATE-----\r\n' +
- 'MIIERzCCAvugAwIBAgIEO50CcjBBBgkqhkiG9w0BAQowNKAPMA0GCWCGSAFlAwQC\r\n' +
- 'AQUAoRwwGgYJKoZIhvcNAQEIMA0GCWCGSAFlAwQCAQUAogMCASAwRjELMAkGA1UE\r\n' +
- 'BhMCREUxDzANBgNVBAoTBkVsc3RlcjELMAkGA1UECxMCQ0ExGTAXBgNVBAMTEEVs\r\n' +
- 'c3RlclNvZnRUZXN0Q0EwHhcNMTEwNzI4MTIxMzU3WhcNMTQwNzI4MTIxMzU3WjAr\r\n' +
- 'MRQwEgYDVQQFEwsxMDAyNzUzMzI1QzETMBEGA1UEAxMKMTAwMjc1MzMyNTCCASIw\r\n' +
- 'DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALHCogo7LVUkxWsMIc/0jgH2PCLt\r\n' +
- 'ukbATPehxWBG1XUPrz53lWgFJzlZaKLlLVVnXrfULaifuOKlZP6SM1JQlL1JuYgY\r\n' +
- 'AdgZyHjderNIk5NsSTmefwonSn/ukri5IRTH420oHtSjxk6+/DXlWnQy5OzTN6Bq\r\n' +
- 'jVJo8L+TTmf2jWuEam5cWa+YVP2k3tIqX5yMUDFjKO4znHdtIkHnBE0Kx03rWQRB\r\n' +
- 'TSYWDgDm2gttdOs9JVeuW0nnwQj27uo9gOR0iyaUjVrKLZ95p6zpXhM4uMSVRNeo\r\n' +
- 'LqkdqP2n+4pDXZVqLNgjkHQUS/xq9Q/kYgT2J7wkGfYxP9to7TG7vra1eOECAwEA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xMGUm9v\r\n' +
- 'dENBMRUwEwYDVQQDEwxFbHN0ZXJSb290Q0GCBDuaylowQQYJKoZIhvcNAQEKMDSg\r\n' +
- 'DzANBglghkgBZQMEAgEFAKEcMBoGCSqGSIb3DQEBCDANBglghkgBZQMEAgEFAKID\r\n' +
- 'AgEgA4IBAQBjT107fBmSfQNUYCpXIlaS/pogPoCahuC1g8QDtq6IEVXoEgXCzfVN\r\n' +
- 'JYHyYOQOraP4O2LEcXpo/oc0MMpVF06QLKG/KieUE0mrZnsCJ3GLSJkM8tI8bRHj\r\n' +
- '8tAhlViMacUqnKKufCs/rIN25JB57+sCyFqjtRbSt88e+xqFJ5I79Btp/bNtoj2G\r\n' +
- 'OJGl997EPua9/yJuvdA9W67WO/KwEh+FqylB1pAapccOHqttwu4QJIc/XJfG5rrf\r\n' +
- '8QZz8HIuOcroA4zIrprQ1nJRCuMII04ueDtBVz1eIEmqNEUkr09JdK8M0LKH0lMK\r\n' +
- 'Ysgjai/P2mPVVwhVw6dHzUVRLXh3xIQr\r\n' +
- '-----END CERTIFICATE-----\r\n';
- var cert = PKI.certificateFromPem(certPem, true);
- var issuer = PKI.certificateFromPem(issuerPem);
- ASSERT.ok(issuer.verify(cert));
- });
- });
-
- describe('public key fingerprints', function() {
- it('should get a SHA-1 RSAPublicKey fingerprint', function() {
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var fp = PKI.getPublicKeyFingerprint(publicKey, {type: 'RSAPublicKey'});
- ASSERT.equal(fp.toHex(), 'f57563e0c75d6e9b03fafdb2fd72349f23030300');
- });
-
- it('should get a SHA-1 SubjectPublicKeyInfo fingerprint', function() {
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var fp = PKI.getPublicKeyFingerprint(
- publicKey, {type: 'SubjectPublicKeyInfo'});
- ASSERT.equal(fp.toHex(), '984724bc548bbc2c8acbac044bd8d518abd26dd8');
- });
-
- it('should get a hex SHA-1 RSAPublicKey fingerprint', function() {
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var fp = PKI.getPublicKeyFingerprint(
- publicKey, {type: 'RSAPublicKey', encoding: 'hex'});
- ASSERT.equal(fp, 'f57563e0c75d6e9b03fafdb2fd72349f23030300');
- });
-
- it('should get a hex, colon-delimited SHA-1 RSAPublicKey fingerprint', function() {
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var fp = PKI.getPublicKeyFingerprint(
- publicKey, {type: 'RSAPublicKey', encoding: 'hex', delimiter: ':'});
- ASSERT.equal(
- fp, 'f5:75:63:e0:c7:5d:6e:9b:03:fa:fd:b2:fd:72:34:9f:23:03:03:00');
- });
-
- it('should get a hex, colon-delimited SHA-1 SubjectPublicKeyInfo fingerprint', function() {
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var fp = PKI.getPublicKeyFingerprint(
- publicKey, {
- type: 'SubjectPublicKeyInfo',
- encoding: 'hex',
- delimiter: ':'
- });
- ASSERT.equal(
- fp, '98:47:24:bc:54:8b:bc:2c:8a:cb:ac:04:4b:d8:d5:18:ab:d2:6d:d8');
- });
-
- it('should get an MD5 RSAPublicKey fingerprint', function() {
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var fp = PKI.getPublicKeyFingerprint(
- publicKey, {md: MD.md5.create(), type: 'RSAPublicKey'});
- ASSERT.equal(fp.toHex(), 'c7da180cc48d31a071d31a78bc43d9d7');
- });
-
- it('should get an MD5 SubjectPublicKeyInfo fingerprint', function() {
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var fp = PKI.getPublicKeyFingerprint(
- publicKey, {md: MD.md5.create(), type: 'SubjectPublicKeyInfo'});
- ASSERT.equal(fp.toHex(), 'e5c5ba577fe24fb8a678d8d58f539cd7');
- });
-
- it('should get a hex MD5 RSAPublicKey fingerprint', function() {
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var fp = PKI.getPublicKeyFingerprint(
- publicKey,
- {md: MD.md5.create(), type: 'RSAPublicKey', encoding: 'hex'});
- ASSERT.equal(fp, 'c7da180cc48d31a071d31a78bc43d9d7');
- });
-
- it('should get a hex, colon-delimited MD5 RSAPublicKey fingerprint', function() {
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var fp = PKI.getPublicKeyFingerprint(
- publicKey, {
- md: MD.md5.create(),
- type: 'RSAPublicKey',
- encoding: 'hex',
- delimiter: ':'
- });
- ASSERT.equal(fp, 'c7:da:18:0c:c4:8d:31:a0:71:d3:1a:78:bc:43:d9:d7');
- });
-
- it('should get a hex, colon-delimited MD5 SubjectPublicKeyInfo fingerprint', function() {
- var publicKey = PKI.publicKeyFromPem(_pem.publicKey);
- var fp = PKI.getPublicKeyFingerprint(
- publicKey, {
- md: MD.md5.create(),
- type: 'SubjectPublicKeyInfo',
- encoding: 'hex',
- delimiter: ':'
- });
- ASSERT.equal(fp, 'e5:c5:ba:57:7f:e2:4f:b8:a6:78:d8:d5:8f:53:9c:d7');
- });
- });
-
- function createCertificate(options) {
- var publicKey = options.publicKey;
- var signingKey = options.signingKey;
- var subject = options.subject;
- var issuer = options.issuer;
- var isCA = options.isCA;
- var serialNumber = options.serialNumber || '01';
-
- var cert = PKI.createCertificate();
- cert.publicKey = publicKey;
- cert.serialNumber = serialNumber;
- cert.validity.notBefore = new Date();
- cert.validity.notAfter = new Date();
- cert.validity.notAfter.setFullYear(
- cert.validity.notBefore.getFullYear() + 1);
- cert.setSubject(subject);
- cert.setIssuer(issuer);
- var extensions = [];
- if(isCA) {
- extensions.push({
- name: 'basicConstraints',
- cA: true
- });
- }
- extensions.push({
- name: 'keyUsage',
- keyCertSign: true,
- digitalSignature: true,
- nonRepudiation: true,
- keyEncipherment: true,
- dataEncipherment: true
- }, {
- name: 'extKeyUsage',
- serverAuth: true,
- clientAuth: true,
- codeSigning: true,
- emailProtection: true,
- timeStamping: true
- }, {
- name: 'nsCertType',
- client: true,
- server: true,
- email: true,
- objsign: true,
- sslCA: true,
- emailCA: true,
- objCA: true
- }, {
- name: 'subjectAltName',
- altNames: [{
- type: 6, // URI
- value: 'http://example.org/webid#me'
- }]
- }, {
- name: 'subjectKeyIdentifier'
- });
- // FIXME: add authorityKeyIdentifier extension
- cert.setExtensions(extensions);
-
- cert.sign(signingKey);
-
- return cert;
- }
-}
-
-// check for AMD
-if(typeof define === 'function') {
- define([
- 'forge/pki',
- 'forge/md',
- 'forge/util'
- ], function(PKI, MD, UTIL) {
- Tests(
- // Global provided by test harness
- ASSERT,
- PKI(),
- MD(),
- UTIL()
- );
- });
-} else if(typeof module === 'object' && module.exports) {
- // assume NodeJS
- Tests(
- require('assert'),
- require('../../js/pki')(),
- require('../../js/md')(),
- require('../../js/util')());
-}
-
-})();