-
Notifications
You must be signed in to change notification settings - Fork 208
Parse options for automatic encryption using libmongocrypt #1071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b65ee36
a19fdb0
123f9b0
08bac1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.0.1-dev+20191220git5ff8a05d97 | ||
1.0.1-dev+20200108gitb6cab3967e |
+0 −1 | CMakeLists.txt | |
+3 −18 | kms-message/src/kms_response_parser.c | |
+1 −1 | src/mongocrypt-buffer-private.h | |
+1 −7 | src/mongocrypt-buffer.c | |
+1 −2 | src/mongocrypt-crypto-private.h | |
+9 −18 | src/mongocrypt-crypto.c | |
+28 −59 | src/mongocrypt-ctx-encrypt.c | |
+0 −1 | src/mongocrypt.h.in | |
+0 −24 | test/data/kms-tests.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--TEST-- | ||
MongoDB\Driver\Manager::__construct(): auto encryption options | ||
--SKIPIF-- | ||
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?> | ||
<?php skip_if_not_libmongocrypt(); ?> | ||
--FILE-- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Cannot enable automatic field-level encryption. Please recompile with support for libmongocrypt using the with-mongodb-client-side-encryption configure switch."); This test will fail when FLE is not enabled. I propose you create a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the function, also added the counterpart and an additional test for when compiling without FLE as mentioned in the comment below. |
||
<?php | ||
|
||
$baseOptions = [ | ||
'keyVaultNamespace' => 'admin.dataKeys', | ||
'kmsProviders' => ['aws' => (object) ['accessKeyId' => 'abc', 'secretAccessKey' => 'def']] | ||
]; | ||
|
||
$tests = [ | ||
[], | ||
['keyVaultClient' => new MongoDB\Driver\Manager()], | ||
['schemaMap' => [ | ||
'default.default' => [ | ||
'properties' => [ | ||
'encrypted_objectId' => [ | ||
'encrypt' => [ | ||
'keyId' => [ | ||
[ | ||
'$binary' => [ | ||
'base64' => 'AAAAAAAAAAAAAAAAAAAAAA==', | ||
'subType' => '04', | ||
], | ||
], | ||
], | ||
'bsonType' => 'objectId', | ||
'algorithm' => 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic', | ||
], | ||
], | ||
], | ||
'bsonType' => 'object', | ||
], | ||
]], | ||
['bypassAutoEncryption' => true], | ||
['extraOptions' => ['mongocryptdBypassSpawn' => true]], | ||
]; | ||
|
||
foreach ($tests as $autoEncryptionOptions) { | ||
$manager = new MongoDB\Driver\Manager(null, [], ['autoEncryption' => $autoEncryptionOptions + $baseOptions]); | ||
} | ||
|
||
?> | ||
===DONE=== | ||
<?php exit(0); ?> | ||
--EXPECT-- | ||
===DONE=== |
Uh oh!
There was an error while loading. Please reload this page.