Working with Encryption

1. Using Encryption at Rest

AspectDetail
EditionEnterprise / Atlas
EngineWiredTiger AES-256
Configsecurity.enableEncryption: true + encryptionKeyFile or KMIP

2. Configuring KMIP for Key Management

SettingDetail
security.kmip.serverNameKMIP server host
security.kmip.clientCertificateFileAuth cert
security.kmip.keyIdentifierExisting key (optional)

3. Understanding Client-Side Field Encryption

ModeDetail
CSFLEEncrypts fields before sending to server
KeysDEKs in __keyVault, wrapped by CMK (KMS)
Server visibilityEncrypted blobs only

4. Creating Data Encryption Keys

const clientEnc = client.getClientEncryption();
const keyId = await clientEnc.createDataKey("aws", { masterKey: { region:"us-east-1", key:"arn:..." } });

5. Encrypting Specific Fields

AlgorithmUse
AEAD_AES_256_CBC_HMAC_SHA_512-DeterministicEquality queryable
...RandomStronger; not queryable

6. Decrypting Encrypted Fields

AspectDetail
AutomaticDriver reads schema and decrypts
ExplicitclientEnc.decrypt(value)

7. Using Automatic Encryption

RequirementDetail
mongocryptd / shared libPerforms schema-based redaction
SchemaJSON schema with encrypt keyword

8. Using Explicit Encryption

APIDetail
clientEnc.encrypt(value, opts)Per-field encrypt
UseWhen schema not feasible

9. Rotating Encryption Keys

LevelMethod
CMKRe-wrap DEKs via clientEnc.rewrapManyDataKey()
DEKCreate new key + re-encrypt fields

10. Configuring Queryable Encryption 7.0 GA

CapabilityDetail
Server-side queriesEquality, range (preview) on encrypted fields
ConfigencryptedFields per collection
BenefitServer never sees plaintext