使用中の暗号化は、次の 2 つの機能で構成されています。
インストール
C ドライバーで使用中の暗号化を使用するには、依存関係libmongocryptが必要です。 libmongocrypt のインストール手順については、MongoDB マニュアルを参照してください。
libmongocrypt がインストールされたら、使用中の暗号化を有効にするよう要求するように -DENABLE_CLIENT_SIDE_ENCRYPTION=ON
を使用して C ドライバーを構成します。
$ cd mongo-c-driver $ mkdir cmake-build && cd cmake-build $ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_CLIENT_SIDE_ENCRYPTION=ON .. $ cmake --build . --target install
API
mongoc_client_encryption_t is used for explicit encryption and key management. mongoc_client_enable_auto_encryption and mongoc_client_pool_enable_auto_encryption is used to enable automatic encryption.
Queryable Encryption と CSFLE の機能は、一部の例外を除いて、同じ API の多くを共有します。
The supported algorithms documented in mongoc_client_encryption_encrypt_opts_set_algorithm do not apply to both features.
mongoc_auto_encryption_opts_set_encrypted_fields_map only applies to Queryable Encryption.
mongoc_auto_encryption_opts_set_schema_map only applies to CSFLE.
クエリ分析
自動暗号化機能をサポートするには、次のいずれかの依存関係が必要です。
mongocryptd
実行可能ファイル。 MongoDB マニュアルのドキュメント: mongocryptd のインストールと構成crypt_shared
ライブラリ。 MongoDB マニュアルのドキュメント:自動暗号化共有ライブラリ
A mongoc_client_t or mongoc_client_pool_t configured with auto encryption will automatically try to load the crypt_shared
library. If loading the crypt_shared
library fails, the mongoc_client_t or mongoc_client_pool_t will try to spawn the mongocryptd
process from the application's PATH
. To configure use of crypt_shared
and mongocryptd
see mongoc_auto_encryption_opts_set_extra.