bdy 1.23.6-dev → 1.23.7-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/distTs/package.json +10 -2
- package/distTs/src/agent/linux.js +53 -3
- package/distTs/src/agent/manager.js +3 -6
- package/distTs/src/agent/osx.js +51 -3
- package/distTs/src/agent/system.js +400 -21
- package/distTs/src/agent/windows.js +4 -7
- package/distTs/src/command/agent/debug.js +2 -2
- package/distTs/src/command/agent/install.js +37 -10
- package/distTs/src/command/agent/restart.js +2 -2
- package/distTs/src/command/agent/run.js +3 -0
- package/distTs/src/command/agent/start.js +2 -2
- package/distTs/src/command/agent/status.js +19 -0
- package/distTs/src/command/agent/stop.js +2 -2
- package/distTs/src/command/agent/uninstall.js +5 -8
- package/distTs/src/command/agent/update.js +2 -2
- package/distTs/src/command/artifact/publish.js +3 -1
- package/distTs/src/command/version.js +13 -5
- package/distTs/src/logger.js +40 -4
- package/distTs/src/texts.js +35 -19
- package/distTs/src/utils.js +98 -3
- package/node_modules/asn1/Jenkinsfile +65 -0
- package/node_modules/asn1/LICENSE +19 -0
- package/node_modules/asn1/README.md +50 -0
- package/node_modules/asn1/lib/ber/errors.js +13 -0
- package/node_modules/asn1/lib/ber/index.js +27 -0
- package/node_modules/asn1/lib/ber/reader.js +262 -0
- package/node_modules/asn1/lib/ber/types.js +36 -0
- package/node_modules/asn1/lib/ber/writer.js +317 -0
- package/node_modules/asn1/lib/index.js +20 -0
- package/node_modules/asn1/package.json +31 -0
- package/node_modules/bcrypt-pbkdf/CONTRIBUTING.md +13 -0
- package/node_modules/bcrypt-pbkdf/LICENSE +66 -0
- package/node_modules/bcrypt-pbkdf/README.md +45 -0
- package/node_modules/bcrypt-pbkdf/index.js +556 -0
- package/node_modules/bcrypt-pbkdf/package.json +15 -0
- package/node_modules/safer-buffer/LICENSE +21 -0
- package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/node_modules/safer-buffer/Readme.md +156 -0
- package/node_modules/safer-buffer/dangerous.js +58 -0
- package/node_modules/safer-buffer/package.json +34 -0
- package/node_modules/safer-buffer/safer.js +77 -0
- package/node_modules/safer-buffer/tests.js +406 -0
- package/node_modules/ssh2/.eslintignore +4 -0
- package/node_modules/ssh2/.eslintrc.js +5 -0
- package/node_modules/ssh2/.github/workflows/ci.yml +110 -0
- package/node_modules/ssh2/.github/workflows/lint.yml +27 -0
- package/node_modules/ssh2/LICENSE +19 -0
- package/node_modules/ssh2/README.md +1529 -0
- package/node_modules/ssh2/SFTP.md +413 -0
- package/node_modules/ssh2/examples/server-chat.js +238 -0
- package/node_modules/ssh2/examples/sftp-server-download-only.js +134 -0
- package/node_modules/ssh2/install.js +27 -0
- package/node_modules/ssh2/lib/Channel.js +295 -0
- package/node_modules/ssh2/lib/agent.js +1123 -0
- package/node_modules/ssh2/lib/client.js +2176 -0
- package/node_modules/ssh2/lib/http-agents.js +84 -0
- package/node_modules/ssh2/lib/index.js +44 -0
- package/node_modules/ssh2/lib/keygen.js +582 -0
- package/node_modules/ssh2/lib/protocol/Protocol.js +2136 -0
- package/node_modules/ssh2/lib/protocol/SFTP.js +4052 -0
- package/node_modules/ssh2/lib/protocol/constants.js +356 -0
- package/node_modules/ssh2/lib/protocol/crypto/binding.gyp +23 -0
- package/node_modules/ssh2/lib/protocol/crypto/poly1305.js +43 -0
- package/node_modules/ssh2/lib/protocol/crypto/src/binding.cc +2300 -0
- package/node_modules/ssh2/lib/protocol/crypto.js +1602 -0
- package/node_modules/ssh2/lib/protocol/handlers.js +16 -0
- package/node_modules/ssh2/lib/protocol/handlers.misc.js +1285 -0
- package/node_modules/ssh2/lib/protocol/kex.js +1908 -0
- package/node_modules/ssh2/lib/protocol/keyParser.js +1484 -0
- package/node_modules/ssh2/lib/protocol/node-fs-compat.js +115 -0
- package/node_modules/ssh2/lib/protocol/utils.js +356 -0
- package/node_modules/ssh2/lib/protocol/zlib.js +255 -0
- package/node_modules/ssh2/lib/server.js +1380 -0
- package/node_modules/ssh2/lib/utils.js +336 -0
- package/node_modules/ssh2/package.json +49 -0
- package/node_modules/ssh2/test/common.js +316 -0
- package/node_modules/ssh2/test/fixtures/bad_rsa_private_key +26 -0
- package/node_modules/ssh2/test/fixtures/https_cert.pem +33 -0
- package/node_modules/ssh2/test/fixtures/https_key.pem +52 -0
- package/node_modules/ssh2/test/fixtures/id_dsa +12 -0
- package/node_modules/ssh2/test/fixtures/id_ecdsa +5 -0
- package/node_modules/ssh2/test/fixtures/id_rsa +15 -0
- package/node_modules/ssh2/test/fixtures/id_rsa.ppk +26 -0
- package/node_modules/ssh2/test/fixtures/id_rsa_enc +30 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa +21 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc +22 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm +23 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa +9 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc +10 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm +10 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519 +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa +27 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc +28 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm +29 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa +12 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc +15 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa +5 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa +27 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc +30 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub.result +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256 +54 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub +1 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub.result +6 -0
- package/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.result +6 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc +17 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa +26 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc +18 -0
- package/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub +9 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub +10 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub +11 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub +11 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub +8 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub +13 -0
- package/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub.result +7 -0
- package/node_modules/ssh2/test/fixtures/openssh_new_rsa +27 -0
- package/node_modules/ssh2/test/fixtures/ssh_host_dsa_key +12 -0
- package/node_modules/ssh2/test/fixtures/ssh_host_ecdsa_key +5 -0
- package/node_modules/ssh2/test/fixtures/ssh_host_rsa_key +15 -0
- package/node_modules/ssh2/test/test-exec.js +578 -0
- package/node_modules/ssh2/test/test-integration-openssh.js +486 -0
- package/node_modules/ssh2/test/test-keygen.js +60 -0
- package/node_modules/ssh2/test/test-misc-client-server.js +1460 -0
- package/node_modules/ssh2/test/test-openssh.js +261 -0
- package/node_modules/ssh2/test/test-protocol-crypto.js +631 -0
- package/node_modules/ssh2/test/test-protocol-keyparser.js +177 -0
- package/node_modules/ssh2/test/test-server-hostkeys.js +138 -0
- package/node_modules/ssh2/test/test-sftp.js +842 -0
- package/node_modules/ssh2/test/test-shell.js +109 -0
- package/node_modules/ssh2/test/test-userauth-agent-openssh.js +110 -0
- package/node_modules/ssh2/test/test-userauth-agent.js +171 -0
- package/node_modules/ssh2/test/test-userauth.js +611 -0
- package/node_modules/ssh2/test/test-worker-imports.js +25 -0
- package/node_modules/ssh2/test/test.js +20 -0
- package/node_modules/ssh2/util/build_pagent.bat +2 -0
- package/node_modules/ssh2/util/pagent.c +88 -0
- package/node_modules/ssh2/util/pagent.exe +0 -0
- package/node_modules/tweetnacl/.npmignore +4 -0
- package/node_modules/tweetnacl/AUTHORS.md +28 -0
- package/node_modules/tweetnacl/CHANGELOG.md +221 -0
- package/node_modules/tweetnacl/LICENSE +24 -0
- package/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md +20 -0
- package/node_modules/tweetnacl/README.md +459 -0
- package/node_modules/tweetnacl/nacl-fast.js +2388 -0
- package/node_modules/tweetnacl/nacl-fast.min.js +2 -0
- package/node_modules/tweetnacl/nacl.d.ts +98 -0
- package/node_modules/tweetnacl/nacl.js +1175 -0
- package/node_modules/tweetnacl/nacl.min.js +1 -0
- package/node_modules/tweetnacl/package.json +58 -0
- package/package.json +10 -2
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('assert');
|
|
4
|
+
const { randomBytes } = require('crypto');
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
CIPHER_INFO,
|
|
8
|
+
MAC_INFO,
|
|
9
|
+
bindingAvailable,
|
|
10
|
+
NullCipher,
|
|
11
|
+
createCipher,
|
|
12
|
+
NullDecipher,
|
|
13
|
+
createDecipher,
|
|
14
|
+
init: cryptoInit,
|
|
15
|
+
} = require('../lib/protocol/crypto.js');
|
|
16
|
+
|
|
17
|
+
(async () => {
|
|
18
|
+
await cryptoInit;
|
|
19
|
+
|
|
20
|
+
console.log(`Crypto binding ${bindingAvailable ? '' : 'not '}available`);
|
|
21
|
+
{
|
|
22
|
+
const PAIRS = [
|
|
23
|
+
// cipher, decipher
|
|
24
|
+
['native', 'native'],
|
|
25
|
+
['binding', 'native'],
|
|
26
|
+
['native', 'binding'],
|
|
27
|
+
['binding', 'binding'],
|
|
28
|
+
].slice(0, bindingAvailable ? 4 : 1);
|
|
29
|
+
|
|
30
|
+
[
|
|
31
|
+
{ cipher: null },
|
|
32
|
+
{ cipher: 'chacha20-poly1305@openssh.com' },
|
|
33
|
+
{ cipher: 'aes128-gcm@openssh.com' },
|
|
34
|
+
{ cipher: 'aes128-cbc', mac: 'hmac-sha1-etm@openssh.com' },
|
|
35
|
+
{ cipher: 'aes128-ctr', mac: 'hmac-sha1' },
|
|
36
|
+
{ cipher: 'arcfour', mac: 'hmac-sha2-256-96' },
|
|
37
|
+
].forEach((testConfig) => {
|
|
38
|
+
for (const pair of PAIRS) {
|
|
39
|
+
function onCipherData(data) {
|
|
40
|
+
ciphered = Buffer.concat([ciphered, data]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function onDecipherPayload(payload) {
|
|
44
|
+
deciphered.push(payload);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function reset() {
|
|
48
|
+
ciphered = Buffer.alloc(0);
|
|
49
|
+
deciphered = [];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function reinit() {
|
|
53
|
+
if (testConfig.cipher === null) {
|
|
54
|
+
cipher = new NullCipher(1, onCipherData);
|
|
55
|
+
decipher = new NullDecipher(1, onDecipherPayload);
|
|
56
|
+
} else {
|
|
57
|
+
cipher = createCipher(config);
|
|
58
|
+
decipher = createDecipher(config);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let ciphered;
|
|
63
|
+
let deciphered;
|
|
64
|
+
let cipher;
|
|
65
|
+
let decipher;
|
|
66
|
+
let macSize;
|
|
67
|
+
let packet;
|
|
68
|
+
let payload;
|
|
69
|
+
let cipherInfo;
|
|
70
|
+
let config;
|
|
71
|
+
|
|
72
|
+
console.log('Testing cipher: %s, mac: %s (%s encrypt, %s decrypt) ...',
|
|
73
|
+
testConfig.cipher,
|
|
74
|
+
testConfig.mac
|
|
75
|
+
|| (testConfig.cipher === null ? '<none>' : '<implicit>'),
|
|
76
|
+
pair[0],
|
|
77
|
+
pair[1]);
|
|
78
|
+
|
|
79
|
+
if (testConfig.cipher === null) {
|
|
80
|
+
cipher = new NullCipher(1, onCipherData);
|
|
81
|
+
decipher = new NullDecipher(1, onDecipherPayload);
|
|
82
|
+
macSize = 0;
|
|
83
|
+
} else {
|
|
84
|
+
cipherInfo = CIPHER_INFO[testConfig.cipher];
|
|
85
|
+
let macInfo;
|
|
86
|
+
let macKey;
|
|
87
|
+
if (testConfig.mac) {
|
|
88
|
+
macInfo = MAC_INFO[testConfig.mac];
|
|
89
|
+
macKey = randomBytes(macInfo.len);
|
|
90
|
+
macSize = macInfo.actualLen;
|
|
91
|
+
} else if (cipherInfo.authLen) {
|
|
92
|
+
macSize = cipherInfo.authLen;
|
|
93
|
+
} else {
|
|
94
|
+
throw new Error('Missing MAC for cipher');
|
|
95
|
+
}
|
|
96
|
+
const key = randomBytes(cipherInfo.keyLen);
|
|
97
|
+
const iv = (cipherInfo.ivLen
|
|
98
|
+
? randomBytes(cipherInfo.ivLen)
|
|
99
|
+
: Buffer.alloc(0));
|
|
100
|
+
config = {
|
|
101
|
+
outbound: {
|
|
102
|
+
onWrite: onCipherData,
|
|
103
|
+
cipherInfo,
|
|
104
|
+
cipherKey: Buffer.from(key),
|
|
105
|
+
cipherIV: Buffer.from(iv),
|
|
106
|
+
seqno: 1,
|
|
107
|
+
macInfo,
|
|
108
|
+
macKey: (macKey && Buffer.from(macKey)),
|
|
109
|
+
forceNative: (pair[0] === 'native'),
|
|
110
|
+
},
|
|
111
|
+
inbound: {
|
|
112
|
+
onPayload: onDecipherPayload,
|
|
113
|
+
decipherInfo: cipherInfo,
|
|
114
|
+
decipherKey: Buffer.from(key),
|
|
115
|
+
decipherIV: Buffer.from(iv),
|
|
116
|
+
seqno: 1,
|
|
117
|
+
macInfo,
|
|
118
|
+
macKey: (macKey && Buffer.from(macKey)),
|
|
119
|
+
forceNative: (pair[1] === 'native'),
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
try {
|
|
123
|
+
cipher = createCipher(config);
|
|
124
|
+
} catch (ex) {
|
|
125
|
+
if (ex.code === 'ERR_OSSL_EVP_UNSUPPORTED'
|
|
126
|
+
|| /unsupported/i.test(ex.message)) {
|
|
127
|
+
console.log(
|
|
128
|
+
' ... skipping because cipher is unsupported by OpenSSL'
|
|
129
|
+
);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
throw ex;
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
decipher = createDecipher(config);
|
|
136
|
+
} catch (ex) {
|
|
137
|
+
if (ex.code === 'ERR_OSSL_EVP_UNSUPPORTED'
|
|
138
|
+
|| /unsupported/i.test(ex.message)) {
|
|
139
|
+
console.log(
|
|
140
|
+
' ... skipping because cipher is unsupported by OpenSSL'
|
|
141
|
+
);
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
throw ex;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (pair[0] === 'binding')
|
|
148
|
+
assert(/binding/i.test(cipher.constructor.name));
|
|
149
|
+
else
|
|
150
|
+
assert(/native/i.test(cipher.constructor.name));
|
|
151
|
+
if (pair[1] === 'binding')
|
|
152
|
+
assert(/binding/i.test(decipher.constructor.name));
|
|
153
|
+
else
|
|
154
|
+
assert(/native/i.test(decipher.constructor.name));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
let expectedSeqno;
|
|
158
|
+
// Test zero-length payload ============================================
|
|
159
|
+
payload = Buffer.alloc(0);
|
|
160
|
+
expectedSeqno = 2;
|
|
161
|
+
|
|
162
|
+
reset();
|
|
163
|
+
packet = cipher.allocPacket(payload.length);
|
|
164
|
+
payload.copy(packet, 5);
|
|
165
|
+
cipher.encrypt(packet);
|
|
166
|
+
assert.strictEqual(decipher.decrypt(ciphered, 0, ciphered.length),
|
|
167
|
+
undefined);
|
|
168
|
+
|
|
169
|
+
assert.strictEqual(cipher.outSeqno, expectedSeqno);
|
|
170
|
+
assert(ciphered.length >= 9 + macSize);
|
|
171
|
+
assert.strictEqual(decipher.inSeqno, cipher.outSeqno);
|
|
172
|
+
assert.strictEqual(deciphered.length, 1);
|
|
173
|
+
assert.deepStrictEqual(deciphered[0], payload);
|
|
174
|
+
|
|
175
|
+
// Test single byte payload ============================================
|
|
176
|
+
payload = Buffer.from([ 0xEF ]);
|
|
177
|
+
expectedSeqno = 3;
|
|
178
|
+
|
|
179
|
+
reset();
|
|
180
|
+
packet = cipher.allocPacket(payload.length);
|
|
181
|
+
payload.copy(packet, 5);
|
|
182
|
+
cipher.encrypt(packet);
|
|
183
|
+
assert.strictEqual(decipher.decrypt(ciphered, 0, ciphered.length),
|
|
184
|
+
undefined);
|
|
185
|
+
|
|
186
|
+
assert.strictEqual(cipher.outSeqno, 3);
|
|
187
|
+
assert(ciphered.length >= 9 + macSize);
|
|
188
|
+
assert.strictEqual(decipher.inSeqno, cipher.outSeqno);
|
|
189
|
+
assert.strictEqual(deciphered.length, 1);
|
|
190
|
+
assert.deepStrictEqual(deciphered[0], payload);
|
|
191
|
+
|
|
192
|
+
// Test large payload ==================================================
|
|
193
|
+
payload = randomBytes(32 * 1024);
|
|
194
|
+
expectedSeqno = 4;
|
|
195
|
+
|
|
196
|
+
reset();
|
|
197
|
+
packet = cipher.allocPacket(payload.length);
|
|
198
|
+
payload.copy(packet, 5);
|
|
199
|
+
cipher.encrypt(packet);
|
|
200
|
+
assert.strictEqual(decipher.decrypt(ciphered, 0, ciphered.length),
|
|
201
|
+
undefined);
|
|
202
|
+
|
|
203
|
+
assert.strictEqual(cipher.outSeqno, expectedSeqno);
|
|
204
|
+
assert(ciphered.length >= 9 + macSize);
|
|
205
|
+
assert.strictEqual(decipher.inSeqno, cipher.outSeqno);
|
|
206
|
+
assert.strictEqual(deciphered.length, 1);
|
|
207
|
+
assert.deepStrictEqual(deciphered[0], payload);
|
|
208
|
+
|
|
209
|
+
// Test sequnce number rollover ========================================
|
|
210
|
+
payload = randomBytes(4);
|
|
211
|
+
expectedSeqno = 0;
|
|
212
|
+
cipher.outSeqno = decipher.inSeqno = (2 ** 32) - 1;
|
|
213
|
+
|
|
214
|
+
reset();
|
|
215
|
+
packet = cipher.allocPacket(payload.length);
|
|
216
|
+
payload.copy(packet, 5);
|
|
217
|
+
cipher.encrypt(packet);
|
|
218
|
+
assert.strictEqual(decipher.decrypt(ciphered, 0, ciphered.length),
|
|
219
|
+
undefined);
|
|
220
|
+
|
|
221
|
+
assert.strictEqual(cipher.outSeqno, expectedSeqno);
|
|
222
|
+
assert(ciphered.length >= 9 + macSize);
|
|
223
|
+
assert.strictEqual(decipher.inSeqno, cipher.outSeqno);
|
|
224
|
+
assert.strictEqual(deciphered.length, 1);
|
|
225
|
+
assert.deepStrictEqual(deciphered[0], payload);
|
|
226
|
+
|
|
227
|
+
// Test chunked input -- split length bytes ============================
|
|
228
|
+
payload = randomBytes(32 * 768);
|
|
229
|
+
expectedSeqno = 1;
|
|
230
|
+
|
|
231
|
+
reset();
|
|
232
|
+
packet = cipher.allocPacket(payload.length);
|
|
233
|
+
payload.copy(packet, 5);
|
|
234
|
+
cipher.encrypt(packet);
|
|
235
|
+
assert.strictEqual(decipher.decrypt(ciphered, 0, 2), undefined);
|
|
236
|
+
assert.strictEqual(decipher.decrypt(ciphered, 2, ciphered.length),
|
|
237
|
+
undefined);
|
|
238
|
+
|
|
239
|
+
assert.strictEqual(cipher.outSeqno, expectedSeqno);
|
|
240
|
+
assert(ciphered.length >= 9 + macSize);
|
|
241
|
+
assert.strictEqual(decipher.inSeqno, cipher.outSeqno);
|
|
242
|
+
assert.strictEqual(deciphered.length, 1);
|
|
243
|
+
assert.deepStrictEqual(deciphered[0], payload);
|
|
244
|
+
|
|
245
|
+
// Test chunked input -- split length from payload =====================
|
|
246
|
+
payload = randomBytes(32 * 768);
|
|
247
|
+
expectedSeqno = 2;
|
|
248
|
+
|
|
249
|
+
reset();
|
|
250
|
+
packet = cipher.allocPacket(payload.length);
|
|
251
|
+
payload.copy(packet, 5);
|
|
252
|
+
cipher.encrypt(packet);
|
|
253
|
+
assert.strictEqual(decipher.decrypt(ciphered, 0, 4), undefined);
|
|
254
|
+
assert.strictEqual(decipher.decrypt(ciphered, 4, ciphered.length),
|
|
255
|
+
undefined);
|
|
256
|
+
|
|
257
|
+
assert.strictEqual(cipher.outSeqno, expectedSeqno);
|
|
258
|
+
assert(ciphered.length >= 9 + macSize);
|
|
259
|
+
assert.strictEqual(decipher.inSeqno, cipher.outSeqno);
|
|
260
|
+
assert.strictEqual(deciphered.length, 1);
|
|
261
|
+
assert.deepStrictEqual(deciphered[0], payload);
|
|
262
|
+
|
|
263
|
+
// Test chunked input -- split length and payload from MAC =============
|
|
264
|
+
payload = randomBytes(32 * 768);
|
|
265
|
+
expectedSeqno = 3;
|
|
266
|
+
|
|
267
|
+
reset();
|
|
268
|
+
packet = cipher.allocPacket(payload.length);
|
|
269
|
+
payload.copy(packet, 5);
|
|
270
|
+
cipher.encrypt(packet);
|
|
271
|
+
assert.strictEqual(
|
|
272
|
+
decipher.decrypt(ciphered, 0, ciphered.length - macSize),
|
|
273
|
+
undefined
|
|
274
|
+
);
|
|
275
|
+
assert.strictEqual(
|
|
276
|
+
decipher.decrypt(ciphered,
|
|
277
|
+
ciphered.length - macSize,
|
|
278
|
+
ciphered.length),
|
|
279
|
+
undefined
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
assert.strictEqual(cipher.outSeqno, expectedSeqno);
|
|
283
|
+
assert(ciphered.length >= 9 + macSize);
|
|
284
|
+
assert.strictEqual(decipher.inSeqno, cipher.outSeqno);
|
|
285
|
+
assert.strictEqual(deciphered.length, 1);
|
|
286
|
+
assert.deepStrictEqual(deciphered[0], payload);
|
|
287
|
+
|
|
288
|
+
// Test packet length checks ===========================================
|
|
289
|
+
[0, 2 ** 32 - 1].forEach((n) => {
|
|
290
|
+
reset();
|
|
291
|
+
packet = cipher.allocPacket(0);
|
|
292
|
+
packet.writeUInt32BE(n, 0); // Overwrite packet length field
|
|
293
|
+
cipher.encrypt(packet);
|
|
294
|
+
let threw = false;
|
|
295
|
+
try {
|
|
296
|
+
decipher.decrypt(ciphered, 0, ciphered.length);
|
|
297
|
+
} catch (ex) {
|
|
298
|
+
threw = true;
|
|
299
|
+
assert(ex instanceof Error);
|
|
300
|
+
assert(/packet length/i.test(ex.message));
|
|
301
|
+
}
|
|
302
|
+
if (!threw)
|
|
303
|
+
throw new Error('Expected error');
|
|
304
|
+
|
|
305
|
+
// Recreate deciphers since errors leave them in an unusable state.
|
|
306
|
+
// We recreate the ciphers as well so that internal states of both
|
|
307
|
+
// ends match again.
|
|
308
|
+
reinit();
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
// Test minimum padding length check ===================================
|
|
312
|
+
if (testConfig.cipher !== null) {
|
|
313
|
+
let payloadLen;
|
|
314
|
+
const blockLen = cipherInfo.blockLen;
|
|
315
|
+
if (/chacha|gcm/i.test(testConfig.cipher)
|
|
316
|
+
|| /etm/i.test(testConfig.mac)) {
|
|
317
|
+
payloadLen = blockLen - 2;
|
|
318
|
+
} else {
|
|
319
|
+
payloadLen = blockLen - 6;
|
|
320
|
+
}
|
|
321
|
+
const minLen = 4 + 1 + payloadLen + (blockLen + 1);
|
|
322
|
+
// We don't do strict equality checks here since the length of the
|
|
323
|
+
// returned Buffer can vary due to implementation details.
|
|
324
|
+
assert(cipher.allocPacket(payloadLen).length >= minLen);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// =====================================================================
|
|
328
|
+
cipher.free();
|
|
329
|
+
decipher.free();
|
|
330
|
+
if (testConfig.cipher === null)
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// Test createCipher()/createDecipher() exceptions
|
|
337
|
+
{
|
|
338
|
+
[
|
|
339
|
+
[
|
|
340
|
+
[true, null],
|
|
341
|
+
/invalid config/i
|
|
342
|
+
],
|
|
343
|
+
[
|
|
344
|
+
[{}],
|
|
345
|
+
[/invalid outbound/i, /invalid inbound/i]
|
|
346
|
+
],
|
|
347
|
+
[
|
|
348
|
+
[{ outbound: {}, inbound: {} }],
|
|
349
|
+
[/invalid outbound\.onWrite/i, /invalid inbound\.onPayload/i]
|
|
350
|
+
],
|
|
351
|
+
[
|
|
352
|
+
[
|
|
353
|
+
{ outbound: {
|
|
354
|
+
onWrite: () => {},
|
|
355
|
+
cipherInfo: true
|
|
356
|
+
},
|
|
357
|
+
inbound: {
|
|
358
|
+
onPayload: () => {},
|
|
359
|
+
decipherInfo: true
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
{ outbound: {
|
|
363
|
+
onWrite: () => {},
|
|
364
|
+
cipherInfo: null
|
|
365
|
+
},
|
|
366
|
+
inbound: {
|
|
367
|
+
onPayload: () => {},
|
|
368
|
+
decipherInfo: null
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
],
|
|
372
|
+
[/invalid outbound\.cipherInfo/i, /invalid inbound\.decipherInfo/i]
|
|
373
|
+
],
|
|
374
|
+
[
|
|
375
|
+
[
|
|
376
|
+
{ outbound: {
|
|
377
|
+
onWrite: () => {},
|
|
378
|
+
cipherInfo: {},
|
|
379
|
+
cipherKey: {},
|
|
380
|
+
},
|
|
381
|
+
inbound: {
|
|
382
|
+
onPayload: () => {},
|
|
383
|
+
decipherInfo: {},
|
|
384
|
+
decipherKey: {},
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
{ outbound: {
|
|
388
|
+
onWrite: () => {},
|
|
389
|
+
cipherInfo: { keyLen: 32 },
|
|
390
|
+
cipherKey: Buffer.alloc(8),
|
|
391
|
+
},
|
|
392
|
+
inbound: {
|
|
393
|
+
onPayload: () => {},
|
|
394
|
+
decipherInfo: { keyLen: 32 },
|
|
395
|
+
decipherKey: Buffer.alloc(8),
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
],
|
|
399
|
+
[/invalid outbound\.cipherKey/i, /invalid inbound\.decipherKey/i]
|
|
400
|
+
],
|
|
401
|
+
[
|
|
402
|
+
[
|
|
403
|
+
{ outbound: {
|
|
404
|
+
onWrite: () => {},
|
|
405
|
+
cipherInfo: { keyLen: 1, ivLen: 12 },
|
|
406
|
+
cipherKey: Buffer.alloc(1),
|
|
407
|
+
cipherIV: true
|
|
408
|
+
},
|
|
409
|
+
inbound: {
|
|
410
|
+
onPayload: () => {},
|
|
411
|
+
decipherInfo: { keyLen: 1, ivLen: 12 },
|
|
412
|
+
decipherKey: Buffer.alloc(1),
|
|
413
|
+
cipherIV: true
|
|
414
|
+
},
|
|
415
|
+
},
|
|
416
|
+
{ outbound: {
|
|
417
|
+
onWrite: () => {},
|
|
418
|
+
cipherInfo: { keyLen: 1, ivLen: 12 },
|
|
419
|
+
cipherKey: Buffer.alloc(1),
|
|
420
|
+
cipherIV: null
|
|
421
|
+
},
|
|
422
|
+
inbound: {
|
|
423
|
+
onPayload: () => {},
|
|
424
|
+
decipherInfo: { keyLen: 1, ivLen: 12 },
|
|
425
|
+
decipherKey: Buffer.alloc(1),
|
|
426
|
+
cipherIV: null
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
{ outbound: {
|
|
430
|
+
onWrite: () => {},
|
|
431
|
+
cipherInfo: { keyLen: 1, ivLen: 12 },
|
|
432
|
+
cipherKey: Buffer.alloc(1),
|
|
433
|
+
cipherIV: {}
|
|
434
|
+
},
|
|
435
|
+
inbound: {
|
|
436
|
+
onPayload: () => {},
|
|
437
|
+
decipherInfo: { keyLen: 1, ivLen: 12 },
|
|
438
|
+
decipherKey: Buffer.alloc(1),
|
|
439
|
+
cipherIV: {}
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
{ outbound: {
|
|
443
|
+
onWrite: () => {},
|
|
444
|
+
cipherInfo: { keyLen: 1, ivLen: 12 },
|
|
445
|
+
cipherKey: Buffer.alloc(1),
|
|
446
|
+
cipherIV: Buffer.alloc(1)
|
|
447
|
+
},
|
|
448
|
+
inbound: {
|
|
449
|
+
onPayload: () => {},
|
|
450
|
+
decipherInfo: { keyLen: 1, ivLen: 12 },
|
|
451
|
+
decipherKey: Buffer.alloc(1),
|
|
452
|
+
cipherIV: Buffer.alloc(1)
|
|
453
|
+
},
|
|
454
|
+
},
|
|
455
|
+
],
|
|
456
|
+
[/invalid outbound\.cipherIV/i, /invalid inbound\.decipherIV/i]
|
|
457
|
+
],
|
|
458
|
+
[
|
|
459
|
+
[
|
|
460
|
+
{ outbound: {
|
|
461
|
+
onWrite: () => {},
|
|
462
|
+
cipherInfo: { keyLen: 1, ivLen: 0 },
|
|
463
|
+
cipherKey: Buffer.alloc(1),
|
|
464
|
+
seqno: true
|
|
465
|
+
},
|
|
466
|
+
inbound: {
|
|
467
|
+
onPayload: () => {},
|
|
468
|
+
decipherInfo: { keyLen: 1, ivLen: 0 },
|
|
469
|
+
decipherKey: Buffer.alloc(1),
|
|
470
|
+
seqno: true
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
{ outbound: {
|
|
474
|
+
onWrite: () => {},
|
|
475
|
+
cipherInfo: { keyLen: 1, ivLen: 0 },
|
|
476
|
+
cipherKey: Buffer.alloc(1),
|
|
477
|
+
seqno: -1
|
|
478
|
+
},
|
|
479
|
+
inbound: {
|
|
480
|
+
onPayload: () => {},
|
|
481
|
+
decipherInfo: { keyLen: 1, ivLen: 0 },
|
|
482
|
+
decipherKey: Buffer.alloc(1),
|
|
483
|
+
seqno: -1
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
{ outbound: {
|
|
487
|
+
onWrite: () => {},
|
|
488
|
+
cipherInfo: { keyLen: 1, ivLen: 0 },
|
|
489
|
+
cipherKey: Buffer.alloc(1),
|
|
490
|
+
seqno: 2 ** 32
|
|
491
|
+
},
|
|
492
|
+
inbound: {
|
|
493
|
+
onPayload: () => {},
|
|
494
|
+
decipherInfo: { keyLen: 1, ivLen: 0 },
|
|
495
|
+
decipherKey: Buffer.alloc(1),
|
|
496
|
+
seqno: 2 ** 32
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
],
|
|
500
|
+
[/invalid outbound\.seqno/i, /invalid inbound\.seqno/i]
|
|
501
|
+
],
|
|
502
|
+
[
|
|
503
|
+
[
|
|
504
|
+
{ outbound: {
|
|
505
|
+
onWrite: () => {},
|
|
506
|
+
cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
507
|
+
cipherKey: Buffer.alloc(1),
|
|
508
|
+
seqno: 0
|
|
509
|
+
},
|
|
510
|
+
inbound: {
|
|
511
|
+
onPayload: () => {},
|
|
512
|
+
decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
513
|
+
decipherKey: Buffer.alloc(1),
|
|
514
|
+
seqno: 0
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
{ outbound: {
|
|
518
|
+
onWrite: () => {},
|
|
519
|
+
cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
520
|
+
cipherKey: Buffer.alloc(1),
|
|
521
|
+
seqno: 0,
|
|
522
|
+
macInfo: true
|
|
523
|
+
},
|
|
524
|
+
inbound: {
|
|
525
|
+
onPayload: () => {},
|
|
526
|
+
decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
527
|
+
decipherKey: Buffer.alloc(1),
|
|
528
|
+
seqno: 0,
|
|
529
|
+
macInfo: true
|
|
530
|
+
},
|
|
531
|
+
},
|
|
532
|
+
{ outbound: {
|
|
533
|
+
onWrite: () => {},
|
|
534
|
+
cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
535
|
+
cipherKey: Buffer.alloc(1),
|
|
536
|
+
seqno: 0,
|
|
537
|
+
macInfo: null
|
|
538
|
+
},
|
|
539
|
+
inbound: {
|
|
540
|
+
onPayload: () => {},
|
|
541
|
+
decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
542
|
+
decipherKey: Buffer.alloc(1),
|
|
543
|
+
seqno: 0,
|
|
544
|
+
macInfo: null
|
|
545
|
+
},
|
|
546
|
+
},
|
|
547
|
+
],
|
|
548
|
+
[/invalid outbound\.macInfo/i, /invalid inbound\.macInfo/i]
|
|
549
|
+
],
|
|
550
|
+
[
|
|
551
|
+
[
|
|
552
|
+
{ outbound: {
|
|
553
|
+
onWrite: () => {},
|
|
554
|
+
cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
555
|
+
cipherKey: Buffer.alloc(1),
|
|
556
|
+
seqno: 0,
|
|
557
|
+
macInfo: { keyLen: 16 }
|
|
558
|
+
},
|
|
559
|
+
inbound: {
|
|
560
|
+
onPayload: () => {},
|
|
561
|
+
decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
562
|
+
decipherKey: Buffer.alloc(1),
|
|
563
|
+
seqno: 0,
|
|
564
|
+
macInfo: { keyLen: 16 }
|
|
565
|
+
},
|
|
566
|
+
},
|
|
567
|
+
{ outbound: {
|
|
568
|
+
onWrite: () => {},
|
|
569
|
+
cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
570
|
+
cipherKey: Buffer.alloc(1),
|
|
571
|
+
seqno: 0,
|
|
572
|
+
macInfo: { keyLen: 16 },
|
|
573
|
+
macKey: true
|
|
574
|
+
},
|
|
575
|
+
inbound: {
|
|
576
|
+
onPayload: () => {},
|
|
577
|
+
decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
578
|
+
decipherKey: Buffer.alloc(1),
|
|
579
|
+
seqno: 0,
|
|
580
|
+
macInfo: { keyLen: 16 },
|
|
581
|
+
macKey: true
|
|
582
|
+
},
|
|
583
|
+
},
|
|
584
|
+
{ outbound: {
|
|
585
|
+
onWrite: () => {},
|
|
586
|
+
cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
587
|
+
cipherKey: Buffer.alloc(1),
|
|
588
|
+
seqno: 0,
|
|
589
|
+
macInfo: { keyLen: 16 },
|
|
590
|
+
macKey: null
|
|
591
|
+
},
|
|
592
|
+
inbound: {
|
|
593
|
+
onPayload: () => {},
|
|
594
|
+
decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
595
|
+
decipherKey: Buffer.alloc(1),
|
|
596
|
+
seqno: 0,
|
|
597
|
+
macInfo: { keyLen: 16 },
|
|
598
|
+
macKey: null
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
{ outbound: {
|
|
602
|
+
onWrite: () => {},
|
|
603
|
+
cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
604
|
+
cipherKey: Buffer.alloc(1),
|
|
605
|
+
seqno: 0,
|
|
606
|
+
macInfo: { keyLen: 16 },
|
|
607
|
+
macKey: Buffer.alloc(1)
|
|
608
|
+
},
|
|
609
|
+
inbound: {
|
|
610
|
+
onPayload: () => {},
|
|
611
|
+
decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' },
|
|
612
|
+
decipherKey: Buffer.alloc(1),
|
|
613
|
+
seqno: 0,
|
|
614
|
+
macInfo: { keyLen: 16 },
|
|
615
|
+
macKey: Buffer.alloc(1)
|
|
616
|
+
},
|
|
617
|
+
},
|
|
618
|
+
],
|
|
619
|
+
[/invalid outbound\.macKey/i, /invalid inbound\.macKey/i]
|
|
620
|
+
],
|
|
621
|
+
].forEach((testCase) => {
|
|
622
|
+
let errorChecks = testCase[1];
|
|
623
|
+
if (!Array.isArray(errorChecks))
|
|
624
|
+
errorChecks = [errorChecks[0], errorChecks[0]];
|
|
625
|
+
for (const input of testCase[0]) {
|
|
626
|
+
assert.throws(() => createCipher(input), errorChecks[0]);
|
|
627
|
+
assert.throws(() => createDecipher(input), errorChecks[1]);
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
})();
|