For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.

Install and Configure a Query Analysis Component

MongoDB uses the Automatic Encryption Shared Library (recommended) or the mongocryptd executable process to translate queries into encrypted queries, and to encrypt or decrypt data.

Follow the preceding tasks to install a Queryable Encryption compatible driver and dependencies before continuing.

The Automatic Encryption Shared Library is a dynamic library that enables your client application to perform automatic encryption. A dynamic library is a set of functionality accessed by an application at runtime rather than compile time. The Automatic Encryption Shared Library performs the following tasks:

  • Reads the encryption schema to determine which fields to encrypt or decrypt

  • Prevents your application from executing unsupported operations on encrypted fields

The Automatic Encryption Shared Library does not do any of the following:

  • Perform data encryption or decryption

  • Access the encryption key material

  • Listen for data over the network

The Automatic Encryption Shared Library is a preferred alternative to mongocryptd and doesn't require you to start another process to perform automatic encryption.

Important

Use the Automatic Encryption Shared Library

If you are starting a new project, use the Automatic Encryption Shared Library. The Automatic Encryption Shared Library replaces mongocryptd and does not require you to start a new process.

mongocryptd is installed with MongoDB Enterprise Server.

When you create a MongoDB client with In-Use Encryption, the mongocryptd process starts automatically by default.

The mongocryptd process:

  • Uses the specified automatic encryption rules to mark fields in read and write operations for encryption.

  • Prevents unsupported operations from executing on encrypted fields.

  • Parses the encryption schema specified for the database connection. Automatic encryption rules use a strict subset of JSON schema syntax. If the rules contain invalid automatic encryption syntax or any schema validation syntax, mongocryptd returns an error.

mongocryptd only performs the previous functions, and doesn't perform any of the following:

  • mongocryptd doesn't perform encryption or decryption

  • mongocryptd doesn't access any encryption key material

  • mongocryptd doesn't listen over the network

To perform field encryption and automatic decryption, the drivers use the Apache-licensed libmongocrypt library.

To download the Automatic Encryption Shared Library from the MongoDB Download Center, select the version and platform, then the library.

Tip

To view an expanded list of available releases and packages, see MongoDB Enterprise Downloads.

1

In the Version dropdown, select 8.0.15 (current).

2

In the Platform dropdown, select your platform.

3

In the Package dropdown, select crypt_shared.

4

Click Download.

To configure how your driver searches for the Automatic Encryption Shared Library, use the following parameters:

Name
Description

cryptSharedLibPath

Specifies the absolute path to the Automatic Encryption Shared Library package, crypt_shared. For example:

  • Linux: /usr/local/lib/mongo_crypt_v1.so

  • macOS: /usr/local/lib/mongo_crypt_v1.dylib

  • Windows: C:\path\to\bin\mongo_crypt_v1.dll

Default: undefined

cryptSharedLibRequired

Specifies if the driver must use the Automatic Encryption Shared Library. If true, the driver returns an error if the Automatic Encryption Shared Library is unavailable. If false, the driver performs the following sequence of actions:

  1. Attempts to use the Automatic Encryption Shared Library.

  2. If the Automatic Encryption Shared Library is unavailable, the driver attempts to start and connect to mongocryptd.

Default: false

To view an example demonstrating how to configure these parameters, see the Quick Start.

After installing a query analysis component, create a Customer Master Key in your Key Management System of choice.

Select your language
Rate this page