encryption_options – Automatic Client-Side Field Level Encryption (original) (raw)

View this page

Toggle table of contents sidebar

Support for automatic client-side field level encryption.

See also

This module is compatible with both the synchronous and asynchronous PyMongo APIs.

class pymongo.encryption_options.AutoEncryptionOpts(kms_providers, key_vault_namespace, key_vault_client=None, schema_map=None, bypass_auto_encryption=False, mongocryptd_uri='mongodb://localhost:27020', mongocryptd_bypass_spawn=False, mongocryptd_spawn_path='mongocryptd', mongocryptd_spawn_args=None, kms_tls_options=None, crypt_shared_lib_path=None, crypt_shared_lib_required=False, bypass_query_analysis=False, encrypted_fields_map=None, key_expiration_ms=None)

Options to configure automatic client-side field level encryption.

Automatic client-side field level encryption requires MongoDB >=4.2 enterprise or a MongoDB >=4.2 Atlas cluster. Automatic encryption is not supported for operations on a database or view and will result in error.

Although automatic encryption requires MongoDB >=4.2 enterprise or a MongoDB >=4.2 Atlas cluster, automatic decryption is supported for all users. To configure automatic decryption without automatic_encryption_ set bypass_auto_encryption=True. Explicit encryption and explicit decryption is also supported for all users with the AsyncClientEncryption and ClientEncryption classes.

See Automatic Client-Side Field Level Encryption for an example.

Parameters:

Changed in version 4.12: Added the key_expiration_ms parameter.

Changed in version 4.2: Added the encrypted_fields_map, crypt_shared_lib_path, crypt_shared_lib_required, and bypass_query_analysis parameters.

Changed in version 4.0: Added the kms_tls_options parameter and the “kmip” KMS provider.

Added in version 3.9.

class pymongo.encryption_options.RangeOpts(sparsity=None, trim_factor=None, min=None, max=None, precision=None)

Options to configure encrypted queries using the range algorithm.

Parameters:

Added in version 4.4.