Skip to content

Commit

Permalink
DRIVERS-2515: Add a positive prose test for CreateEncryptedCollection. (
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryLukyanov committed Dec 14, 2022
1 parent 3634d56 commit 10122e7
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions source/client-side-encryption/tests/README.rst
Expand Up @@ -2586,3 +2586,33 @@ when attempting to create a collection with such invalid settings.
3. Expect an error from the server indicating a validation error at
``create.encryptedFields.fields.keyId``, which must be a UUID and not a
boolean value.

Case 4: Insert encrypted value
``````````````````````````````

This test is continuation of the case 1 and provides a way to complete inserting
with encrypted value.

1. Create a new create-collection options `Opts` including the following::

{
encryptedFields: {
fields: [{
path: "ssn",
bsonType: "string",
keyId: null
}]
}
}

2. Invoke `CreateEncryptedCollection(CE, DB, "testing1", Opts, "local", null)`
to obtain a new collection `Coll` and data key `key1`. Expect success.
3. Use `CE` to explicitly encrypt the string "123-45-6789" using
algorithm `Unindexed` and data key `key1`. Refer result as `encryptedPayload`.
4. Attempt to insert the following document into `Coll`::

{
ssn: <encryptedPayload>
}

Expect success.

0 comments on commit 10122e7

Please sign in to comment.