libmongocrypt-helper 1.8.0.0.1001 → 1.11.0.0.1001
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +33 -0
- data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +12 -1
- data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +1 -4
- data/ext/libmongocrypt/libmongocrypt/Earthfile +151 -3
- data/ext/libmongocrypt/libmongocrypt/README.md +36 -40
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/CMakeLists.txt +1 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Driver.snk +0 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/AssemblyInfo.cs +2 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Binary.cs +16 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClientFactory.cs +8 -4
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Library.cs +10 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/LibraryLoader.cs +81 -44
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/MongoDB.Libmongocrypt.csproj +2 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/MongoDB.Libmongocrypt.Test.csproj +2 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test32/MongoDB.Libmongocrypt.Test32.csproj +2 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/README.md +3 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.cake +21 -26
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.config +3 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.sh +0 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/build.gradle.kts +28 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/java/com/mongodb/crypt/benchmark/BenchmarkRunner.java +217 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/resources/keyDocument.json +24 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/build.gradle.kts +21 -6
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.jar +0 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.properties +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew +154 -108
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew.bat +7 -18
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/settings.gradle.kts +1 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPI.java +41 -6
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPIHelper.java +5 -5
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CipherCallback.java +27 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptImpl.java +34 -19
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoExplicitEncryptOptions.java +6 -4
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/jni-config.json +180 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/reflect-config.json +134 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/java/com/mongodb/crypt/capi/MongoCryptTest.java +44 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/encrypted-payload.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/rangeopts.json +3 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/README.md +4 -900
- data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +60 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/README.rst +41 -20
- data/ext/libmongocrypt/libmongocrypt/bindings/python/RELEASE.rst +6 -24
- data/ext/libmongocrypt/libmongocrypt/bindings/python/build-manylinux-wheel.sh +4 -13
- data/ext/libmongocrypt/libmongocrypt/bindings/python/hatch_build.py +36 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/libmongocrypt-version.txt +1 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/__init__.py +2 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/auto_encrypter.py +61 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/credentials.py +156 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/explicit_encrypter.py +156 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/state_machine.py +149 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/auto_encrypter.py +2 -46
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binary.py +14 -17
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +107 -61
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/compat.py +6 -4
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/credentials.py +2 -121
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/crypto.py +31 -20
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/errors.py +2 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/explicit_encrypter.py +2 -233
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +168 -238
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/options.py +265 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/state_machine.py +2 -141
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/auto_encrypter.py +61 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/credentials.py +156 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/explicit_encrypter.py +156 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/state_machine.py +149 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +2 -2
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pyproject.toml +118 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/release.sh +97 -61
- data/ext/libmongocrypt/libmongocrypt/bindings/python/{test-requirements.txt → requirements-test.txt} +4 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/requirements.txt +4 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/sbom.json +76 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/strip_header.py +6 -7
- data/ext/libmongocrypt/libmongocrypt/bindings/python/synchro.py +64 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/__init__.py +1 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/collection-info.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/command.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/compact/success/encrypted-payload.json +21 -21
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-command-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-field-config-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/encrypted-payload.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/rangeopts.json +3 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-rangePreview-explicit/int32/rangeopts.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-rangePreview-explicit/int32/value-to-encrypt.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-azure.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-gcp.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-filter.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/list-collections-filter.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-command.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-reply.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/schema-map.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/performance/keyDocument.json +24 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/performance/perf_test.py +165 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_binding.py +8 -12
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_crypto.py +9 -11
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +988 -340
- data/ext/libmongocrypt/libmongocrypt/bindings/python/update-sbom.sh +14 -0
- data/ext/libmongocrypt/libmongocrypt/cmake/FetchMongoC.cmake +19 -1
- data/ext/libmongocrypt/libmongocrypt/cmake/ImportBSON.cmake +23 -0
- data/ext/libmongocrypt/libmongocrypt/cmake/IntelDFP.cmake +19 -227
- data/ext/libmongocrypt/libmongocrypt/cmake/Patch.cmake +54 -0
- data/ext/libmongocrypt/libmongocrypt/doc/img/cli-icon.png +0 -0
- data/ext/libmongocrypt/libmongocrypt/doc/img/reference-targets.png +0 -0
- data/ext/libmongocrypt/libmongocrypt/doc/releasing.md +153 -0
- data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version.py +61 -28
- data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version_selftest.sh +73 -0
- data/ext/libmongocrypt/libmongocrypt/etc/cyclonedx.sbom.json +108 -0
- data/ext/libmongocrypt/libmongocrypt/etc/format.sh +1 -1
- data/ext/libmongocrypt/libmongocrypt/etc/libbson-remove-GCC-diagnostic-pragma.patch +27 -0
- data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-alpine-arm-fix.patch +17 -0
- data/ext/libmongocrypt/libmongocrypt/etc/packager.py +120 -91
- data/ext/libmongocrypt/libmongocrypt/etc/purls.txt +14 -0
- data/ext/libmongocrypt/libmongocrypt/etc/repo_config.yaml +56 -0
- data/ext/libmongocrypt/libmongocrypt/etc/silk-create-asset-group.sh +70 -0
- data/ext/libmongocrypt/libmongocrypt/etc/ssdlc_compliance_report.md +37 -0
- data/ext/libmongocrypt/libmongocrypt/etc/third_party_vulnerabilities.md +42 -0
- data/ext/libmongocrypt/libmongocrypt/integrating.md +18 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/CMakeLists.txt +11 -3
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_gcp_request.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer.c +17 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer_private.h +6 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_request.c +211 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_response.c +163 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_tag_type_private.h +2 -1
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_request.h +17 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_response.h +6 -0
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_port.c +3 -2
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request.c +4 -2
- data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kmip_reader_writer.c +23 -2
- data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +13 -10
- data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +16 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +94 -6
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +15 -5
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +114 -53
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private-v2.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private.h +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +21 -6
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private.h +5 -5
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +38 -2
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +20 -7
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private.h +8 -8
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +89 -1
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +3 -3
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +1 -23
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds-private.h +4 -3
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +15 -12
- data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +11 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +16 -6
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +64 -22
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +23 -4
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +359 -65
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +26 -14
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +17 -6
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +31 -13
- data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +16 -3
- data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +259 -63
- data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +40 -24
- data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +57 -13
- data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +17 -0
- data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +5 -0
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary-private.h +0 -5
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer.c +5 -7
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key.c +1 -0
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth-private.h +16 -18
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth.c +105 -76
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +9 -3
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +170 -89
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +5 -5
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +505 -124
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-private.h +31 -6
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +81 -13
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +7 -0
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek-private.h +5 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek.c +161 -103
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker-private.h +2 -7
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +191 -69
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx-private.h +50 -15
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx.c +365 -69
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +2 -1
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +200 -107
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +50 -5
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +591 -15
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +6 -13
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +3 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +47 -234
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.h +75 -24
- data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +18 -2
- data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +4 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/bypassQueryAnalysis/payload.json +53 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd-to-mongocryptd.json +23 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/cmd-to-mongocryptd.json +50 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/cmd.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/collinfo.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/encrypted-field-map.json +24 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/encrypted-payload-pattern.json +53 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/mongocryptd-reply.json +62 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/cmd-to-mongocryptd.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/cmd.json +17 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/mongocryptd-reply.json +39 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/payload.json +21 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/missing-key-id/collinfo.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/collinfo.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/encrypted-payload.json +4 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/cmd.json +1 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/collinfo.json +63 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-field-config-map.json +61 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload-range-v2.json +37 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload.json +29 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/cmd.json +1 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/collinfo.json +64 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload-range-v2.json +105 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/cmd.json +1 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/collinfo.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-field-config-map.json +47 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-payload.json +23 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/collinfo.json +15 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload-range-v2.json +104 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload.json +6 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/collinfo.json +4 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/encrypted-payload.json +3 -3
- data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/decrypt-response.txt +16 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/encrypt-response.txt +16 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/oauth-response.txt +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/encrypted-field-map.json +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/encrypted-payload.json +62 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/mongocryptd-reply.json +69 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/encrypted-field-map.json +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/encrypted-payload.json +40 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/mongocryptd-reply.json +47 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_decimal128.cstruct +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_double.cstruct +8637 -7958
- data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int32.cstruct +5522 -1382
- data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int64.cstruct +5042 -1262
- data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128.cstruct +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128_precision.cstruct +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double.cstruct +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double_precision.cstruct +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int32.cstruct +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int64.cstruct +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/encrypted-field-map.json +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/encrypted-payload.json +53 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/mongocryptd-reply.json +58 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/encrypted-field-map.json +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/encrypted-payload.json +40 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/mongocryptd-reply.json +45 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32/expected.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32/to-encrypt.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32-defaults/expected.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32-defaults/to-encrypt.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-double/expected.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-int32/expected.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-int32-defaults/expected.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/README.md +7 -4
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +9 -5
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +9 -5
- data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +1 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +8 -8
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +6 -4
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +43 -3
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +76 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +5 -5
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +89 -14
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +342 -76
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +94 -12
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +205 -7
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +49 -23
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +16 -19
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.h +22 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache-oauth.c +94 -11
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cleanup.c +374 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +121 -42
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +134 -4
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +40 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.h +16 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +11 -11
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +8 -5
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +922 -92
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +2 -2
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +114 -12
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +14 -9
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +424 -3
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +447 -28
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-opts.c +42 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-traverse-util.c +30 -26
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.c +7 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.h +3 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +66 -14
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-named-kms-providers.c +2381 -0
- data/ext/libmongocrypt/libmongocrypt/test/util/HELP.autogen +3 -1
- data/ext/libmongocrypt/libmongocrypt/test/util/README.md +1 -0
- data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +4 -0
- data/ext/libmongocrypt/libmongocrypt/test/util/make_includes.py +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/util/util.c +38 -3
- data/lib/libmongocrypt_helper/version.rb +2 -2
- metadata +112 -106
- checksums.yaml.gz.sig +0 -0
- data/ext/libmongocrypt/libmongocrypt/VERSION_CURRENT +0 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/cs.sln +0 -79
- data/ext/libmongocrypt/libmongocrypt/bindings/node/CHANGELOG.md +0 -105
- data/ext/libmongocrypt/libmongocrypt/bindings/node/LICENSE +0 -201
- data/ext/libmongocrypt/libmongocrypt/bindings/node/binding.gyp +0 -79
- data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/README.hbs +0 -44
- data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/build-static.sh +0 -36
- data/ext/libmongocrypt/libmongocrypt/bindings/node/index.d.ts +0 -641
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/autoEncrypter.js +0 -420
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/buffer_pool.js +0 -123
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/clientEncryption.js +0 -821
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/common.js +0 -98
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/cryptoCallbacks.js +0 -87
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/errors.js +0 -75
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js +0 -73
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/mongocryptdManager.js +0 -66
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/aws.js +0 -26
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/azure.js +0 -178
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/gcp.js +0 -24
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/index.js +0 -54
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/utils.js +0 -39
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/stateMachine.js +0 -492
- data/ext/libmongocrypt/libmongocrypt/bindings/node/package-lock.json +0 -15302
- data/ext/libmongocrypt/libmongocrypt/bindings/node/package.json +0 -100
- data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.cc +0 -956
- data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.h +0 -114
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/autoEncrypter.test.js +0 -950
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/buffer_pool.test.js +0 -91
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/clientEncryption.test.js +0 -1093
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/common.test.js +0 -94
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/cryptoCallbacks.test.js +0 -240
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/README.md +0 -5
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/cmd.json +0 -6
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/collection-info.json +0 -37
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document-nested.json +0 -8
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document.json +0 -11
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encryptedFields.json +0 -30
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key-document.json +0 -32
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key1-document.json +0 -30
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/mongocryptd-reply.json +0 -18
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/index.test.js +0 -45
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/mongocryptdManager.test.js +0 -48
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/providers/credentialsProvider.test.js +0 -551
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/release.test.js +0 -66
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/requirements.helper.js +0 -51
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/stateMachine.test.js +0 -331
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/chai-addons.js +0 -8
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/mongodb_reporter.js +0 -325
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/types/index.test-d.ts +0 -63
- data/ext/libmongocrypt/libmongocrypt/bindings/python/setup.py +0 -89
- data/ext/libmongocrypt/libmongocrypt/debian/build_snapshot.sh +0 -79
- data/ext/libmongocrypt/libmongocrypt/debian/changelog +0 -105
- data/ext/libmongocrypt/libmongocrypt/debian/compat +0 -1
- data/ext/libmongocrypt/libmongocrypt/debian/control +0 -41
- data/ext/libmongocrypt/libmongocrypt/debian/copyright +0 -129
- data/ext/libmongocrypt/libmongocrypt/debian/gbp.conf +0 -23
- data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.dirs +0 -2
- data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.install +0 -5
- data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.dirs +0 -1
- data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.install +0 -1
- data/ext/libmongocrypt/libmongocrypt/debian/rules +0 -46
- data/ext/libmongocrypt/libmongocrypt/debian/source/format +0 -1
- data/ext/libmongocrypt/libmongocrypt/debian/source/lintian-overrides +0 -3
- data/ext/libmongocrypt/libmongocrypt/debian/source/options +0 -1
- data/ext/libmongocrypt/libmongocrypt/debian/watch +0 -3
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/mongocryptd-reply.json +0 -72
- data.tar.gz.sig +0 -1
- metadata.gz.sig +0 -0
- /data/ext/libmongocrypt/libmongocrypt/{bindings/node/test/data/kms-decrypt-reply.txt → test/data/kms-aws/decrypt-response.txt} +0 -0
- /data/ext/libmongocrypt/libmongocrypt/{bindings/node/test/data/kms-encrypt-reply.txt → test/data/kms-aws/encrypt-response.txt} +0 -0
- /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/decrypt-response.txt +0 -0
- /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/encrypt-response.txt +0 -0
- /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/oauth-response.txt +0 -0
@@ -28,6 +28,7 @@ namespace MongoDB.Libmongocrypt
|
|
28
28
|
internal class LibraryLoader
|
29
29
|
{
|
30
30
|
private ISharedLibraryLoader _loader;
|
31
|
+
private static readonly string __libmongocryptLibPath = Environment.GetEnvironmentVariable("LIBMONGOCRYPT_PATH");
|
31
32
|
|
32
33
|
public LibraryLoader()
|
33
34
|
{
|
@@ -54,40 +55,13 @@ namespace MongoDB.Libmongocrypt
|
|
54
55
|
switch (OperatingSystemHelper.CurrentOperatingSystem)
|
55
56
|
{
|
56
57
|
case OperatingSystemPlatform.MacOS:
|
57
|
-
|
58
|
-
string[] suffixPaths = new[]
|
59
|
-
{
|
60
|
-
"../../runtimes/osx/native/",
|
61
|
-
"runtimes/osx/native/",
|
62
|
-
string.Empty
|
63
|
-
};
|
64
|
-
string path = FindLibrary(candidatePaths, suffixPaths, "libmongocrypt.dylib");
|
65
|
-
_loader = new DarwinLibraryLoader(path);
|
66
|
-
}
|
58
|
+
_loader = new DarwinLibraryLoader(candidatePaths);
|
67
59
|
break;
|
68
60
|
case OperatingSystemPlatform.Linux:
|
69
|
-
|
70
|
-
string[] suffixPaths = new[]
|
71
|
-
{
|
72
|
-
"../../runtimes/linux/native/",
|
73
|
-
"runtimes/linux/native/",
|
74
|
-
string.Empty
|
75
|
-
};
|
76
|
-
string path = FindLibrary(candidatePaths, suffixPaths, "libmongocrypt.so");
|
77
|
-
_loader = new LinuxLibrary(path);
|
78
|
-
}
|
61
|
+
_loader = new LinuxLibrary(candidatePaths);
|
79
62
|
break;
|
80
63
|
case OperatingSystemPlatform.Windows:
|
81
|
-
|
82
|
-
string[] suffixPaths = new[]
|
83
|
-
{
|
84
|
-
@"..\..\runtimes\win\native\",
|
85
|
-
@".\runtimes\win\native\",
|
86
|
-
string.Empty
|
87
|
-
};
|
88
|
-
string path = FindLibrary(candidatePaths, suffixPaths, "mongocrypt.dll");
|
89
|
-
_loader = new WindowsLibrary(path);
|
90
|
-
}
|
64
|
+
_loader = new WindowsLibrary(candidatePaths);
|
91
65
|
break;
|
92
66
|
default:
|
93
67
|
// should not be reached. If we're here, then there is a bug in OperatingSystemHelper
|
@@ -95,7 +69,7 @@ namespace MongoDB.Libmongocrypt
|
|
95
69
|
}
|
96
70
|
}
|
97
71
|
|
98
|
-
private string FindLibrary(IList<string> basePaths, string[] suffixPaths, string library)
|
72
|
+
private static string FindLibrary(IList<string> basePaths, string[] suffixPaths, string library)
|
99
73
|
{
|
100
74
|
var candidates = new List<string>();
|
101
75
|
foreach (var basePath in basePaths)
|
@@ -150,9 +124,17 @@ namespace MongoDB.Libmongocrypt
|
|
150
124
|
public const int RTLD_GLOBAL = 0x8;
|
151
125
|
public const int RTLD_NOW = 0x2;
|
152
126
|
|
127
|
+
private static readonly string[] __suffixPaths =
|
128
|
+
{
|
129
|
+
"../../runtimes/osx/native/",
|
130
|
+
"runtimes/osx/native/",
|
131
|
+
string.Empty
|
132
|
+
};
|
133
|
+
|
153
134
|
private readonly IntPtr _handle;
|
154
|
-
public DarwinLibraryLoader(string
|
135
|
+
public DarwinLibraryLoader(List<string> candidatePaths)
|
155
136
|
{
|
137
|
+
var path = __libmongocryptLibPath ?? FindLibrary(candidatePaths, __suffixPaths, "libmongocrypt.dylib");
|
156
138
|
_handle = dlopen(path, RTLD_GLOBAL | RTLD_NOW);
|
157
139
|
if (_handle == IntPtr.Zero)
|
158
140
|
{
|
@@ -186,11 +168,37 @@ namespace MongoDB.Libmongocrypt
|
|
186
168
|
// #define RTLD_GLOBAL 0x100
|
187
169
|
public const int RTLD_GLOBAL = 0x100;
|
188
170
|
public const int RTLD_NOW = 0x2;
|
171
|
+
private static readonly bool _use_libdl1;
|
172
|
+
|
173
|
+
static LinuxLibrary()
|
174
|
+
{
|
175
|
+
try
|
176
|
+
{
|
177
|
+
Libdl1.dlerror();
|
178
|
+
_use_libdl1 = true;
|
179
|
+
}
|
180
|
+
catch
|
181
|
+
{
|
182
|
+
_use_libdl1 = false;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
|
186
|
+
private static readonly string[] __suffixPaths =
|
187
|
+
{
|
188
|
+
"../../runtimes/linux/native/",
|
189
|
+
"runtimes/linux/native/",
|
190
|
+
string.Empty
|
191
|
+
};
|
189
192
|
|
190
193
|
private readonly IntPtr _handle;
|
191
|
-
public LinuxLibrary(string
|
194
|
+
public LinuxLibrary(List<string> candidatePaths)
|
192
195
|
{
|
193
|
-
|
196
|
+
var path = __libmongocryptLibPath ?? FindLibrary(candidatePaths, __suffixPaths, "libmongocrypt.so");
|
197
|
+
|
198
|
+
_handle = _use_libdl1
|
199
|
+
? Libdl1.dlopen(path, RTLD_GLOBAL | RTLD_NOW)
|
200
|
+
: Libdl2.dlopen(path, RTLD_GLOBAL | RTLD_NOW);
|
201
|
+
|
194
202
|
if (_handle == IntPtr.Zero)
|
195
203
|
{
|
196
204
|
throw new FileNotFoundException(path);
|
@@ -199,16 +207,8 @@ namespace MongoDB.Libmongocrypt
|
|
199
207
|
|
200
208
|
public IntPtr GetFunction(string name)
|
201
209
|
{
|
202
|
-
return dlsym(_handle, name);
|
210
|
+
return _use_libdl1 ? Libdl1.dlsym(_handle, name) : Libdl2.dlsym(_handle, name);
|
203
211
|
}
|
204
|
-
|
205
|
-
#pragma warning disable IDE1006 // Naming Styles
|
206
|
-
[DllImport("libdl")]
|
207
|
-
public static extern IntPtr dlopen(string filename, int flags);
|
208
|
-
|
209
|
-
[DllImport("libdl", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
210
|
-
public static extern IntPtr dlsym(IntPtr handle, string symbol);
|
211
|
-
#pragma warning restore IDE1006 // Naming Styles
|
212
212
|
}
|
213
213
|
|
214
214
|
/// <summary>
|
@@ -216,9 +216,17 @@ namespace MongoDB.Libmongocrypt
|
|
216
216
|
/// </summary>
|
217
217
|
private class WindowsLibrary : ISharedLibraryLoader
|
218
218
|
{
|
219
|
+
private static readonly string[] __suffixPaths =
|
220
|
+
{
|
221
|
+
@"..\..\runtimes\win\native\",
|
222
|
+
@".\runtimes\win\native\",
|
223
|
+
string.Empty
|
224
|
+
};
|
225
|
+
|
219
226
|
private readonly IntPtr _handle;
|
220
|
-
public WindowsLibrary(string
|
227
|
+
public WindowsLibrary(List<string> candidatePaths)
|
221
228
|
{
|
229
|
+
var path = __libmongocryptLibPath ?? FindLibrary(candidatePaths, __suffixPaths, "mongocrypt.dll");
|
222
230
|
_handle = LoadLibrary(path);
|
223
231
|
if (_handle == IntPtr.Zero)
|
224
232
|
{
|
@@ -248,5 +256,34 @@ namespace MongoDB.Libmongocrypt
|
|
248
256
|
[DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
|
249
257
|
public static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
|
250
258
|
}
|
259
|
+
|
260
|
+
private static class Libdl1
|
261
|
+
{
|
262
|
+
private const string LibName = "libdl";
|
263
|
+
|
264
|
+
#pragma warning disable IDE1006 // Naming Styles
|
265
|
+
[DllImport(LibName)]
|
266
|
+
public static extern IntPtr dlopen(string filename, int flags);
|
267
|
+
|
268
|
+
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
269
|
+
public static extern IntPtr dlsym(IntPtr handle, string symbol);
|
270
|
+
|
271
|
+
[DllImport(LibName)]
|
272
|
+
public static extern string dlerror();
|
273
|
+
#pragma warning restore IDE1006 // Naming Styles
|
274
|
+
}
|
275
|
+
|
276
|
+
private static class Libdl2
|
277
|
+
{
|
278
|
+
private const string LibName = "libdl.so.2";
|
279
|
+
|
280
|
+
#pragma warning disable IDE1006 // Naming Styles
|
281
|
+
[DllImport(LibName)]
|
282
|
+
public static extern IntPtr dlopen(string filename, int flags);
|
283
|
+
|
284
|
+
[DllImport(LibName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
285
|
+
public static extern IntPtr dlsym(IntPtr handle, string symbol);
|
286
|
+
#pragma warning restore IDE1006 // Naming Styles
|
287
|
+
}
|
251
288
|
}
|
252
289
|
}
|
data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/MongoDB.Libmongocrypt.csproj
CHANGED
@@ -24,11 +24,12 @@
|
|
24
24
|
<PackageTags>mongodb;mongo;nosql</PackageTags>
|
25
25
|
<PackageLanguage>en-US</PackageLanguage>
|
26
26
|
<IncludeSymbols>true</IncludeSymbols>
|
27
|
+
<SignAssembly>true</SignAssembly>
|
28
|
+
<AssemblyOriginatorKeyFile>..\MongoDB.Driver.snk</AssemblyOriginatorKeyFile>
|
27
29
|
</PropertyGroup>
|
28
30
|
|
29
31
|
<PropertyGroup>
|
30
32
|
<LibMongoCryptBinaries>../../../cmake-build/$(Configuration)</LibMongoCryptBinaries>
|
31
|
-
<LibMongoCryptBinaries Condition="'$(Configuration)'=='Release' And '$(OS)' == 'Windows_NT'">../../../cmake-build/RelWithDebInfo/</LibMongoCryptBinaries>
|
32
33
|
</PropertyGroup>
|
33
34
|
|
34
35
|
<ItemGroup>
|
@@ -4,6 +4,8 @@
|
|
4
4
|
<TargetFrameworks>net472;netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
|
5
5
|
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
|
6
6
|
<IsPackable>false</IsPackable>
|
7
|
+
<SignAssembly>true</SignAssembly>
|
8
|
+
<AssemblyOriginatorKeyFile>..\MongoDB.Driver.snk</AssemblyOriginatorKeyFile>
|
7
9
|
</PropertyGroup>
|
8
10
|
|
9
11
|
<ItemGroup>
|
@@ -54,6 +54,9 @@ If you see `Windows Error: 126` during tests, like the example below, it means t
|
|
54
54
|
2. cd <build>/bindings/cs
|
55
55
|
3. dotnet build cs.build
|
56
56
|
```
|
57
|
+
*Note*: You can use the ```LIBMONGOCRYPT_PATH``` environment variable to load a locally installed
|
58
|
+
libmongocrypt build. You should specify the absolute path to the libmongocrypt library itself, not just the containing folder. For example on Linux:
|
59
|
+
```$ export LIBMONGOCRYPT_PATH='/path/to/libmongocrypt.so'```.
|
57
60
|
|
58
61
|
# Testing
|
59
62
|
Do not modify xunit.runner.json
|
@@ -1,7 +1,7 @@
|
|
1
|
-
#addin nuget:?package=Cake.FileHelpers&version=
|
2
|
-
#addin nuget:?package=Cake.Git&version=0.
|
3
|
-
#addin nuget:?package=Cake.Incubator&version=
|
4
|
-
#tool dotnet:?package=GitVersion.Tool&version=5.3
|
1
|
+
#addin nuget:?package=Cake.FileHelpers&version=5.0.0
|
2
|
+
#addin nuget:?package=Cake.Git&version=2.0.0
|
3
|
+
#addin nuget:?package=Cake.Incubator&version=7.0.0
|
4
|
+
#tool dotnet:?package=GitVersion.Tool&version=5.10.3
|
5
5
|
|
6
6
|
using System;
|
7
7
|
using System.Linq;
|
@@ -14,15 +14,17 @@ var gitVersion = GitVersion();
|
|
14
14
|
var buildDirectory = MakeAbsolute(Directory(GetSettingValue("buildDirectory", "c:\\build")));
|
15
15
|
var libmongocryptAllDirectory=buildDirectory.Combine("libmongocrypt-all");
|
16
16
|
var downloadedMongocryptDirectory=buildDirectory.Combine("downloadedMongocryptDirectory");
|
17
|
-
var localReleaseVersion = "
|
17
|
+
var localReleaseVersion = "0.0.0-local";
|
18
18
|
var releaseVersion = GetSettingValue("releaseVersion", localReleaseVersion);
|
19
|
-
var fork = GetSettingValue("fork", "
|
19
|
+
var fork = GetSettingValue("fork", "git@github.com:mongodb/libmongocrypt.git");
|
20
20
|
var branch = GetSettingValue("branch", "master");
|
21
|
-
|
22
|
-
|
21
|
+
|
22
|
+
// 1.10.0 - latest libmongocrypt release
|
23
|
+
var libmongocryptAllUrl = GetSettingValue("url", "https://mciuploads.s3.amazonaws.com/libmongocrypt/all/1.10.0/libmongocrypt-all.tar.gz");
|
24
|
+
|
23
25
|
var csharpBindingsGitTagName = $"csharp-v{releaseVersion}";
|
24
26
|
var csharpBindingsDirectory = buildDirectory.Combine(csharpBindingsGitTagName);
|
25
|
-
var libmongocryptRelWithDebInfoDirectory = csharpBindingsDirectory.Combine("cmake-build").Combine("
|
27
|
+
var libmongocryptRelWithDebInfoDirectory = csharpBindingsDirectory.Combine("cmake-build").Combine($"{configuration}");
|
26
28
|
var libmongocryptCsDirectory = csharpBindingsDirectory.Combine("bindings").Combine("cs");
|
27
29
|
var libmongocryptSolutionDirectory = libmongocryptCsDirectory.Combine("MongoDB.Libmongocrypt");
|
28
30
|
var libmongocryptSolutionFile = libmongocryptSolutionDirectory.CombineWithFilePath("MongoDB.Libmongocrypt.csproj");
|
@@ -57,16 +59,9 @@ Task("Prepare")
|
|
57
59
|
UncompressToTheCurrentDirectory(nativeLibrariesArchive);
|
58
60
|
|
59
61
|
Information("Cloning the libmongocrypt repo..");
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
new GitCloneSettings
|
64
|
-
{
|
65
|
-
BranchName = branch,
|
66
|
-
Checkout = true,
|
67
|
-
IsBare = false,
|
68
|
-
RecurseSubmodules = true
|
69
|
-
});
|
62
|
+
EnsureDirectoryExists(csharpBindingsDirectory);
|
63
|
+
Git(csharpBindingsDirectory, $"clone {fork} -b {branch} .");
|
64
|
+
Information("Done git clone..");
|
70
65
|
|
71
66
|
EnsureDirectoryExists(libmongocryptRelWithDebInfoDirectory);
|
72
67
|
EnsureDirectoryExists(downloadedMongocryptDirectory);
|
@@ -77,7 +72,7 @@ Task("Prepare")
|
|
77
72
|
libmongocryptAllDirectory.Combine("ubuntu1804-64").Combine("nocrypto").Combine("lib").CombineWithFilePath("libmongocrypt.so"),
|
78
73
|
downloadedMongocryptDirectory.CombineWithFilePath("libmongocrypt.so"));
|
79
74
|
CopyFile(
|
80
|
-
libmongocryptAllDirectory.Combine("macos").Combine("
|
75
|
+
libmongocryptAllDirectory.Combine("macos").Combine("lib").CombineWithFilePath("libmongocrypt.dylib"),
|
81
76
|
downloadedMongocryptDirectory.CombineWithFilePath("libmongocrypt.dylib"));
|
82
77
|
CopyDirectory(downloadedMongocryptDirectory, libmongocryptRelWithDebInfoDirectory);
|
83
78
|
});
|
@@ -99,7 +94,7 @@ Task("Tests")
|
|
99
94
|
(monikerInfo) =>
|
100
95
|
{
|
101
96
|
Information($"Test running {monikerInfo.Moniker}..");
|
102
|
-
var settings = new
|
97
|
+
var settings = new DotNetTestSettings
|
103
98
|
{
|
104
99
|
Configuration = configuration,
|
105
100
|
Framework = monikerInfo.Moniker,
|
@@ -107,7 +102,7 @@ Task("Tests")
|
|
107
102
|
};
|
108
103
|
var projectFullPath = libmongocryptTestsSolutionDirectory.CombineWithFilePath("MongoDB.Libmongocrypt.Test.csproj").FullPath;
|
109
104
|
Information(projectFullPath);
|
110
|
-
|
105
|
+
DotNetTest(
|
111
106
|
projectFullPath,
|
112
107
|
settings
|
113
108
|
);
|
@@ -120,7 +115,7 @@ Task("CreatePackage")
|
|
120
115
|
{
|
121
116
|
var projectFullPath = libmongocryptSolutionFile.FullPath;
|
122
117
|
Information($"Project path: {projectFullPath}. ReleaseVersion: {releaseVersion}");
|
123
|
-
var settings = new
|
118
|
+
var settings = new DotNetPackSettings
|
124
119
|
{
|
125
120
|
Configuration = configuration,
|
126
121
|
OutputDirectory = artifactsDirectory,
|
@@ -129,7 +124,7 @@ Task("CreatePackage")
|
|
129
124
|
{ "Version", releaseVersion },
|
130
125
|
}
|
131
126
|
};
|
132
|
-
|
127
|
+
DotNetPack(
|
133
128
|
projectFullPath,
|
134
129
|
settings);
|
135
130
|
});
|
@@ -142,9 +137,9 @@ Task("NugetPush")
|
|
142
137
|
var nugetApi = GetSettingValue("NugetApiKey", null);
|
143
138
|
var packageFilePath = artifactsDirectory.CombineWithFilePath($"{libmongocryptSolutionFile.GetFilenameWithoutExtension().ToString()}.{releaseVersion}.nupkg");
|
144
139
|
Information(packageFilePath);
|
145
|
-
|
140
|
+
DotNetNuGetPush(
|
146
141
|
packageFilePath,
|
147
|
-
new
|
142
|
+
new DotNetNuGetPushSettings
|
148
143
|
{
|
149
144
|
ApiKey = nugetApi,
|
150
145
|
Source = "https://api.nuget.org/v3/index.json"
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2023-present MongoDB, Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*
|
16
|
+
*/
|
17
|
+
|
18
|
+
plugins {
|
19
|
+
id("application")
|
20
|
+
}
|
21
|
+
|
22
|
+
application {
|
23
|
+
mainClass.set("com.mongodb.crypt.benchmark.BenchmarkRunner")
|
24
|
+
}
|
25
|
+
|
26
|
+
dependencies {
|
27
|
+
implementation(project(":")) // Reference to the parent project
|
28
|
+
}
|
@@ -0,0 +1,217 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2023-present MongoDB, Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*
|
16
|
+
*/
|
17
|
+
|
18
|
+
package com.mongodb.crypt.benchmark;
|
19
|
+
|
20
|
+
import com.mongodb.crypt.capi.*;
|
21
|
+
import org.bson.*;
|
22
|
+
|
23
|
+
import java.io.*;
|
24
|
+
import java.net.URL;
|
25
|
+
import java.nio.ByteBuffer;
|
26
|
+
import java.nio.charset.StandardCharsets;
|
27
|
+
import java.nio.file.Files;
|
28
|
+
import java.nio.file.Paths;
|
29
|
+
import java.time.ZoneOffset;
|
30
|
+
import java.time.ZonedDateTime;
|
31
|
+
import java.time.format.DateTimeFormatter;
|
32
|
+
import java.util.*;
|
33
|
+
import java.util.concurrent.*;
|
34
|
+
|
35
|
+
public class BenchmarkRunner {
|
36
|
+
static final int NUM_FIELDS = 1500;
|
37
|
+
static final int NUM_WARMUP_SECS = 2;
|
38
|
+
static final int NUM_SECS = 10;
|
39
|
+
static final byte[] LOCAL_MASTER_KEY = new byte[]{
|
40
|
+
-99, -108, 75, 13, -109, -48, -59, 68, -91, 114, -3, 50, 27, -108, 48, -112, 35, 53,
|
41
|
+
115, 124, -16, -10, -62, -12, -38, 35, 86, -25, -113, 4, -52, -6, -34, 117, -76, 81,
|
42
|
+
-121, -13, -117, -105, -41, 75, 68, 59, -84, 57, -94, -58, 77, -111, 0, 62, -47, -6, 74,
|
43
|
+
48, -63, -46, -58, 94, -5, -84, 65, -14, 72, 19, 60, -101, 80, -4, -89, 36, 122, 46, 2,
|
44
|
+
99, -93, -58, 22, 37, 81, 80, 120, 62, 15, -40, 110, -124, -90, -20, -115, 45, 36, 71,
|
45
|
+
-27, -81
|
46
|
+
};
|
47
|
+
|
48
|
+
private static String getFileAsString(final String fileName) {
|
49
|
+
try {
|
50
|
+
URL resource = BenchmarkRunner.class.getResource("/" + fileName);
|
51
|
+
if (resource == null) {
|
52
|
+
throw new RuntimeException("Could not find file " + fileName);
|
53
|
+
}
|
54
|
+
return new String(Files.readAllBytes(Paths.get(resource.toURI())));
|
55
|
+
} catch (Throwable t) {
|
56
|
+
throw new RuntimeException("Could not parse file " + fileName, t);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
private static BsonDocument getResourceAsDocument(final String fileName) {
|
61
|
+
return BsonDocument.parse(getFileAsString(fileName));
|
62
|
+
}
|
63
|
+
|
64
|
+
private static MongoCrypt createMongoCrypt() {
|
65
|
+
return MongoCrypts.create(MongoCryptOptions
|
66
|
+
.builder()
|
67
|
+
.localKmsProviderOptions(MongoLocalKmsProviderOptions.builder()
|
68
|
+
.localMasterKey(ByteBuffer.wrap(LOCAL_MASTER_KEY))
|
69
|
+
.build())
|
70
|
+
.build());
|
71
|
+
}
|
72
|
+
|
73
|
+
// DecryptTask decrypts a document repeatedly for a specified number of seconds and records ops/sec.
|
74
|
+
private static class DecryptTask implements Runnable {
|
75
|
+
public DecryptTask (MongoCrypt mongoCrypt, BsonDocument toDecrypt, int numSecs, CountDownLatch doneSignal) {
|
76
|
+
this.mongoCrypt = mongoCrypt;
|
77
|
+
this.toDecrypt = toDecrypt;
|
78
|
+
this.opsPerSecs = new ArrayList<Long>(numSecs);
|
79
|
+
this.numSecs = numSecs;
|
80
|
+
this.doneSignal = doneSignal;
|
81
|
+
}
|
82
|
+
public void run() {
|
83
|
+
for (int i = 0; i < numSecs; i++) {
|
84
|
+
long opsPerSec = 0;
|
85
|
+
long start = System.nanoTime();
|
86
|
+
// Run for one second.
|
87
|
+
while (System.nanoTime() - start < 1_000_000_000) {
|
88
|
+
try (MongoCryptContext ctx = mongoCrypt.createDecryptionContext(toDecrypt)) {
|
89
|
+
assert ctx.getState() == MongoCryptContext.State.READY;
|
90
|
+
ctx.finish();
|
91
|
+
opsPerSec++;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
opsPerSecs.add(opsPerSec);
|
95
|
+
}
|
96
|
+
doneSignal.countDown();
|
97
|
+
}
|
98
|
+
public long getMedianOpsPerSecs () {
|
99
|
+
if (opsPerSecs.size() == 0) {
|
100
|
+
throw new IllegalStateException("opsPerSecs is empty. Was `run` called?");
|
101
|
+
}
|
102
|
+
Collections.sort(opsPerSecs);
|
103
|
+
return opsPerSecs.get(numSecs / 2);
|
104
|
+
}
|
105
|
+
private MongoCrypt mongoCrypt;
|
106
|
+
private BsonDocument toDecrypt;
|
107
|
+
private ArrayList<Long> opsPerSecs;
|
108
|
+
private int numSecs;
|
109
|
+
private CountDownLatch doneSignal;
|
110
|
+
}
|
111
|
+
public static void main(String[] args) throws IOException, InterruptedException, ExecutionException {
|
112
|
+
System.out.printf("BenchmarkRunner is using libmongocrypt version=%s, NUM_WARMUP_SECS=%d, NUM_SECS=%d%n", CAPI.mongocrypt_version(null).toString(), NUM_WARMUP_SECS, NUM_SECS);
|
113
|
+
// `keyDocument` is a Data Encryption Key (DEK) encrypted with the Key Encryption Key (KEK) `LOCAL_MASTER_KEY`.
|
114
|
+
BsonDocument keyDocument = getResourceAsDocument("keyDocument.json");
|
115
|
+
try (MongoCrypt mongoCrypt = createMongoCrypt()) {
|
116
|
+
// `encrypted` will contain encrypted fields.
|
117
|
+
BsonDocument encrypted = new BsonDocument();
|
118
|
+
{
|
119
|
+
for (int i = 0; i < NUM_FIELDS; i++) {
|
120
|
+
MongoExplicitEncryptOptions options = MongoExplicitEncryptOptions.builder()
|
121
|
+
.keyId(new BsonBinary(BsonBinarySubType.UUID_STANDARD, Base64.getDecoder().decode("YWFhYWFhYWFhYWFhYWFhYQ==")))
|
122
|
+
.algorithm("AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic")
|
123
|
+
.build();
|
124
|
+
BsonDocument toEncrypt = new BsonDocument("v", new BsonString(String.format("value %04d", i)));
|
125
|
+
try (MongoCryptContext ctx = mongoCrypt.createExplicitEncryptionContext(toEncrypt, options)) {
|
126
|
+
// If mongocrypt_t has not yet cached the DEK, supply it.
|
127
|
+
if (MongoCryptContext.State.NEED_MONGO_KEYS == ctx.getState()) {
|
128
|
+
ctx.addMongoOperationResult(keyDocument);
|
129
|
+
ctx.completeMongoOperation();
|
130
|
+
}
|
131
|
+
assert ctx.getState() == MongoCryptContext.State.READY;
|
132
|
+
RawBsonDocument result = ctx.finish();
|
133
|
+
BsonValue encryptedValue = result.get("v");
|
134
|
+
String key = String.format("key%04d", i);
|
135
|
+
encrypted.append(key, encryptedValue);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
// Warm up benchmark and discard the result.
|
141
|
+
DecryptTask warmup = new DecryptTask(mongoCrypt, encrypted, NUM_WARMUP_SECS, new CountDownLatch(1));
|
142
|
+
warmup.run();
|
143
|
+
|
144
|
+
// Decrypt `encrypted` and measure ops/sec.
|
145
|
+
// Check with varying thread counts to measure impact of a shared pool of Cipher instances.
|
146
|
+
int[] threadCounts = {1,2,8,64};
|
147
|
+
ArrayList<Long> totalMedianOpsPerSecs = new ArrayList<Long>(threadCounts.length);
|
148
|
+
ArrayList<String> createdAts = new ArrayList<String>(threadCounts.length);
|
149
|
+
ArrayList<String> completedAts = new ArrayList<String>(threadCounts.length);
|
150
|
+
|
151
|
+
for (int threadCount : threadCounts) {
|
152
|
+
ExecutorService executorService = Executors.newFixedThreadPool(threadCount);
|
153
|
+
CountDownLatch doneSignal = new CountDownLatch(threadCount);
|
154
|
+
ArrayList<DecryptTask> decryptTasks = new ArrayList<DecryptTask>(threadCount);
|
155
|
+
createdAts.add(ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
|
156
|
+
|
157
|
+
for (int i = 0; i < threadCount; i++) {
|
158
|
+
DecryptTask decryptTask = new DecryptTask(mongoCrypt, encrypted, NUM_SECS, doneSignal);
|
159
|
+
decryptTasks.add(decryptTask);
|
160
|
+
executorService.submit(decryptTask);
|
161
|
+
}
|
162
|
+
|
163
|
+
// Await completion of all tasks. Tasks are expected to complete shortly after NUM_SECS. Time out `await` if time exceeds 2 * NUM_SECS.
|
164
|
+
boolean ok = doneSignal.await(NUM_SECS * 2, TimeUnit.SECONDS);
|
165
|
+
assert ok;
|
166
|
+
completedAts.add(ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
|
167
|
+
// Sum the median ops/secs of all tasks to get total throughput.
|
168
|
+
long totalMedianOpsPerSec = 0;
|
169
|
+
for (DecryptTask decryptTask : decryptTasks) {
|
170
|
+
totalMedianOpsPerSec += decryptTask.getMedianOpsPerSecs();
|
171
|
+
}
|
172
|
+
System.out.printf("threadCount=%d. Decrypting 1500 fields median ops/sec : %d%n", threadCount, totalMedianOpsPerSec);
|
173
|
+
totalMedianOpsPerSecs.add(totalMedianOpsPerSec);
|
174
|
+
executorService.shutdown();
|
175
|
+
ok = executorService.awaitTermination(NUM_SECS * 2, TimeUnit.SECONDS);
|
176
|
+
assert ok;
|
177
|
+
}
|
178
|
+
|
179
|
+
// Print the results in JSON that can be accepted by the `perf.send` command.
|
180
|
+
// See https://docs.devprod.prod.corp.mongodb.com/evergreen/Project-Configuration/Project-Commands#perfsend for the expected `perf.send` input.
|
181
|
+
ArrayList<BsonDocument> resultsArray = new ArrayList<BsonDocument>(threadCounts.length);
|
182
|
+
for (int i = 0; i < threadCounts.length; i++) {
|
183
|
+
int threadCount = threadCounts[i];
|
184
|
+
long totalMedianOpsPerSec = totalMedianOpsPerSecs.get(i);
|
185
|
+
String createdAt = createdAts.get(i);
|
186
|
+
String completedAt = completedAts.get(i);
|
187
|
+
|
188
|
+
resultsArray.add(new BsonDocument()
|
189
|
+
.append("info", new BsonDocument()
|
190
|
+
.append("test_name", new BsonString("java_decrypt_1500"))
|
191
|
+
.append("args", new BsonDocument()
|
192
|
+
.append("threadCount", new BsonInt32(threadCount))))
|
193
|
+
.append("created_at", new BsonString(createdAt))
|
194
|
+
.append("completed_at", new BsonString(completedAt))
|
195
|
+
.append("artifacts", new BsonArray())
|
196
|
+
.append("metrics", new BsonArray(Arrays.asList(
|
197
|
+
new BsonDocument()
|
198
|
+
.append("name", new BsonString("medianOpsPerSec"))
|
199
|
+
.append("type", new BsonString("THROUGHPUT"))
|
200
|
+
.append("value", new BsonInt64(totalMedianOpsPerSec))
|
201
|
+
)))
|
202
|
+
.append("sub_tests", new BsonArray()));
|
203
|
+
}
|
204
|
+
|
205
|
+
BsonDocument results = new BsonDocument().append("results", new BsonArray(resultsArray));
|
206
|
+
String resultsString = results.toJson();
|
207
|
+
// Remove the prefix and suffix when writing to a file so only the [ ... ] array is included.
|
208
|
+
resultsString = resultsString.substring("{\"results\": ".length(), resultsString.length() - 1);
|
209
|
+
|
210
|
+
String resultsFilePath = "results.json";
|
211
|
+
try (OutputStreamWriter fileWriter = new OutputStreamWriter(new FileOutputStream(resultsFilePath), StandardCharsets.UTF_8)) {
|
212
|
+
fileWriter.write(resultsString);
|
213
|
+
}
|
214
|
+
System.out.println("Results written to file: " + resultsFilePath);
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"_id": {
|
3
|
+
"$binary": {
|
4
|
+
"base64": "YWFhYWFhYWFhYWFhYWFhYQ==",
|
5
|
+
"subType": "04"
|
6
|
+
}
|
7
|
+
},
|
8
|
+
"keyMaterial": {
|
9
|
+
"$binary": {
|
10
|
+
"base64": "ACR7Hm33dDOAAD7l2ubZhSpSUWK8BkALUY+qW3UgBAEcTV8sBwZnaAWnzDsmrX55dgmYHWfynDlJogC/e33u6pbhyXvFTs5ow9OLCuCWBJ39T/Ivm3kMaZJybkejY0V+uc4UEdHvVVz/SbitVnzs2WXdMGmo1/HmDRrxGYZjewFslquv8wtUHF5pyB+QDlQBd/al9M444/8bJZFbMSmtIg==",
|
11
|
+
"subType": "00"
|
12
|
+
}
|
13
|
+
},
|
14
|
+
"creationDate": {
|
15
|
+
"$date": "2023-08-21T14:28:20.875Z"
|
16
|
+
},
|
17
|
+
"updateDate": {
|
18
|
+
"$date": "2023-08-21T14:28:20.875Z"
|
19
|
+
},
|
20
|
+
"status": 0,
|
21
|
+
"masterKey": {
|
22
|
+
"provider": "local"
|
23
|
+
}
|
24
|
+
}
|