libmongocrypt-helper 1.7.4.0.1002 → 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 +40 -5
- data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +29 -24
- data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +1 -4
- data/ext/libmongocrypt/libmongocrypt/Earthfile +522 -0
- 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/CryptClient.cs +25 -6
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClientFactory.cs +8 -4
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Library.cs +35 -3
- 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.Example/MongoDB.Libmongocrypt.Example.csproj +1 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/BasicTests.cs +1 -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 +22 -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 +22 -7
- 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 +50 -6
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/encrypted-payload.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/{python/test/data/fle2-find-range-explicit → java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2}/int32/rangeopts.json +3 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/README.md +4 -771
- data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +86 -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 +232 -296
- data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/compat.py +6 -31
- 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 -254
- 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/requirements-test.txt +7 -0
- 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 +2 -10
- 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 +26 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/rangeopts.json +14 -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 +991 -343
- 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 +31 -6
- data/ext/libmongocrypt/libmongocrypt/cmake/IntelDFP.cmake +20 -227
- data/ext/libmongocrypt/libmongocrypt/cmake/Patch.cmake +54 -0
- data/ext/libmongocrypt/libmongocrypt/cmake/Platform.cmake +50 -0
- data/ext/libmongocrypt/libmongocrypt/cmake/mongocrypt-config.cmake +21 -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/c6-vault.repo +39 -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/fle2_aead_generate_tests.py +15 -24
- data/ext/libmongocrypt/libmongocrypt/etc/fle2_crypto.py +66 -54
- data/ext/libmongocrypt/libmongocrypt/etc/fle2_generate_tests.py +14 -23
- data/ext/libmongocrypt/libmongocrypt/etc/fle2v2_aead_generate_tests.py +32 -0
- data/ext/libmongocrypt/libmongocrypt/etc/format-all.sh +12 -0
- data/ext/libmongocrypt/libmongocrypt/etc/format.sh +16 -0
- data/ext/libmongocrypt/libmongocrypt/etc/install-package.sh +48 -0
- 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/mongo-inteldfp-libmongocrypt-pr-625.patch +13 -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/cng.c +381 -436
- data/ext/libmongocrypt/libmongocrypt/src/crypto/commoncrypto.c +162 -227
- data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +183 -248
- data/ext/libmongocrypt/libmongocrypt/src/crypto/none.c +33 -55
- data/ext/libmongocrypt/libmongocrypt/src/csfle-markup.cpp +175 -205
- data/ext/libmongocrypt/libmongocrypt/src/mc-array-private.h +10 -21
- data/ext/libmongocrypt/libmongocrypt/src/mc-array.c +44 -56
- data/ext/libmongocrypt/libmongocrypt/src/mc-check-conversions-private.h +4 -8
- data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +351 -463
- data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.test.cpp +59 -66
- data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +21 -11
- data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +175 -99
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle-blob-subtype-private.h +18 -10
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +69 -70
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +445 -439
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private-v2.h +41 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private.h +11 -18
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +135 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +109 -126
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +103 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private.h +28 -31
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +173 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +106 -125
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +130 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private.h +36 -44
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +382 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload.c +237 -278
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private-v2.h +133 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private.h +67 -56
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +437 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +454 -325
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common-private.h +69 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-common.c +182 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-private.h +23 -31
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-v2-private.h +85 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev-v2.c +142 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-uev.c +104 -231
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-range-operator-private.h +8 -7
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds-private.h +56 -56
- data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +520 -580
- data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +47 -66
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +67 -76
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +201 -190
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +55 -42
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +809 -558
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +177 -201
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +54 -53
- data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +188 -240
- data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +43 -35
- data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +484 -337
- data/ext/libmongocrypt/libmongocrypt/src/mc-reader-private.h +36 -71
- data/ext/libmongocrypt/libmongocrypt/src/mc-reader.c +111 -164
- data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +87 -65
- data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +153 -125
- data/ext/libmongocrypt/libmongocrypt/src/mc-writer-private.h +66 -0
- data/ext/libmongocrypt/libmongocrypt/src/mc-writer.c +141 -0
- data/ext/libmongocrypt/libmongocrypt/src/mlib/check.hpp +37 -55
- data/ext/libmongocrypt/libmongocrypt/src/mlib/endian.h +11 -11
- data/ext/libmongocrypt/libmongocrypt/src/mlib/error.h +27 -32
- data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +461 -499
- data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +256 -334
- data/ext/libmongocrypt/libmongocrypt/src/mlib/macros.h +4 -5
- data/ext/libmongocrypt/libmongocrypt/src/mlib/path.h +196 -231
- data/ext/libmongocrypt/libmongocrypt/src/mlib/path.test.c +56 -79
- data/ext/libmongocrypt/libmongocrypt/src/mlib/str.h +411 -530
- data/ext/libmongocrypt/libmongocrypt/src/mlib/str.test.c +116 -131
- data/ext/libmongocrypt/libmongocrypt/src/mlib/thread.h +17 -26
- data/ext/libmongocrypt/libmongocrypt/src/mlib/user-check.h +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary-private.h +1 -9
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary.c +31 -48
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer-private.h +55 -131
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer.c +442 -565
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo-private.h +1 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-collinfo.c +28 -45
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key-private.h +11 -17
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key.c +104 -132
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth-private.h +16 -24
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth.c +110 -93
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-private.h +26 -45
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache.c +220 -273
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext-private.h +13 -25
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ciphertext.c +147 -166
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-compat.h +2 -2
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto-private.h +110 -204
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +1145 -1567
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +510 -476
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +817 -694
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +2775 -2697
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-private.h +189 -184
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-rewrap-many-datakey.c +308 -351
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +990 -1139
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +23 -24
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endian-private.h +44 -58
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint-private.h +21 -25
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-endpoint.c +167 -181
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek-private.h +42 -44
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek.c +292 -272
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker-private.h +70 -110
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +1010 -1033
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-private.h +27 -44
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key.c +349 -402
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx-private.h +127 -120
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx.c +1692 -1611
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log-private.h +35 -67
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-log.c +49 -83
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +31 -36
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +1923 -1479
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-mutex-private.h +7 -12
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +124 -107
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +925 -419
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +99 -122
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status-private.h +3 -8
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-status.c +92 -119
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util-private.h +19 -29
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util.c +136 -176
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util-private.h +11 -21
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +98 -136
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +924 -1339
- data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.h +199 -313
- data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +83 -79
- data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_mutex.c +20 -28
- data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +64 -73
- data/ext/libmongocrypt/libmongocrypt/src/os_win/os_mutex.c +8 -16
- data/ext/libmongocrypt/libmongocrypt/test/crypt_shared-stub.cpp +57 -87
- 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-delete/empty/encrypted-payload-v2.json +60 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-payload-v2.json +67 -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 +5 -5
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-contentionFactor1-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-contentionFactor1-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-same-user-and-index-key-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/cmd.json +6 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/encrypted-field-map.json +22 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/encrypted-payload.json +40 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality-v2/mongocryptd-reply.json +19 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/cmd.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/cmd.json +6 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-field-map.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/encrypted-payload.json +50 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision-v2/mongocryptd-reply.json +58 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/cmd.json +6 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-field-map.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/cmd.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/encrypted-payload.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload-v2.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload-v2.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload-v2.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload-v2.json +26 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload-v2.json +16 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert/cmd.json +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/RNG_DATA.h +65 -65
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/cmd.json +13 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/RNG_DATA.h +132 -132
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/RNG_DATA.h +71 -71
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-field-map.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/encrypted-payload.json +53 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision-v2/mongocryptd-reply.json +61 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/RNG_DATA.h +68 -68
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/RNG_DATA.h +19 -19
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-field-map.json +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/encrypted-payload.json +47 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision-v2/mongocryptd-reply.json +55 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/RNG_DATA.h +25 -25
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/RNG_DATA.h +65 -65
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/cmd.json +11 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-field-map.json +27 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/encrypted-payload.json +44 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64-v2/mongocryptd-reply.json +52 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/RNG_DATA.h +68 -68
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/RNG_DATA.h +19 -19
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/RNG_DATA.h +25 -25
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/RNG_DATA.h +15 -15
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload-v2.json +8 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/encrypted-field-map.json +18 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/encrypted-payload.json +14 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed-v2/mongocryptd-reply.json +41 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/cmd.json +9 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/encrypted-field-map.json +22 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/encrypted-payload.json +39 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2/mongocryptd-reply.json +49 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneRangeV2.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneV2.json +10 -0
- 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/roundtrip/README.md +17 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/aes-ctr.json +29 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2-fixed.json +10 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2-generated.json +38 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-decrypt.json +35 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-fixed.json +29 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2aead-generated.json +122 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2v2-aead-fixed.json +29 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/fle2v2-aead-generated.json +122 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/mcgrew.json +12 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/roundtrip/nist.json +20 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/README.md +30 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +25 -0
- data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +25 -0
- data/ext/libmongocrypt/libmongocrypt/test/example-no-bson.c +4 -4
- data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +279 -323
- data/ext/libmongocrypt/libmongocrypt/test/fuzz_kms.c +8 -7
- data/ext/libmongocrypt/libmongocrypt/test/test-dll.cpp +6 -7
- data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +221 -283
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +60 -73
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-equality-payload-v2.c +78 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +129 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev-v2.c +248 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev.c +467 -414
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +248 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup.c +141 -159
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev-v2.c +338 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev.c +238 -176
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +373 -474
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +421 -388
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +974 -825
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +499 -481
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +312 -148
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-reader.c +124 -207
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +249 -213
- data/ext/libmongocrypt/libmongocrypt/test/test-mc-writer.c +176 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +632 -808
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.h +22 -2
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert.h +168 -189
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-buffer.c +187 -211
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache-oauth.c +118 -37
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache.c +210 -233
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ciphertext.c +185 -220
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cleanup.c +374 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +410 -445
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +798 -812
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +142 -135
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.h +70 -71
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto.c +394 -846
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +159 -183
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +870 -1045
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +5183 -4717
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +750 -964
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +1093 -1178
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +348 -420
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-dll.c +23 -30
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-endpoint.c +98 -111
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kek.c +49 -52
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-broker.c +770 -920
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-cache.c +354 -407
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key.c +197 -245
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +705 -368
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-responses.c +147 -166
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-local-kms.c +50 -61
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +85 -100
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +1073 -690
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-opts.c +42 -0
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-status.c +46 -58
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-traverse-util.c +381 -451
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.c +55 -67
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.h +7 -10
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +879 -918
- data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +119 -169
- 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 +512 -559
- data/ext/libmongocrypt/libmongocrypt/test/util/make_includes.py +1 -1
- data/ext/libmongocrypt/libmongocrypt/test/util/util.c +771 -882
- data/ext/libmongocrypt/libmongocrypt/test/util/util.h +33 -55
- data/lib/libmongocrypt_helper/version.rb +2 -2
- metadata +245 -111
- checksums.yaml.gz.sig +0 -0
- data/ext/libmongocrypt/libmongocrypt/VERSION_CURRENT +0 -1
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
- data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit/int32/key-document.json +0 -0
- data/ext/libmongocrypt/libmongocrypt/bindings/node/CHANGELOG.md +0 -81
- 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 -39
- data/ext/libmongocrypt/libmongocrypt/bindings/node/index.d.ts +0 -515
- 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 -699
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/common.js +0 -100
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/credentialsProvider.js +0 -33
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/cryptoCallbacks.js +0 -87
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js +0 -42
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/mongocryptdManager.js +0 -66
- data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/stateMachine.js +0 -487
- data/ext/libmongocrypt/libmongocrypt/bindings/node/package-lock.json +0 -16051
- data/ext/libmongocrypt/libmongocrypt/bindings/node/package.json +0 -81
- data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.cc +0 -929
- data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.h +0 -114
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/autoEncrypter.test.js +0 -953
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/buffer_pool.test.js +0 -91
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/clientEncryption.test.js +0 -701
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/credentialsProvider.test.js +0 -163
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/cryptoCallbacks.test.js +0 -284
- 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/mongocryptdManager.test.js +0 -48
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/release.test.js +0 -59
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/requirements.helper.js +0 -29
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/stateMachine.test.js +0 -331
- data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/mongodb_reporter.js +0 -325
- data/ext/libmongocrypt/libmongocrypt/bindings/python/setup.py +0 -84
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
- data/ext/libmongocrypt/libmongocrypt/bindings/python/test-requirements.txt +0 -12
- 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/aes-ctr.cstructs +0 -359
- data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/mongocryptd-reply.json +0 -72
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-aead.cstructs +0 -109
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload.json +0 -26
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/rangeopts.json +0 -5
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/RNG_DATA.h +0 -70
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload.json +0 -8
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/rangeopts.json +0 -5
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/value-to-encrypt.json +0 -5
- data/ext/libmongocrypt/libmongocrypt/test/data/fle2.cstructs +0 -33
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
- /data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/key-filter.json +0 -0
- /data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/value-to-encrypt.json +0 -0
- /data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/{fle2-find-range-explicit → fle2-find-range-explicit-v2}/int32/value-to-encrypt.json +0 -0
- /data/ext/libmongocrypt/libmongocrypt/bindings/{java/mongocrypt/src/test/resources/fle2-find-range-explicit → python/test/data/fle2-find-rangePreview-explicit}/int32/rangeopts.json +0 -0
- /data/ext/libmongocrypt/libmongocrypt/{test/data/fle2-find-range-explicit/int32-nominmax → bindings/python/test/data/fle2-find-rangePreview-explicit/int32}/value-to-encrypt.json +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
@@ -14,48 +14,23 @@
|
|
14
14
|
|
15
15
|
"""Utility functions and definitions for Python compatibility."""
|
16
16
|
|
17
|
-
import base64
|
18
17
|
import sys
|
19
18
|
|
20
|
-
PY3 = sys.version_info[0]
|
19
|
+
PY3 = sys.version_info[0] >= 3
|
21
20
|
|
22
21
|
if PY3:
|
23
22
|
from abc import ABC
|
23
|
+
|
24
24
|
unicode_type = str
|
25
25
|
else:
|
26
26
|
from abc import ABCMeta as _ABCMeta
|
27
|
-
|
28
|
-
|
27
|
+
|
28
|
+
ABC = _ABCMeta("ABC", (object,), {})
|
29
|
+
unicode_type = "unicode"
|
29
30
|
|
30
31
|
|
31
32
|
def str_to_bytes(string):
|
32
33
|
"""Convert a str (or unicode) to bytes."""
|
33
34
|
if isinstance(string, bytes):
|
34
35
|
return string
|
35
|
-
return string.encode(
|
36
|
-
|
37
|
-
|
38
|
-
def safe_bytearray_or_base64(data):
|
39
|
-
"""Convert the given value to a type that, when BSON-encoded can be safely
|
40
|
-
passed to libmongocrypt functions that expect a BSON document containing
|
41
|
-
BSON Binary data or a base64-encoded string.
|
42
|
-
|
43
|
-
pymongo.bson encodes bytes to BSON string in Python 2, while the
|
44
|
-
libmongocrypt API expects BSON Binary or a base64 encoded string.
|
45
|
-
To avoid needing to import bson.Binary, we return a base64 encoded string
|
46
|
-
when using Python 2.
|
47
|
-
"""
|
48
|
-
# On Python 3 byte-arrays are encoded as BSON Binary and
|
49
|
-
# base64 encoded strings can be passed as-is.
|
50
|
-
if PY3:
|
51
|
-
return data
|
52
|
-
|
53
|
-
# On Python 2 unicode literals are assumed to contain base64-encoded
|
54
|
-
# strings that can be passed to libmongocrypt as-is.
|
55
|
-
if isinstance(data, unicode_type):
|
56
|
-
return data
|
57
|
-
|
58
|
-
# On Python 2, all other types are assumed to contain raw bytes.
|
59
|
-
# To avoid importing bson.binary.Binary, we convert these to
|
60
|
-
# base64 strings.
|
61
|
-
return unicode_type(base64.b64encode(data))
|
36
|
+
return string.encode("utf-8")
|
@@ -11,126 +11,7 @@
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
|
-
import os
|
15
|
-
from collections import namedtuple
|
16
|
-
from datetime import datetime, timedelta
|
17
14
|
|
18
|
-
|
19
|
-
from pymongo_auth_aws.auth import aws_temp_credentials
|
20
|
-
_HAVE_AUTH_AWS = True
|
21
|
-
except ImportError:
|
22
|
-
_HAVE_AUTH_AWS = False
|
15
|
+
# Alias file for import compatibility
|
23
16
|
|
24
|
-
from pymongocrypt.
|
25
|
-
|
26
|
-
import requests
|
27
|
-
|
28
|
-
|
29
|
-
_azure_creds = namedtuple("_azure_creds", ["access_token", "expires_in"])
|
30
|
-
_azure_creds_cache = None
|
31
|
-
|
32
|
-
|
33
|
-
def _get_gcp_credentials():
|
34
|
-
"""Get on-demand GCP credentials"""
|
35
|
-
metadata_host = os.getenv("GCE_METADATA_HOST") or "metadata.google.internal"
|
36
|
-
url = "http://%s/computeMetadata/v1/instance/service-accounts/default/token" % metadata_host
|
37
|
-
|
38
|
-
headers = {"Metadata-Flavor": "Google"}
|
39
|
-
try:
|
40
|
-
response = requests.get(url, headers=headers)
|
41
|
-
except Exception as e:
|
42
|
-
msg = "unable to retrieve GCP credentials: %s" % e
|
43
|
-
raise MongoCryptError(msg)
|
44
|
-
|
45
|
-
if response.status_code != 200:
|
46
|
-
msg = "Unable to retrieve GCP credentials: expected StatusCode 200, got StatusCode: %s. Response body:\n%s" % (response.status_code, response.content)
|
47
|
-
raise MongoCryptError(msg)
|
48
|
-
try:
|
49
|
-
data = response.json()
|
50
|
-
except Exception:
|
51
|
-
raise MongoCryptError("unable to retrieve GCP credentials: error reading response body\n%s" % response.content)
|
52
|
-
|
53
|
-
if not data.get("access_token"):
|
54
|
-
msg = "unable to retrieve GCP credentials: got unexpected empty accessToken from GCP Metadata Server. Response body: %s" % response.content
|
55
|
-
raise MongoCryptError(msg)
|
56
|
-
|
57
|
-
return {'accessToken': data['access_token']}
|
58
|
-
|
59
|
-
|
60
|
-
def _get_azure_credentials():
|
61
|
-
"""Get on-demand Azure credentials"""
|
62
|
-
global _azure_creds_cache
|
63
|
-
# Credentials are considered expired when: Expiration - now < 1 mins.
|
64
|
-
creds = _azure_creds_cache
|
65
|
-
if creds:
|
66
|
-
if creds.expires_in - datetime.utcnow() < timedelta(seconds=60):
|
67
|
-
_azure_creds_cache = None
|
68
|
-
else:
|
69
|
-
return { 'accessToken': creds.access_token }
|
70
|
-
|
71
|
-
url = "http://169.254.169.254/metadata/identity/oauth2/token"
|
72
|
-
url += "?api-version=2018-02-01"
|
73
|
-
url += "&resource=https://vault.azure.net"
|
74
|
-
headers = { "Metadata": "true", "Accept": "application/json" }
|
75
|
-
try:
|
76
|
-
response = requests.get(url, headers=headers)
|
77
|
-
except Exception as e:
|
78
|
-
msg = "Failed to acquire IMDS access token: %s" % e
|
79
|
-
raise MongoCryptError(msg)
|
80
|
-
|
81
|
-
if response.status_code != 200:
|
82
|
-
msg = "Failed to acquire IMDS access token."
|
83
|
-
raise MongoCryptError(msg)
|
84
|
-
try:
|
85
|
-
data = response.json()
|
86
|
-
except Exception:
|
87
|
-
raise MongoCryptError("Azure IMDS response must be in JSON format.")
|
88
|
-
|
89
|
-
for key in ["access_token", "expires_in"]:
|
90
|
-
if not data.get(key):
|
91
|
-
msg = "Azure IMDS response must contain %s, but was %s."
|
92
|
-
msg = msg % (key, response.content)
|
93
|
-
raise MongoCryptError(msg)
|
94
|
-
|
95
|
-
try:
|
96
|
-
expires_in = int(data["expires_in"])
|
97
|
-
except ValueError:
|
98
|
-
raise MongoCryptError('Azure IMDS response must contain "expires_in" integer, but was %s.' % response.content)
|
99
|
-
|
100
|
-
expiration_time = datetime.utcnow() + timedelta(seconds=expires_in)
|
101
|
-
_azure_creds_cache = _azure_creds(data['access_token'], expiration_time)
|
102
|
-
return { 'accessToken': data['access_token'] }
|
103
|
-
|
104
|
-
|
105
|
-
def _ask_for_kms_credentials(kms_providers):
|
106
|
-
"""Get on-demand kms credentials.
|
107
|
-
|
108
|
-
This is a separate function so it can be overridden in unit tests."""
|
109
|
-
global _azure_creds_cache
|
110
|
-
on_demand_aws = 'aws' in kms_providers and not len(kms_providers['aws'])
|
111
|
-
on_demand_gcp = 'gcp' in kms_providers and not len(kms_providers['gcp'])
|
112
|
-
on_demand_azure = 'azure' in kms_providers and not len(kms_providers['azure'])
|
113
|
-
|
114
|
-
if not any([on_demand_aws, on_demand_gcp, on_demand_azure]):
|
115
|
-
return {}
|
116
|
-
creds = {}
|
117
|
-
if on_demand_aws:
|
118
|
-
if not _HAVE_AUTH_AWS:
|
119
|
-
raise RuntimeError(
|
120
|
-
"On-demand AWS credentials require pymongo-auth-aws: "
|
121
|
-
"install with: python -m pip install 'pymongo[aws]'"
|
122
|
-
)
|
123
|
-
aws_creds = aws_temp_credentials()
|
124
|
-
creds_dict = {"accessKeyId": aws_creds.username, "secretAccessKey": aws_creds.password}
|
125
|
-
if aws_creds.token:
|
126
|
-
creds_dict["sessionToken"] = aws_creds.token
|
127
|
-
creds['aws'] = creds_dict
|
128
|
-
if on_demand_gcp:
|
129
|
-
creds['gcp'] = _get_gcp_credentials()
|
130
|
-
if on_demand_azure:
|
131
|
-
try:
|
132
|
-
creds['azure'] = _get_azure_credentials()
|
133
|
-
except Exception:
|
134
|
-
_azure_creds_cache = None
|
135
|
-
raise
|
136
|
-
return creds
|
17
|
+
from pymongocrypt.synchronous.credentials import *
|
@@ -20,7 +20,7 @@ import traceback
|
|
20
20
|
from cryptography.hazmat.backends import default_backend
|
21
21
|
from cryptography.hazmat.primitives.asymmetric import padding
|
22
22
|
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
23
|
-
from cryptography.hazmat.primitives.hashes import
|
23
|
+
from cryptography.hazmat.primitives.hashes import SHA256, SHA512, Hash
|
24
24
|
from cryptography.hazmat.primitives.hmac import HMAC
|
25
25
|
from cryptography.hazmat.primitives.serialization import load_der_private_key
|
26
26
|
|
@@ -35,18 +35,19 @@ def _callback_error_handler(exception, exc_value, tb):
|
|
35
35
|
# if the whole function ran successfully but there was an error converting
|
36
36
|
# the value returned: this occurs after the call)."
|
37
37
|
if tb is not None:
|
38
|
-
status = tb.tb_frame.f_locals[
|
39
|
-
msg = str_to_bytes(
|
40
|
-
exception, exc_value, tb))
|
38
|
+
status = tb.tb_frame.f_locals["status"]
|
39
|
+
msg = str_to_bytes(
|
40
|
+
"".join(traceback.format_exception(exception, exc_value, tb))
|
41
|
+
)
|
41
42
|
lib.mongocrypt_status_set(
|
42
|
-
status, lib.MONGOCRYPT_STATUS_ERROR_CLIENT, 1, msg, -1
|
43
|
+
status, lib.MONGOCRYPT_STATUS_ERROR_CLIENT, 1, msg, -1
|
44
|
+
)
|
43
45
|
|
44
46
|
return False
|
45
47
|
|
46
48
|
|
47
49
|
def _aes_256_encrypt(key, mode, input, output, bytes_written):
|
48
|
-
cipher = Cipher(algorithms.AES(_to_bytes(key)), mode,
|
49
|
-
backend=default_backend())
|
50
|
+
cipher = Cipher(algorithms.AES(_to_bytes(key)), mode, backend=default_backend())
|
50
51
|
encryptor = cipher.encryptor()
|
51
52
|
data = encryptor.update(_to_bytes(input)) + encryptor.finalize()
|
52
53
|
_write_bytes(output, data)
|
@@ -54,8 +55,7 @@ def _aes_256_encrypt(key, mode, input, output, bytes_written):
|
|
54
55
|
|
55
56
|
|
56
57
|
def _aes_256_decrypt(key, mode, input, output, bytes_written):
|
57
|
-
cipher = Cipher(algorithms.AES(_to_bytes(key)), mode,
|
58
|
-
backend=default_backend())
|
58
|
+
cipher = Cipher(algorithms.AES(_to_bytes(key)), mode, backend=default_backend())
|
59
59
|
decryptor = cipher.decryptor()
|
60
60
|
data = decryptor.update(_to_bytes(input)) + decryptor.finalize()
|
61
61
|
_write_bytes(output, data)
|
@@ -66,7 +66,8 @@ def _aes_256_decrypt(key, mode, input, output, bytes_written):
|
|
66
66
|
"bool(void *, mongocrypt_binary_t *, mongocrypt_binary_t *,"
|
67
67
|
" mongocrypt_binary_t *, mongocrypt_binary_t *, uint32_t *,"
|
68
68
|
" mongocrypt_status_t *)",
|
69
|
-
onerror=_callback_error_handler
|
69
|
+
onerror=_callback_error_handler,
|
70
|
+
)
|
70
71
|
def aes_256_cbc_encrypt(ctx, key, iv, input, output, bytes_written, status):
|
71
72
|
# Note that libmongocrypt pads the input before calling this method.
|
72
73
|
_aes_256_encrypt(key, modes.CBC(_to_bytes(iv)), input, output, bytes_written)
|
@@ -77,7 +78,8 @@ def aes_256_cbc_encrypt(ctx, key, iv, input, output, bytes_written, status):
|
|
77
78
|
"bool(void *, mongocrypt_binary_t *, mongocrypt_binary_t *,"
|
78
79
|
" mongocrypt_binary_t *, mongocrypt_binary_t *, uint32_t *,"
|
79
80
|
" mongocrypt_status_t *)",
|
80
|
-
onerror=_callback_error_handler
|
81
|
+
onerror=_callback_error_handler,
|
82
|
+
)
|
81
83
|
def aes_256_cbc_decrypt(ctx, key, iv, input, output, bytes_written, status):
|
82
84
|
# Note that libmongocrypt pads the input before calling this method.
|
83
85
|
_aes_256_decrypt(key, modes.CBC(_to_bytes(iv)), input, output, bytes_written)
|
@@ -88,7 +90,8 @@ def aes_256_cbc_decrypt(ctx, key, iv, input, output, bytes_written, status):
|
|
88
90
|
"bool(void *, mongocrypt_binary_t *, mongocrypt_binary_t *,"
|
89
91
|
" mongocrypt_binary_t *, mongocrypt_binary_t *, uint32_t *,"
|
90
92
|
" mongocrypt_status_t *)",
|
91
|
-
onerror=_callback_error_handler
|
93
|
+
onerror=_callback_error_handler,
|
94
|
+
)
|
92
95
|
def aes_256_ctr_encrypt(ctx, key, iv, input, output, bytes_written, status):
|
93
96
|
_aes_256_encrypt(key, modes.CTR(_to_bytes(iv)), input, output, bytes_written)
|
94
97
|
return True
|
@@ -98,7 +101,8 @@ def aes_256_ctr_encrypt(ctx, key, iv, input, output, bytes_written, status):
|
|
98
101
|
"bool(void *, mongocrypt_binary_t *, mongocrypt_binary_t *,"
|
99
102
|
" mongocrypt_binary_t *, mongocrypt_binary_t *, uint32_t *,"
|
100
103
|
" mongocrypt_status_t *)",
|
101
|
-
onerror=_callback_error_handler
|
104
|
+
onerror=_callback_error_handler,
|
105
|
+
)
|
102
106
|
def aes_256_ctr_decrypt(ctx, key, iv, input, output, bytes_written, status):
|
103
107
|
_aes_256_decrypt(key, modes.CTR(_to_bytes(iv)), input, output, bytes_written)
|
104
108
|
return True
|
@@ -107,7 +111,8 @@ def aes_256_ctr_decrypt(ctx, key, iv, input, output, bytes_written, status):
|
|
107
111
|
@ffi.callback(
|
108
112
|
"bool(void *, mongocrypt_binary_t *, mongocrypt_binary_t *, "
|
109
113
|
" mongocrypt_binary_t *, mongocrypt_status_t *)",
|
110
|
-
onerror=_callback_error_handler
|
114
|
+
onerror=_callback_error_handler,
|
115
|
+
)
|
111
116
|
def hmac_sha_256(ctx, key, input, output, status):
|
112
117
|
h = HMAC(_to_bytes(key), SHA256(), backend=default_backend())
|
113
118
|
h.update(_to_bytes(input))
|
@@ -119,7 +124,8 @@ def hmac_sha_256(ctx, key, input, output, status):
|
|
119
124
|
@ffi.callback(
|
120
125
|
"bool(void *, mongocrypt_binary_t *, mongocrypt_binary_t *, "
|
121
126
|
" mongocrypt_binary_t *, mongocrypt_status_t *)",
|
122
|
-
onerror=_callback_error_handler
|
127
|
+
onerror=_callback_error_handler,
|
128
|
+
)
|
123
129
|
def hmac_sha_512(ctx, key, input, output, status):
|
124
130
|
h = HMAC(_to_bytes(key), SHA512(), backend=default_backend())
|
125
131
|
h.update(_to_bytes(input))
|
@@ -131,7 +137,8 @@ def hmac_sha_512(ctx, key, input, output, status):
|
|
131
137
|
@ffi.callback(
|
132
138
|
"bool(void *, mongocrypt_binary_t *, mongocrypt_binary_t *, "
|
133
139
|
" mongocrypt_status_t *)",
|
134
|
-
onerror=_callback_error_handler
|
140
|
+
onerror=_callback_error_handler,
|
141
|
+
)
|
135
142
|
def sha_256(ctx, input, output, status):
|
136
143
|
digest = Hash(SHA256(), backend=default_backend())
|
137
144
|
digest.update(_to_bytes(input))
|
@@ -142,7 +149,8 @@ def sha_256(ctx, input, output, status):
|
|
142
149
|
|
143
150
|
@ffi.callback(
|
144
151
|
"bool(void *, mongocrypt_binary_t *, uint32_t, mongocrypt_status_t *)",
|
145
|
-
onerror=_callback_error_handler
|
152
|
+
onerror=_callback_error_handler,
|
153
|
+
)
|
146
154
|
def secure_random(ctx, output, count, status):
|
147
155
|
data = os.urandom(int(count))
|
148
156
|
_write_bytes(output, data)
|
@@ -152,11 +160,14 @@ def secure_random(ctx, output, count, status):
|
|
152
160
|
@ffi.callback(
|
153
161
|
"bool(void *, mongocrypt_binary_t *, mongocrypt_binary_t *, "
|
154
162
|
" mongocrypt_binary_t *, mongocrypt_status_t *)",
|
155
|
-
onerror=_callback_error_handler
|
163
|
+
onerror=_callback_error_handler,
|
164
|
+
)
|
156
165
|
def sign_rsaes_pkcs1_v1_5(ctx, key, input, output, status):
|
157
166
|
rsa_private_key = load_der_private_key(
|
158
|
-
_to_bytes(key), password=None, backend=default_backend()
|
167
|
+
_to_bytes(key), password=None, backend=default_backend()
|
168
|
+
)
|
159
169
|
signature = rsa_private_key.sign(
|
160
|
-
_to_bytes(input), padding=padding.PKCS1v15(), algorithm=SHA256()
|
170
|
+
_to_bytes(input), padding=padding.PKCS1v15(), algorithm=SHA256()
|
171
|
+
)
|
161
172
|
_write_bytes(output, signature)
|
162
173
|
return True
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
from pymongocrypt.binding import ffi, lib
|
15
|
+
from pymongocrypt.binding import _to_string, ffi, lib
|
16
16
|
|
17
17
|
|
18
18
|
class MongoCryptError(Exception):
|
@@ -23,7 +23,7 @@ class MongoCryptError(Exception):
|
|
23
23
|
- `msg`: An error message.
|
24
24
|
- `code`: The mongocrypt_status_t code.
|
25
25
|
"""
|
26
|
-
super(
|
26
|
+
super().__init__(msg)
|
27
27
|
self.code = code
|
28
28
|
|
29
29
|
@classmethod
|
@@ -12,237 +12,6 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
|
16
|
-
from pymongocrypt.state_machine import run_state_machine
|
15
|
+
# Alias file for import compatibility
|
17
16
|
|
18
|
-
|
19
|
-
class ExplicitEncryptOpts(object):
|
20
|
-
def __init__(self, algorithm, key_id=None, key_alt_name=None,
|
21
|
-
query_type=None, contention_factor=None, range_opts=None,
|
22
|
-
is_expression=False):
|
23
|
-
"""Options for explicit encryption.
|
24
|
-
|
25
|
-
:Parameters:
|
26
|
-
- `algorithm` (str): The algorithm to use.
|
27
|
-
- `key_id`: The data key _id.
|
28
|
-
- `key_alt_name` (bytes): Identifies a key vault document by
|
29
|
-
'keyAltName'. Must be BSON encoded document in the form:
|
30
|
-
{ "keyAltName" : (BSON UTF8 value) }
|
31
|
-
- `query_type` (str): The query type to execute.
|
32
|
-
- `contention_factor` (int): The contention factor to use
|
33
|
-
when the algorithm is "Indexed".
|
34
|
-
- `range_opts` (bytes): Options for explicit encryption
|
35
|
-
with the "rangePreview" algorithm encoded as a BSON document.
|
36
|
-
- `is_expression` (boolean): True if this is an encryptExpression()
|
37
|
-
context. Defaults to False.
|
38
|
-
|
39
|
-
.. versionchanged:: 1.3
|
40
|
-
Added the `query_type` and `contention_factor` parameters.
|
41
|
-
.. versionchanged:: 1.5
|
42
|
-
Added the `range_opts` and `is_expression` parameters.
|
43
|
-
"""
|
44
|
-
self.algorithm = algorithm
|
45
|
-
self.key_id = key_id
|
46
|
-
self.key_alt_name = key_alt_name
|
47
|
-
if query_type is not None:
|
48
|
-
if not isinstance(query_type, str):
|
49
|
-
raise TypeError(
|
50
|
-
'query_type must be str or None, not: %r' % (type(query_type),))
|
51
|
-
self.query_type = query_type
|
52
|
-
if contention_factor is not None and not isinstance(contention_factor, int):
|
53
|
-
raise TypeError(
|
54
|
-
'contention_factor must be an int or None, not: %r' % (type(contention_factor),))
|
55
|
-
self.contention_factor = contention_factor
|
56
|
-
if range_opts is not None and not isinstance(range_opts, bytes):
|
57
|
-
raise TypeError(
|
58
|
-
'range_opts must be an bytes or None, not: %r' % (type(contention_factor),))
|
59
|
-
self.range_opts = range_opts
|
60
|
-
self.is_expression = is_expression
|
61
|
-
|
62
|
-
|
63
|
-
class DataKeyOpts(object):
|
64
|
-
def __init__(self, master_key=None, key_alt_names=None, key_material=None):
|
65
|
-
"""Options for creating encryption keys.
|
66
|
-
|
67
|
-
:Parameters:
|
68
|
-
- `master_key`: Identifies a KMS-specific key used to encrypt the
|
69
|
-
new data key. If the kmsProvider is "local" the `master_key` is
|
70
|
-
not applicable and may be omitted.
|
71
|
-
|
72
|
-
If the `kms_provider` is "aws" it is required and has the
|
73
|
-
following fields::
|
74
|
-
|
75
|
-
- `region` (string): Required. The AWS region, e.g. "us-east-1".
|
76
|
-
- `key` (string): Required. The Amazon Resource Name (ARN) to
|
77
|
-
the AWS customer.
|
78
|
-
- `endpoint` (string): Optional. An alternate host to send KMS
|
79
|
-
requests to. May include port number, e.g.
|
80
|
-
"kms.us-east-1.amazonaws.com:443".
|
81
|
-
|
82
|
-
If the `kms_provider` is "azure" it is required and has the
|
83
|
-
following fields::
|
84
|
-
|
85
|
-
- `keyVaultEndpoint` (string): Required. Host with optional
|
86
|
-
port, e.g. "example.vault.azure.net".
|
87
|
-
- `keyName` (string): Required. Key name in the key vault.
|
88
|
-
- `keyVersion` (string): Optional. Version of the key to use.
|
89
|
-
|
90
|
-
If the `kms_provider` is "gcp" it is required and has the
|
91
|
-
following fields::
|
92
|
-
|
93
|
-
- `projectId` (string): Required. The Google cloud project ID.
|
94
|
-
- `location` (string): Required. The GCP location, e.g. "us-east1".
|
95
|
-
- `keyRing` (string): Required. Name of the key ring that contains
|
96
|
-
the key to use.
|
97
|
-
- `keyName` (string): Required. Name of the key to use.
|
98
|
-
- `keyVersion` (string): Optional. Version of the key to use.
|
99
|
-
- `endpoint` (string): Optional. Host with optional port.
|
100
|
-
Defaults to "cloudkms.googleapis.com".
|
101
|
-
|
102
|
-
If the `kms_provider` is "kmip" it is optional and has the
|
103
|
-
following fields::
|
104
|
-
|
105
|
-
- `keyId` (string): Optional. `keyId` is the KMIP Unique
|
106
|
-
Identifier to a 96 byte KMIP Secret Data managed object. If
|
107
|
-
keyId is omitted, the driver creates a random 96 byte KMIP
|
108
|
-
Secret Data managed object.
|
109
|
-
- `endpoint` (string): Optional. Host with optional
|
110
|
-
port, e.g. "example.vault.azure.net:".
|
111
|
-
|
112
|
-
- `key_alt_names`: An optional list of bytes suitable to be passed to
|
113
|
-
mongocrypt_ctx_setopt_key_alt_name. Each element must be BSON
|
114
|
-
encoded document in the form: { "keyAltName" : (BSON UTF8 value) }
|
115
|
-
|
116
|
-
- `key_material`: An optional binary value of 96 bytes to use as
|
117
|
-
custom key material for the data key being created. If
|
118
|
-
``key_material`` is given, the custom key material is used for
|
119
|
-
encrypting and decrypting data. Otherwise, the key material for the
|
120
|
-
new data key is generated from a cryptographically secure random
|
121
|
-
device.
|
122
|
-
"""
|
123
|
-
self.master_key = master_key
|
124
|
-
self.key_alt_names = key_alt_names
|
125
|
-
self.key_material = key_material
|
126
|
-
|
127
|
-
|
128
|
-
class ExplicitEncrypter(object):
|
129
|
-
def __init__(self, callback, mongo_crypt_opts):
|
130
|
-
"""Encrypts and decrypts BSON values.
|
131
|
-
|
132
|
-
This class is used by a driver to support explicit encryption and
|
133
|
-
decryption of individual fields in a BSON document.
|
134
|
-
|
135
|
-
:Parameters:
|
136
|
-
- `callback`: A :class:`MongoCryptCallback`.
|
137
|
-
- `mongo_crypt_opts`: A :class:`MongoCryptOptions`.
|
138
|
-
"""
|
139
|
-
self.callback = callback
|
140
|
-
if mongo_crypt_opts.schema_map is not None:
|
141
|
-
raise ValueError("mongo_crypt_opts.schema_map must be None")
|
142
|
-
self.mongocrypt = MongoCrypt(mongo_crypt_opts, callback)
|
143
|
-
|
144
|
-
def create_data_key(self, kms_provider, master_key=None,
|
145
|
-
key_alt_names=None, key_material=None):
|
146
|
-
"""Creates a data key used for explicit encryption.
|
147
|
-
|
148
|
-
:Parameters:
|
149
|
-
- `kms_provider`: The KMS provider to use. Supported values are
|
150
|
-
"aws", "azure", "gcp", "kmip", and "local".
|
151
|
-
- `master_key`: See class:`DataKeyOpts`.
|
152
|
-
- `key_alt_names` (optional): An optional list of string alternate
|
153
|
-
names used to reference a key. If a key is created with alternate
|
154
|
-
names, then encryption may refer to the key by the unique
|
155
|
-
alternate name instead of by ``_id``.
|
156
|
-
- `key_material`: (optional) See class:`DataKeyOpts`.
|
157
|
-
|
158
|
-
:Returns:
|
159
|
-
The _id of the created data key document.
|
160
|
-
"""
|
161
|
-
# CDRIVER-3275 each key_alt_name needs to be wrapped in a bson
|
162
|
-
# document.
|
163
|
-
encoded_names = []
|
164
|
-
if key_alt_names is not None:
|
165
|
-
for name in key_alt_names:
|
166
|
-
encoded_names.append(
|
167
|
-
self.callback.bson_encode({'keyAltName': name}))
|
168
|
-
|
169
|
-
if key_material is not None:
|
170
|
-
key_material = self.callback.bson_encode({'keyMaterial': key_material})
|
171
|
-
|
172
|
-
opts = DataKeyOpts(master_key, encoded_names, key_material)
|
173
|
-
with self.mongocrypt.data_key_context(kms_provider, opts) as ctx:
|
174
|
-
key = run_state_machine(ctx, self.callback)
|
175
|
-
return self.callback.insert_data_key(key)
|
176
|
-
|
177
|
-
def rewrap_many_data_key(self, filter, provider=None, master_key=None):
|
178
|
-
"""Decrypts and encrypts all matching data keys with a possibly new `master_key` value.
|
179
|
-
|
180
|
-
:Parameters:
|
181
|
-
- `filter`: A document used to filter the data keys.
|
182
|
-
- `provider`: (optional) The name of a different kms provider.
|
183
|
-
- `master_key`: Optional document for the given provider.
|
184
|
-
|
185
|
-
:Returns:
|
186
|
-
A binary document with the rewrap data.
|
187
|
-
"""
|
188
|
-
with self.mongocrypt.rewrap_many_data_key_context(filter, provider, master_key) as ctx:
|
189
|
-
return run_state_machine(ctx, self.callback)
|
190
|
-
|
191
|
-
def encrypt(self, value, algorithm, key_id=None, key_alt_name=None,
|
192
|
-
query_type=None, contention_factor=None, range_opts=None,
|
193
|
-
is_expression=False):
|
194
|
-
"""Encrypts a BSON value.
|
195
|
-
|
196
|
-
Note that exactly one of ``key_id`` or ``key_alt_name`` must be
|
197
|
-
provided.
|
198
|
-
|
199
|
-
:Parameters:
|
200
|
-
- `value` (bytes): The BSON value to encrypt.
|
201
|
-
- `algorithm` (string): The encryption algorithm to use. See
|
202
|
-
:class:`Algorithm` for some valid options.
|
203
|
-
- `key_id` (bytes): The bytes of the binary subtype 4 ``_id`` data
|
204
|
-
key. For example, ``uuid.bytes`` or ``bytes(bson_binary)``.
|
205
|
-
- `key_alt_name` (string): Identifies a key vault document by
|
206
|
-
'keyAltName'.
|
207
|
-
- `query_type` (str): The query type to execute.
|
208
|
-
- `contention_factor` (int): The contention factor to use
|
209
|
-
when the algorithm is "Indexed".
|
210
|
-
- `range_opts` (bytes): Options for explicit encryption
|
211
|
-
with the "rangePreview" algorithm encoded as a BSON document.
|
212
|
-
- `is_expression` (boolean): True if this is an encryptExpression()
|
213
|
-
context. Defaults to False.
|
214
|
-
|
215
|
-
:Returns:
|
216
|
-
The encrypted BSON value.
|
217
|
-
|
218
|
-
.. versionchanged:: 1.3
|
219
|
-
Added the `query_type` and `contention_factor` parameters.
|
220
|
-
.. versionchanged:: 1.5
|
221
|
-
Added the `range_opts` and `is_expression` parameters.
|
222
|
-
"""
|
223
|
-
# CDRIVER-3275 key_alt_name needs to be wrapped in a bson document.
|
224
|
-
if key_alt_name is not None:
|
225
|
-
key_alt_name = self.callback.bson_encode(
|
226
|
-
{'keyAltName': key_alt_name})
|
227
|
-
opts = ExplicitEncryptOpts(
|
228
|
-
algorithm, key_id, key_alt_name, query_type, contention_factor,
|
229
|
-
range_opts, is_expression)
|
230
|
-
with self.mongocrypt.explicit_encryption_context(value, opts) as ctx:
|
231
|
-
return run_state_machine(ctx, self.callback)
|
232
|
-
|
233
|
-
def decrypt(self, value):
|
234
|
-
"""Decrypts a BSON value.
|
235
|
-
|
236
|
-
:Parameters:
|
237
|
-
- `value`: The encoded document to decrypt, which must be in the
|
238
|
-
form { "v" : encrypted BSON value }}.
|
239
|
-
|
240
|
-
:Returns:
|
241
|
-
The decrypted BSON value.
|
242
|
-
"""
|
243
|
-
with self.mongocrypt.explicit_decryption_context(value) as ctx:
|
244
|
-
return run_state_machine(ctx, self.callback)
|
245
|
-
|
246
|
-
def close(self):
|
247
|
-
"""Cleanup resources."""
|
248
|
-
self.mongocrypt.close()
|
17
|
+
from pymongocrypt.synchronous.explicit_encrypter import *
|