How to use the pymongocrypt.binding.lib.mongocrypt_setopt_schema_map function in pymongocrypt

To help you get started, we’ve selected a few pymongocrypt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mongodb / libmongocrypt / bindings / python / pymongocrypt / mongocrypt.py View on Github external
if not lib.mongocrypt_setopt_kms_provider_aws(
                    self.__crypt,
                    access_key_id, len(access_key_id),
                    secret_access_key, len(secret_access_key)):
                self.__raise_from_status()
        if 'local' in kms_providers:
            key = kms_providers['local']['key']
            with MongoCryptBinaryIn(key) as binary_key:
                if not lib.mongocrypt_setopt_kms_provider_local(
                        self.__crypt, binary_key.bin):
                    self.__raise_from_status()

        schema_map = self.__opts.schema_map
        if schema_map is not None:
            with MongoCryptBinaryIn(schema_map) as binary_schema_map:
                if not lib.mongocrypt_setopt_schema_map(
                        self.__crypt, binary_schema_map.bin):
                    self.__raise_from_status()

        if not lib.mongocrypt_setopt_crypto_hooks(
                self.__crypt, aes_256_cbc_encrypt, aes_256_cbc_decrypt,
                secure_random, hmac_sha_512, hmac_sha_256, sha_256, ffi.NULL):
            self.__raise_from_status()

        if not lib.mongocrypt_init(self.__crypt):
            self.__raise_from_status()