dsh-remote 0.8.45 → 0.8.47
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/LICENSE +21 -21
- package/README.en.md +361 -361
- package/README.md +368 -368
- package/cordis.patch.yml +9 -9
- package/lib/binding.js +172 -172
- package/lib/client.js +3637 -3623
- package/lib/credential.js +177 -177
- package/lib/deploy-tasks.js +142 -142
- package/lib/errors.js +87 -87
- package/lib/file-reference.js +457 -457
- package/lib/forwards.js +258 -258
- package/lib/hostkey.js +108 -108
- package/lib/http-transport.js +196 -196
- package/lib/ignore.js +156 -156
- package/lib/index.js +3771 -3747
- package/lib/openssh.js +838 -838
- package/lib/paths.js +225 -225
- package/lib/pool.js +757 -754
- package/lib/registry.js +95 -95
- package/lib/remote-fs.js +148 -143
- package/lib/routes-fs.js +233 -233
- package/lib/search.js +230 -230
- package/lib/sftp-surface.js +76 -76
- package/lib/sshconfig.js +454 -454
- package/lib/sync.js +275 -275
- package/lib/tasks.js +95 -95
- package/lib/telemetry.js +213 -213
- package/lib/update.js +472 -472
- package/lib/web-attach.js +850 -846
- package/lib/web-deploy-skill.js +205 -205
- package/lib/web-deploy.js +694 -694
- 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/buildcheck/.eslintrc.js +5 -0
- package/node_modules/buildcheck/.github/workflows/ci.yml +88 -0
- package/node_modules/buildcheck/.github/workflows/lint.yml +27 -0
- package/node_modules/buildcheck/.npmignore +3 -0
- package/node_modules/buildcheck/LICENSE +19 -0
- package/node_modules/buildcheck/README.md +106 -0
- package/node_modules/buildcheck/deps/Find-VisualStudio.cs +250 -0
- package/node_modules/buildcheck/lib/findvs.js +361 -0
- package/node_modules/buildcheck/lib/index.js +738 -0
- package/node_modules/buildcheck/package.json +36 -0
- package/node_modules/buildcheck/test/test.js +8 -0
- package/node_modules/cpu-features/.eslintrc.js +5 -0
- package/node_modules/cpu-features/.github/workflows/ci.yml +74 -0
- package/node_modules/cpu-features/.github/workflows/lint.yml +27 -0
- package/node_modules/cpu-features/LICENSE +19 -0
- package/node_modules/cpu-features/README.md +59 -0
- package/node_modules/cpu-features/binding.gyp +16 -0
- package/node_modules/cpu-features/buildcheck.js +32 -0
- package/node_modules/cpu-features/deps/cpu_features/.clang-format +4 -0
- package/node_modules/cpu-features/deps/cpu_features/.dockerignore +31 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/Dockerfile +5 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/aarch64_linux_cmake.yml +30 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_freebsd_cmake.yml +22 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_linux_bazel.yml +26 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_linux_cmake.yml +31 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_macos_cmake.yml +43 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_windows_cmake.yml +25 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/arm_linux_cmake.yml +31 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/clang_format.yml +24 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/mips_linux_cmake.yml +30 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/power_linux_cmake.yml +29 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/riscv_linux_cmake.yml +28 -0
- package/node_modules/cpu-features/deps/cpu_features/.github/workflows/s390x_linux_cmake.yml +27 -0
- package/node_modules/cpu-features/deps/cpu_features/.grenrc.yml +21 -0
- package/node_modules/cpu-features/deps/cpu_features/BUILD.bazel +329 -0
- package/node_modules/cpu-features/deps/cpu_features/CMakeLists.txt +261 -0
- package/node_modules/cpu-features/deps/cpu_features/CONTRIBUTING.md +23 -0
- package/node_modules/cpu-features/deps/cpu_features/LICENSE +230 -0
- package/node_modules/cpu-features/deps/cpu_features/README.md +272 -0
- package/node_modules/cpu-features/deps/cpu_features/WORKSPACE +19 -0
- package/node_modules/cpu-features/deps/cpu_features/bazel/ci/README.md +5 -0
- package/node_modules/cpu-features/deps/cpu_features/bazel/platforms.bzl +11 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesConfig.cmake.in +3 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesNdkCompatConfig.cmake.in +3 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/README.md +30 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/Makefile +252 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/README.md +40 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.dot +64 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.svg +312 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/generate_image.sh +7 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/amd64/Dockerfile +48 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/toolchain/Dockerfile +34 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/CMakeLists.txt +22 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/main.cpp +11 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/ci/vagrant/freebsd/Vagrantfile +107 -0
- package/node_modules/cpu-features/deps/cpu_features/cmake/googletest.CMakeLists.txt.in +15 -0
- package/node_modules/cpu-features/deps/cpu_features/cpu_features.gyp +105 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpu_features_cache_info.h +54 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpu_features_macros.h +384 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_aarch64.h +259 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h +121 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_mips.h +74 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_ppc.h +149 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_riscv.h +72 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_s390x.h +108 -0
- package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_x86.h +288 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/bit_utils.h +40 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/cpuid_x86.h +37 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/filesystem.h +39 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/hwcaps.h +240 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/stack_line_reader.h +49 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/string_view.h +110 -0
- package/node_modules/cpu-features/deps/cpu_features/include/internal/windows_utils.h +70 -0
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/CMakeLists.txt +60 -0
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/README.md +4 -0
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.c +205 -0
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.h +320 -0
- package/node_modules/cpu-features/deps/cpu_features/ndk_compat/ndk-compat-test.c +12 -0
- package/node_modules/cpu-features/deps/cpu_features/patches/0001-Add-Apple-Silicon-Support.patch +456 -0
- package/node_modules/cpu-features/deps/cpu_features/scripts/generate_badges.d +165 -0
- package/node_modules/cpu-features/deps/cpu_features/scripts/make_release.sh +75 -0
- package/node_modules/cpu-features/deps/cpu_features/scripts/run_integration.sh +490 -0
- package/node_modules/cpu-features/deps/cpu_features/scripts/test_integration.sh +79 -0
- package/node_modules/cpu-features/deps/cpu_features/src/copy.inl +19 -0
- package/node_modules/cpu-features/deps/cpu_features/src/define_introspection.inl +86 -0
- package/node_modules/cpu-features/deps/cpu_features/src/define_introspection_and_hwcaps.inl +26 -0
- package/node_modules/cpu-features/deps/cpu_features/src/equals.inl +22 -0
- package/node_modules/cpu-features/deps/cpu_features/src/filesystem.c +62 -0
- package/node_modules/cpu-features/deps/cpu_features/src/hwcaps.c +169 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64__base_implementation.inl +88 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_linux_or_android.c +79 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.c +82 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_windows.c +138 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_arm_linux_or_android.c +212 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_mips_linux_or_android.c +93 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_ppc_linux.c +163 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_riscv_linux.c +111 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_s390x_linux.c +120 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86__base_implementation.inl +2055 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_freebsd.c +68 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_linux_or_android.c +58 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_macos.c +57 -0
- package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_windows.c +58 -0
- package/node_modules/cpu-features/deps/cpu_features/src/stack_line_reader.c +132 -0
- package/node_modules/cpu-features/deps/cpu_features/src/string_view.c +192 -0
- package/node_modules/cpu-features/deps/cpu_features/src/utils/list_cpu_features.c +461 -0
- package/node_modules/cpu-features/deps/cpu_features/test/CMakeLists.txt +114 -0
- package/node_modules/cpu-features/deps/cpu_features/test/bit_utils_test.cc +53 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_aarch64_test.cc +396 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_arm_test.cc +384 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_mips_test.cc +176 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_ppc_test.cc +131 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_riscv_test.cc +180 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_s390x_test.cc +82 -0
- package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_x86_test.cc +1729 -0
- package/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.cc +103 -0
- package/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.h +61 -0
- package/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.cc +52 -0
- package/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.h +31 -0
- package/node_modules/cpu-features/deps/cpu_features/test/stack_line_reader_test.cc +132 -0
- package/node_modules/cpu-features/deps/cpu_features/test/string_view_test.cc +202 -0
- package/node_modules/cpu-features/lib/index.js +5 -0
- package/node_modules/cpu-features/package.json +40 -0
- package/node_modules/cpu-features/src/binding.cc +151 -0
- package/node_modules/cpu-features/test/test.js +12 -0
- package/node_modules/nan/.github/workflows/ci.yml +46 -0
- package/node_modules/nan/.pre-commit-config.yaml +8 -0
- package/node_modules/nan/CHANGELOG.md +605 -0
- package/node_modules/nan/CMakeLists.txt +138 -0
- package/node_modules/nan/LICENSE.md +9 -0
- package/node_modules/nan/README.md +457 -0
- package/node_modules/nan/doc/asyncworker.md +146 -0
- package/node_modules/nan/doc/buffers.md +54 -0
- package/node_modules/nan/doc/callback.md +76 -0
- package/node_modules/nan/doc/converters.md +41 -0
- package/node_modules/nan/doc/errors.md +226 -0
- package/node_modules/nan/doc/json.md +62 -0
- package/node_modules/nan/doc/maybe_types.md +583 -0
- package/node_modules/nan/doc/methods.md +689 -0
- package/node_modules/nan/doc/new.md +147 -0
- package/node_modules/nan/doc/node_misc.md +123 -0
- package/node_modules/nan/doc/object_wrappers.md +263 -0
- package/node_modules/nan/doc/persistent.md +296 -0
- package/node_modules/nan/doc/scopes.md +73 -0
- package/node_modules/nan/doc/script.md +58 -0
- package/node_modules/nan/doc/string_bytes.md +81 -0
- package/node_modules/nan/doc/v8_internals.md +211 -0
- package/node_modules/nan/doc/v8_misc.md +85 -0
- package/node_modules/nan/include_dirs.js +1 -0
- package/node_modules/nan/nan.h +3202 -0
- package/node_modules/nan/nan_callbacks.h +141 -0
- package/node_modules/nan/nan_callbacks_12_inl.h +730 -0
- package/node_modules/nan/nan_callbacks_pre_12_inl.h +528 -0
- package/node_modules/nan/nan_converters.h +72 -0
- package/node_modules/nan/nan_converters_43_inl.h +68 -0
- package/node_modules/nan/nan_converters_pre_43_inl.h +42 -0
- package/node_modules/nan/nan_define_own_property_helper.h +29 -0
- package/node_modules/nan/nan_implementation_12_inl.h +446 -0
- package/node_modules/nan/nan_implementation_pre_12_inl.h +263 -0
- package/node_modules/nan/nan_json.h +166 -0
- package/node_modules/nan/nan_maybe_43_inl.h +360 -0
- package/node_modules/nan/nan_maybe_pre_43_inl.h +268 -0
- package/node_modules/nan/nan_new.h +340 -0
- package/node_modules/nan/nan_object_wrap.h +156 -0
- package/node_modules/nan/nan_persistent_12_inl.h +132 -0
- package/node_modules/nan/nan_persistent_pre_12_inl.h +242 -0
- package/node_modules/nan/nan_private.h +73 -0
- package/node_modules/nan/nan_scriptorigin.h +97 -0
- package/node_modules/nan/nan_string_bytes.h +305 -0
- package/node_modules/nan/nan_typedarray_contents.h +96 -0
- package/node_modules/nan/nan_weak.h +453 -0
- package/node_modules/nan/package.json +38 -0
- package/node_modules/nan/tools/1to2.js +412 -0
- package/node_modules/nan/tools/README.md +14 -0
- package/node_modules/nan/tools/package.json +19 -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 +95 -89
|
@@ -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
|
+
})();
|