From 98dba648635f596d3c58ac3faa330eb11ffc30f7 Mon Sep 17 00:00:00 2001 From: Kevin Albertson Date: Wed, 17 Dec 2025 12:38:30 -0500 Subject: [PATCH] MONGOCRYPT-864 do not load crypt_shared in ClientEncryption --- pymongo/asynchronous/encryption.py | 4 +++- pymongo/synchronous/encryption.py | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pymongo/asynchronous/encryption.py b/pymongo/asynchronous/encryption.py index 4dfd36aa49..7f4f2f2a2f 100644 --- a/pymongo/asynchronous/encryption.py +++ b/pymongo/asynchronous/encryption.py @@ -714,10 +714,12 @@ def __init__( self._io_callbacks: Optional[_EncryptionIO] = _EncryptionIO( None, key_vault_coll, None, opts ) + + # Pass bypass_encryption=True to skip loading crypt_shared. self._encryption = AsyncExplicitEncrypter( self._io_callbacks, _create_mongocrypt_options( - kms_providers=kms_providers, schema_map=None, key_expiration_ms=key_expiration_ms + kms_providers=kms_providers, schema_map=None, key_expiration_ms=key_expiration_ms, bypass_encryption=True ), ) # Use the same key vault collection as the callback. diff --git a/pymongo/synchronous/encryption.py b/pymongo/synchronous/encryption.py index 2d666b9763..9ffa00cad6 100644 --- a/pymongo/synchronous/encryption.py +++ b/pymongo/synchronous/encryption.py @@ -707,10 +707,15 @@ def __init__( self._io_callbacks: Optional[_EncryptionIO] = _EncryptionIO( None, key_vault_coll, None, opts ) + + # Pass bypass_encryption=True to skip loading crypt_shared. self._encryption = ExplicitEncrypter( self._io_callbacks, _create_mongocrypt_options( - kms_providers=kms_providers, schema_map=None, key_expiration_ms=key_expiration_ms + kms_providers=kms_providers, + schema_map=None, + key_expiration_ms=key_expiration_ms, + bypass_encryption=True, ), ) # Use the same key vault collection as the callback.