You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/MongoDB.Driver.Tests/Specifications/client-side-encryption/prose-tests/ClientEncryptionProseTests.cs
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ public class ClientEncryptionProseTests
Perform all applicable operations on key vault collections (e.g. inserting an example data key, or running a find command) with readConcern/writeConcern "majority".
212
+
211
213
Data key and double encryption
212
214
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213
215
214
216
First, perform the setup.
215
217
216
218
#. Create a MongoClient without encryption enabled (referred to as ``client``). Enable command monitoring to listen for command_started events.
217
219
218
-
#. Using ``client``, drop the collections ``admin.datakeys`` and ``db.coll``.
220
+
#. Using ``client``, drop the collections ``keyvault.datakeys`` and ``db.coll``.
Configure both objects with ``keyVaultNamespace`` set to ``admin.datakeys``.
336
+
Configure both objects with ``keyVaultNamespace`` set to ``keyvault.datakeys``.
335
337
336
338
Configure ``client_encrypted`` to use the schema `external/external-schema.json <../external/external-schema.json>`_ for ``db.coll`` by setting a schema map like: ``{ "db.coll": <contents of external-schema.json>}``
337
339
@@ -354,7 +356,7 @@ First, perform the setup.
354
356
355
357
#. Using ``client``, drop and create the collection ``db.coll`` configured with the included JSON schema `limits/limits-schema.json <../limits/limits-schema.json>`_.
356
358
357
-
#. Using ``client``, drop the collection ``admin.datakeys``. Insert the document `limits/limits-key.json <../limits/limits-key.json>`_
359
+
#. Using ``client``, drop the collection ``keyvault.datakeys``. Insert the document `limits/limits-key.json <../limits/limits-key.json>`_
358
360
359
361
#. Create a MongoClient configured with auto encryption (referred to as ``client_encrypted``)
Configure with the ``keyVaultNamespace`` set to ``admin.datakeys``.
425
+
Configure with the ``keyVaultNamespace`` set to ``keyvault.datakeys``.
424
426
425
427
#. Using ``client_encrypted``, attempt to insert a document into ``db.view``. Expect an exception to be thrown containing the message: "cannot auto encrypt a view".
426
428
427
429
428
430
Corpus Test
429
-
===========
431
+
~~~~~~~~~~~
430
432
431
433
The corpus test exhaustively enumerates all ways to encrypt all BSON value types. Note, the test data includes BSON binary subtype 4 (or standard UUID), which MUST be decoded and encoded as subtype 4. Run the test as follows.
432
434
433
435
1. Create a MongoClient without encryption enabled (referred to as ``client``).
434
436
435
437
2. Using ``client``, drop and create the collection ``db.coll`` configured with the included JSON schema `corpus/corpus-schema.json <../corpus/corpus-schema.json>`_.
436
438
437
-
3. Using ``client``, drop the collection ``admin.datakeys``. Insert the documents `corpus/corpus-key-local.json <../corpus/corpus-key-local.json>`_ and `corpus/corpus-key-aws.json <../corpus/corpus-key-aws.json>`_.
439
+
3. Using ``client``, drop the collection ``keyvault.datakeys``. Insert the documents `corpus/corpus-key-local.json <../corpus/corpus-key-local.json>`_ and `corpus/corpus-key-aws.json <../corpus/corpus-key-aws.json>`_.
438
440
439
441
4. Create the following:
440
442
@@ -456,7 +458,7 @@ The corpus test exhaustively enumerates all ways to encrypt all BSON value types
Configure with the ``keyVaultNamespace`` set to ``keyvault.datakeys``.
616
+
617
+
Configure ``client_encrypted`` to use the schema `external/external-schema.json <../external/external-schema.json>`_ for ``db.coll`` by setting a schema map like: ``{ "db.coll": <contents of external-schema.json>}``
Drivers MAY pass a different port if they expect their testing infrastructure to be using port 27021. Pass a port that should be free.
630
+
631
+
#. Use ``client_encrypted`` to insert the document ``{"encrypted": "test"}`` into ``db.coll``. Expect a server selection error propagated from the internal MongoClient failing to connect to mongocryptd on port 27021.
632
+
633
+
Via bypassAutoEncryption
634
+
````````````````````````
635
+
636
+
The following tests that setting ``bypassAutoEncryption=true`` really does bypass spawning mongocryptd.
637
+
638
+
#. Create a MongoClient configured with auto encryption (referred to as ``client_encrypted``)
639
+
640
+
Configure the required options. Use the ``local`` KMS provider as follows:
Drivers MAY pass a different value to ``--port`` if they expect their testing infrastructure to be using port 27021. Pass a port that should be free.
659
+
660
+
#. Use ``client_encrypted`` to insert the document ``{"unencrypted": "test"}`` into ``db.coll``. Expect this to succeed.
661
+
662
+
#. Validate that mongocryptd was not spawned. Create a MongoClient to localhost:27021 (or whatever was passed via ``--port``) with serverSelectionTimeoutMS=1000. Run an ``isMaster`` command and ensure it fails with a server selection timeout.
0 commit comments