1{
2 "description": "rewrapManyDataKey",
3 "schemaVersion": "1.8",
4 "runOnRequirements": [
5 {
6 "csfle": true
7 }
8 ],
9 "createEntities": [
10 {
11 "client": {
12 "id": "client0",
13 "observeEvents": [
14 "commandStartedEvent"
15 ]
16 }
17 },
18 {
19 "clientEncryption": {
20 "id": "clientEncryption0",
21 "clientEncryptionOpts": {
22 "keyVaultClient": "client0",
23 "keyVaultNamespace": "keyvault.datakeys",
24 "kmsProviders": {
25 "aws": {
26 "accessKeyId": {
27 "$$placeholder": 1
28 },
29 "secretAccessKey": {
30 "$$placeholder": 1
31 }
32 },
33 "azure": {
34 "tenantId": {
35 "$$placeholder": 1
36 },
37 "clientId": {
38 "$$placeholder": 1
39 },
40 "clientSecret": {
41 "$$placeholder": 1
42 }
43 },
44 "gcp": {
45 "email": {
46 "$$placeholder": 1
47 },
48 "privateKey": {
49 "$$placeholder": 1
50 }
51 },
52 "kmip": {
53 "endpoint": {
54 "$$placeholder": 1
55 }
56 },
57 "local": {
58 "key": {
59 "$$placeholder": 1
60 }
61 }
62 }
63 }
64 }
65 },
66 {
67 "database": {
68 "id": "database0",
69 "client": "client0",
70 "databaseName": "keyvault"
71 }
72 },
73 {
74 "collection": {
75 "id": "collection0",
76 "database": "database0",
77 "collectionName": "datakeys"
78 }
79 }
80 ],
81 "initialData": [
82 {
83 "databaseName": "keyvault",
84 "collectionName": "datakeys",
85 "documents": [
86 {
87 "_id": {
88 "$binary": {
89 "base64": "YXdzYXdzYXdzYXdzYXdzYQ==",
90 "subType": "04"
91 }
92 },
93 "keyAltNames": [
94 "aws_key"
95 ],
96 "keyMaterial": {
97 "$binary": {
98 "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L",
99 "subType": "00"
100 }
101 },
102 "creationDate": {
103 "$date": {
104 "$numberLong": "1641024000000"
105 }
106 },
107 "updateDate": {
108 "$date": {
109 "$numberLong": "1641024000000"
110 }
111 },
112 "status": 1,
113 "masterKey": {
114 "provider": "aws",
115 "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0",
116 "region": "us-east-1"
117 }
118 },
119 {
120 "_id": {
121 "$binary": {
122 "base64": "YXp1cmVhenVyZWF6dXJlYQ==",
123 "subType": "04"
124 }
125 },
126 "keyAltNames": [
127 "azure_key"
128 ],
129 "keyMaterial": {
130 "$binary": {
131 "base64": "pr01l7qDygUkFE/0peFwpnNlv3iIy8zrQK38Q9i12UCN2jwZHDmfyx8wokiIKMb9kAleeY+vnt3Cf1MKu9kcDmI+KxbNDd+V3ytAAGzOVLDJr77CiWjF9f8ntkXRHrAY9WwnVDANYkDwXlyU0Y2GQFTiW65jiQhUtYLYH63Tk48SsJuQvnWw1Q+PzY8ga+QeVec8wbcThwtm+r2IHsCFnc72Gv73qq7weISw+O4mN08z3wOp5FOS2ZM3MK7tBGmPdBcktW7F8ODGsOQ1FU53OrWUnyX2aTi2ftFFFMWVHqQo7EYuBZHru8RRODNKMyQk0BFfKovAeTAVRv9WH9QU7g==",
132 "subType": "00"
133 }
134 },
135 "creationDate": {
136 "$date": {
137 "$numberLong": "1641024000000"
138 }
139 },
140 "updateDate": {
141 "$date": {
142 "$numberLong": "1641024000000"
143 }
144 },
145 "status": 1,
146 "masterKey": {
147 "provider": "azure",
148 "keyVaultEndpoint": "key-vault-csfle.vault.azure.net",
149 "keyName": "key-name-csfle"
150 }
151 },
152 {
153 "_id": {
154 "$binary": {
155 "base64": "Z2NwZ2NwZ2NwZ2NwZ2NwZw==",
156 "subType": "04"
157 }
158 },
159 "keyAltNames": [
160 "gcp_key"
161 ],
162 "keyMaterial": {
163 "$binary": {
164 "base64": "CiQAIgLj0USbQtof/pYRLQO96yg/JEtZbD1UxKueaC37yzT5tTkSiQEAhClWB5ZCSgzHgxv8raWjNB4r7e8ePGdsmSuYTYmLC5oHHS/BdQisConzNKFaobEQZHamTCjyhy5NotKF8MWoo+dyfQApwI29+vAGyrUIQCXzKwRnNdNQ+lb3vJtS5bqvLTvSxKHpVca2kqyC9nhonV+u4qru5Q2bAqUgVFc8fL4pBuvlowZFTQ==",
165 "subType": "00"
166 }
167 },
168 "creationDate": {
169 "$date": {
170 "$numberLong": "1641024000000"
171 }
172 },
173 "updateDate": {
174 "$date": {
175 "$numberLong": "1641024000000"
176 }
177 },
178 "status": 1,
179 "masterKey": {
180 "provider": "gcp",
181 "projectId": "devprod-drivers",
182 "location": "global",
183 "keyRing": "key-ring-csfle",
184 "keyName": "key-name-csfle"
185 }
186 },
187 {
188 "_id": {
189 "$binary": {
190 "base64": "a21pcGttaXBrbWlwa21pcA==",
191 "subType": "04"
192 }
193 },
194 "keyAltNames": [
195 "kmip_key"
196 ],
197 "keyMaterial": {
198 "$binary": {
199 "base64": "CklVctHzke4mcytd0TxGqvepkdkQN8NUF4+jV7aZQITAKdz6WjdDpq3lMt9nSzWGG2vAEfvRb3mFEVjV57qqGqxjq2751gmiMRHXz0btStbIK3mQ5xbY9kdye4tsixlCryEwQONr96gwlwKKI9Nubl9/8+uRF6tgYjje7Q7OjauEf1SrJwKcoQ3WwnjZmEqAug0kImCpJ/irhdqPzivRiA==",
200 "subType": "00"
201 }
202 },
203 "creationDate": {
204 "$date": {
205 "$numberLong": "1641024000000"
206 }
207 },
208 "updateDate": {
209 "$date": {
210 "$numberLong": "1641024000000"
211 }
212 },
213 "status": 1,
214 "masterKey": {
215 "provider": "kmip",
216 "keyId": "1"
217 }
218 },
219 {
220 "_id": {
221 "$binary": {
222 "base64": "bG9jYWxrZXlsb2NhbGtleQ==",
223 "subType": "04"
224 }
225 },
226 "keyAltNames": [
227 "local_key"
228 ],
229 "keyMaterial": {
230 "$binary": {
231 "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==",
232 "subType": "00"
233 }
234 },
235 "creationDate": {
236 "$date": {
237 "$numberLong": "1641024000000"
238 }
239 },
240 "updateDate": {
241 "$date": {
242 "$numberLong": "1641024000000"
243 }
244 },
245 "status": 1,
246 "masterKey": {
247 "provider": "local"
248 }
249 }
250 ]
251 }
252 ],
253 "tests": [
254 {
255 "description": "no keys to rewrap due to no filter matches",
256 "operations": [
257 {
258 "name": "rewrapManyDataKey",
259 "object": "clientEncryption0",
260 "arguments": {
261 "filter": {
262 "keyAltNames": "no_matching_keys"
263 },
264 "opts": {
265 "provider": "local"
266 }
267 },
268 "expectResult": {
269 "bulkWriteResult": {
270 "$$exists": false
271 }
272 }
273 }
274 ],
275 "expectEvents": [
276 {
277 "client": "client0",
278 "events": [
279 {
280 "commandStartedEvent": {
281 "databaseName": "keyvault",
282 "command": {
283 "find": "datakeys",
284 "filter": {
285 "keyAltNames": "no_matching_keys"
286 },
287 "readConcern": {
288 "level": "majority"
289 }
290 }
291 }
292 }
293 ]
294 }
295 ]
296 },
297 {
298 "description": "rewrap with new AWS KMS provider",
299 "operations": [
300 {
301 "name": "rewrapManyDataKey",
302 "object": "clientEncryption0",
303 "arguments": {
304 "filter": {
305 "keyAltNames": {
306 "$ne": "aws_key"
307 }
308 },
309 "opts": {
310 "provider": "aws",
311 "masterKey": {
312 "key": "arn:aws:kms:us-east-1:579766882180:key/061334ae-07a8-4ceb-a813-8135540e837d",
313 "region": "us-east-1"
314 }
315 }
316 },
317 "expectResult": {
318 "bulkWriteResult": {
319 "insertedCount": 0,
320 "matchedCount": 4,
321 "modifiedCount": 4,
322 "deletedCount": 0,
323 "upsertedCount": 0,
324 "upsertedIds": {},
325 "insertedIds": {
326 "$$unsetOrMatches": {}
327 }
328 }
329 }
330 }
331 ],
332 "expectEvents": [
333 {
334 "client": "client0",
335 "events": [
336 {
337 "commandStartedEvent": {
338 "databaseName": "keyvault",
339 "command": {
340 "find": "datakeys",
341 "filter": {
342 "keyAltNames": {
343 "$ne": "aws_key"
344 }
345 },
346 "readConcern": {
347 "level": "majority"
348 }
349 }
350 }
351 },
352 {
353 "commandStartedEvent": {
354 "databaseName": "keyvault",
355 "command": {
356 "update": "datakeys",
357 "ordered": true,
358 "updates": [
359 {
360 "q": {
361 "_id": {
362 "$$type": "binData"
363 }
364 },
365 "u": {
366 "$set": {
367 "masterKey": {
368 "provider": "aws",
369 "key": "arn:aws:kms:us-east-1:579766882180:key/061334ae-07a8-4ceb-a813-8135540e837d",
370 "region": "us-east-1"
371 },
372 "keyMaterial": {
373 "$$type": "binData"
374 }
375 },
376 "$currentDate": {
377 "updateDate": true
378 }
379 },
380 "multi": {
381 "$$unsetOrMatches": false
382 },
383 "upsert": {
384 "$$unsetOrMatches": false
385 }
386 },
387 {
388 "q": {
389 "_id": {
390 "$$type": "binData"
391 }
392 },
393 "u": {
394 "$set": {
395 "masterKey": {
396 "provider": "aws",
397 "key": "arn:aws:kms:us-east-1:579766882180:key/061334ae-07a8-4ceb-a813-8135540e837d",
398 "region": "us-east-1"
399 },
400 "keyMaterial": {
401 "$$type": "binData"
402 }
403 },
404 "$currentDate": {
405 "updateDate": true
406 }
407 },
408 "multi": {
409 "$$unsetOrMatches": false
410 },
411 "upsert": {
412 "$$unsetOrMatches": false
413 }
414 },
415 {
416 "q": {
417 "_id": {
418 "$$type": "binData"
419 }
420 },
421 "u": {
422 "$set": {
423 "masterKey": {
424 "provider": "aws",
425 "key": "arn:aws:kms:us-east-1:579766882180:key/061334ae-07a8-4ceb-a813-8135540e837d",
426 "region": "us-east-1"
427 },
428 "keyMaterial": {
429 "$$type": "binData"
430 }
431 },
432 "$currentDate": {
433 "updateDate": true
434 }
435 },
436 "multi": {
437 "$$unsetOrMatches": false
438 },
439 "upsert": {
440 "$$unsetOrMatches": false
441 }
442 },
443 {
444 "q": {
445 "_id": {
446 "$$type": "binData"
447 }
448 },
449 "u": {
450 "$set": {
451 "masterKey": {
452 "provider": "aws",
453 "key": "arn:aws:kms:us-east-1:579766882180:key/061334ae-07a8-4ceb-a813-8135540e837d",
454 "region": "us-east-1"
455 },
456 "keyMaterial": {
457 "$$type": "binData"
458 }
459 },
460 "$currentDate": {
461 "updateDate": true
462 }
463 },
464 "multi": {
465 "$$unsetOrMatches": false
466 },
467 "upsert": {
468 "$$unsetOrMatches": false
469 }
470 }
471 ],
472 "writeConcern": {
473 "w": "majority"
474 }
475 }
476 }
477 }
478 ]
479 }
480 ]
481 },
482 {
483 "description": "rewrap with new Azure KMS provider",
484 "operations": [
485 {
486 "name": "rewrapManyDataKey",
487 "object": "clientEncryption0",
488 "arguments": {
489 "filter": {
490 "keyAltNames": {
491 "$ne": "azure_key"
492 }
493 },
494 "opts": {
495 "provider": "azure",
496 "masterKey": {
497 "keyVaultEndpoint": "key-vault-csfle.vault.azure.net",
498 "keyName": "key-name-csfle"
499 }
500 }
501 },
502 "expectResult": {
503 "bulkWriteResult": {
504 "insertedCount": 0,
505 "matchedCount": 4,
506 "modifiedCount": 4,
507 "deletedCount": 0,
508 "upsertedCount": 0,
509 "upsertedIds": {},
510 "insertedIds": {
511 "$$unsetOrMatches": {}
512 }
513 }
514 }
515 }
516 ],
517 "expectEvents": [
518 {
519 "client": "client0",
520 "events": [
521 {
522 "commandStartedEvent": {
523 "databaseName": "keyvault",
524 "command": {
525 "find": "datakeys",
526 "filter": {
527 "keyAltNames": {
528 "$ne": "azure_key"
529 }
530 },
531 "readConcern": {
532 "level": "majority"
533 }
534 }
535 }
536 },
537 {
538 "commandStartedEvent": {
539 "databaseName": "keyvault",
540 "command": {
541 "update": "datakeys",
542 "ordered": true,
543 "updates": [
544 {
545 "q": {
546 "_id": {
547 "$$type": "binData"
548 }
549 },
550 "u": {
551 "$set": {
552 "masterKey": {
553 "provider": "azure",
554 "keyVaultEndpoint": "key-vault-csfle.vault.azure.net",
555 "keyName": "key-name-csfle"
556 },
557 "keyMaterial": {
558 "$$type": "binData"
559 }
560 },
561 "$currentDate": {
562 "updateDate": true
563 }
564 },
565 "multi": {
566 "$$unsetOrMatches": false
567 },
568 "upsert": {
569 "$$unsetOrMatches": false
570 }
571 },
572 {
573 "q": {
574 "_id": {
575 "$$type": "binData"
576 }
577 },
578 "u": {
579 "$set": {
580 "masterKey": {
581 "provider": "azure",
582 "keyVaultEndpoint": "key-vault-csfle.vault.azure.net",
583 "keyName": "key-name-csfle"
584 },
585 "keyMaterial": {
586 "$$type": "binData"
587 }
588 },
589 "$currentDate": {
590 "updateDate": true
591 }
592 },
593 "multi": {
594 "$$unsetOrMatches": false
595 },
596 "upsert": {
597 "$$unsetOrMatches": false
598 }
599 },
600 {
601 "q": {
602 "_id": {
603 "$$type": "binData"
604 }
605 },
606 "u": {
607 "$set": {
608 "masterKey": {
609 "provider": "azure",
610 "keyVaultEndpoint": "key-vault-csfle.vault.azure.net",
611 "keyName": "key-name-csfle"
612 },
613 "keyMaterial": {
614 "$$type": "binData"
615 }
616 },
617 "$currentDate": {
618 "updateDate": true
619 }
620 },
621 "multi": {
622 "$$unsetOrMatches": false
623 },
624 "upsert": {
625 "$$unsetOrMatches": false
626 }
627 },
628 {
629 "q": {
630 "_id": {
631 "$$type": "binData"
632 }
633 },
634 "u": {
635 "$set": {
636 "masterKey": {
637 "provider": "azure",
638 "keyVaultEndpoint": "key-vault-csfle.vault.azure.net",
639 "keyName": "key-name-csfle"
640 },
641 "keyMaterial": {
642 "$$type": "binData"
643 }
644 },
645 "$currentDate": {
646 "updateDate": true
647 }
648 },
649 "multi": {
650 "$$unsetOrMatches": false
651 },
652 "upsert": {
653 "$$unsetOrMatches": false
654 }
655 }
656 ],
657 "writeConcern": {
658 "w": "majority"
659 }
660 }
661 }
662 }
663 ]
664 }
665 ]
666 },
667 {
668 "description": "rewrap with new GCP KMS provider",
669 "operations": [
670 {
671 "name": "rewrapManyDataKey",
672 "object": "clientEncryption0",
673 "arguments": {
674 "filter": {
675 "keyAltNames": {
676 "$ne": "gcp_key"
677 }
678 },
679 "opts": {
680 "provider": "gcp",
681 "masterKey": {
682 "projectId": "devprod-drivers",
683 "location": "global",
684 "keyRing": "key-ring-csfle",
685 "keyName": "key-name-csfle"
686 }
687 }
688 },
689 "expectResult": {
690 "bulkWriteResult": {
691 "insertedCount": 0,
692 "matchedCount": 4,
693 "modifiedCount": 4,
694 "deletedCount": 0,
695 "upsertedCount": 0,
696 "upsertedIds": {},
697 "insertedIds": {
698 "$$unsetOrMatches": {}
699 }
700 }
701 }
702 }
703 ],
704 "expectEvents": [
705 {
706 "client": "client0",
707 "events": [
708 {
709 "commandStartedEvent": {
710 "databaseName": "keyvault",
711 "command": {
712 "find": "datakeys",
713 "filter": {
714 "keyAltNames": {
715 "$ne": "gcp_key"
716 }
717 },
718 "readConcern": {
719 "level": "majority"
720 }
721 }
722 }
723 },
724 {
725 "commandStartedEvent": {
726 "databaseName": "keyvault",
727 "command": {
728 "update": "datakeys",
729 "ordered": true,
730 "updates": [
731 {
732 "q": {
733 "_id": {
734 "$$type": "binData"
735 }
736 },
737 "u": {
738 "$set": {
739 "masterKey": {
740 "provider": "gcp",
741 "projectId": "devprod-drivers",
742 "location": "global",
743 "keyRing": "key-ring-csfle",
744 "keyName": "key-name-csfle"
745 },
746 "keyMaterial": {
747 "$$type": "binData"
748 }
749 },
750 "$currentDate": {
751 "updateDate": true
752 }
753 },
754 "multi": {
755 "$$unsetOrMatches": false
756 },
757 "upsert": {
758 "$$unsetOrMatches": false
759 }
760 },
761 {
762 "q": {
763 "_id": {
764 "$$type": "binData"
765 }
766 },
767 "u": {
768 "$set": {
769 "masterKey": {
770 "provider": "gcp",
771 "projectId": "devprod-drivers",
772 "location": "global",
773 "keyRing": "key-ring-csfle",
774 "keyName": "key-name-csfle"
775 },
776 "keyMaterial": {
777 "$$type": "binData"
778 }
779 },
780 "$currentDate": {
781 "updateDate": true
782 }
783 },
784 "multi": {
785 "$$unsetOrMatches": false
786 },
787 "upsert": {
788 "$$unsetOrMatches": false
789 }
790 },
791 {
792 "q": {
793 "_id": {
794 "$$type": "binData"
795 }
796 },
797 "u": {
798 "$set": {
799 "masterKey": {
800 "provider": "gcp",
801 "projectId": "devprod-drivers",
802 "location": "global",
803 "keyRing": "key-ring-csfle",
804 "keyName": "key-name-csfle"
805 },
806 "keyMaterial": {
807 "$$type": "binData"
808 }
809 },
810 "$currentDate": {
811 "updateDate": true
812 }
813 },
814 "multi": {
815 "$$unsetOrMatches": false
816 },
817 "upsert": {
818 "$$unsetOrMatches": false
819 }
820 },
821 {
822 "q": {
823 "_id": {
824 "$$type": "binData"
825 }
826 },
827 "u": {
828 "$set": {
829 "masterKey": {
830 "provider": "gcp",
831 "projectId": "devprod-drivers",
832 "location": "global",
833 "keyRing": "key-ring-csfle",
834 "keyName": "key-name-csfle"
835 },
836 "keyMaterial": {
837 "$$type": "binData"
838 }
839 },
840 "$currentDate": {
841 "updateDate": true
842 }
843 },
844 "multi": {
845 "$$unsetOrMatches": false
846 },
847 "upsert": {
848 "$$unsetOrMatches": false
849 }
850 }
851 ],
852 "writeConcern": {
853 "w": "majority"
854 }
855 }
856 }
857 }
858 ]
859 }
860 ]
861 },
862 {
863 "description": "rewrap with new KMIP KMS provider",
864 "operations": [
865 {
866 "name": "rewrapManyDataKey",
867 "object": "clientEncryption0",
868 "arguments": {
869 "filter": {
870 "keyAltNames": {
871 "$ne": "kmip_key"
872 }
873 },
874 "opts": {
875 "provider": "kmip"
876 }
877 },
878 "expectResult": {
879 "bulkWriteResult": {
880 "insertedCount": 0,
881 "matchedCount": 4,
882 "modifiedCount": 4,
883 "deletedCount": 0,
884 "upsertedCount": 0,
885 "upsertedIds": {},
886 "insertedIds": {
887 "$$unsetOrMatches": {}
888 }
889 }
890 }
891 }
892 ],
893 "expectEvents": [
894 {
895 "client": "client0",
896 "events": [
897 {
898 "commandStartedEvent": {
899 "databaseName": "keyvault",
900 "command": {
901 "find": "datakeys",
902 "filter": {
903 "keyAltNames": {
904 "$ne": "kmip_key"
905 }
906 },
907 "readConcern": {
908 "level": "majority"
909 }
910 }
911 }
912 },
913 {
914 "commandStartedEvent": {
915 "databaseName": "keyvault",
916 "command": {
917 "update": "datakeys",
918 "ordered": true,
919 "updates": [
920 {
921 "q": {
922 "_id": {
923 "$$type": "binData"
924 }
925 },
926 "u": {
927 "$set": {
928 "masterKey": {
929 "provider": "kmip",
930 "keyId": {
931 "$$type": "string"
932 }
933 },
934 "keyMaterial": {
935 "$$type": "binData"
936 }
937 },
938 "$currentDate": {
939 "updateDate": true
940 }
941 },
942 "multi": {
943 "$$unsetOrMatches": false
944 },
945 "upsert": {
946 "$$unsetOrMatches": false
947 }
948 },
949 {
950 "q": {
951 "_id": {
952 "$$type": "binData"
953 }
954 },
955 "u": {
956 "$set": {
957 "masterKey": {
958 "provider": "kmip",
959 "keyId": {
960 "$$type": "string"
961 }
962 },
963 "keyMaterial": {
964 "$$type": "binData"
965 }
966 },
967 "$currentDate": {
968 "updateDate": true
969 }
970 },
971 "multi": {
972 "$$unsetOrMatches": false
973 },
974 "upsert": {
975 "$$unsetOrMatches": false
976 }
977 },
978 {
979 "q": {
980 "_id": {
981 "$$type": "binData"
982 }
983 },
984 "u": {
985 "$set": {
986 "masterKey": {
987 "provider": "kmip",
988 "keyId": {
989 "$$type": "string"
990 }
991 },
992 "keyMaterial": {
993 "$$type": "binData"
994 }
995 },
996 "$currentDate": {
997 "updateDate": true
998 }
999 },
1000 "multi": {
1001 "$$unsetOrMatches": false
1002 },
1003 "upsert": {
1004 "$$unsetOrMatches": false
1005 }
1006 },
1007 {
1008 "q": {
1009 "_id": {
1010 "$$type": "binData"
1011 }
1012 },
1013 "u": {
1014 "$set": {
1015 "masterKey": {
1016 "provider": "kmip",
1017 "keyId": {
1018 "$$type": "string"
1019 }
1020 },
1021 "keyMaterial": {
1022 "$$type": "binData"
1023 }
1024 },
1025 "$currentDate": {
1026 "updateDate": true
1027 }
1028 },
1029 "multi": {
1030 "$$unsetOrMatches": false
1031 },
1032 "upsert": {
1033 "$$unsetOrMatches": false
1034 }
1035 }
1036 ],
1037 "writeConcern": {
1038 "w": "majority"
1039 }
1040 }
1041 }
1042 }
1043 ]
1044 }
1045 ]
1046 },
1047 {
1048 "description": "rewrap with new local KMS provider",
1049 "operations": [
1050 {
1051 "name": "rewrapManyDataKey",
1052 "object": "clientEncryption0",
1053 "arguments": {
1054 "filter": {
1055 "keyAltNames": {
1056 "$ne": "local_key"
1057 }
1058 },
1059 "opts": {
1060 "provider": "local"
1061 }
1062 },
1063 "expectResult": {
1064 "bulkWriteResult": {
1065 "insertedCount": 0,
1066 "matchedCount": 4,
1067 "modifiedCount": 4,
1068 "deletedCount": 0,
1069 "upsertedCount": 0,
1070 "upsertedIds": {},
1071 "insertedIds": {
1072 "$$unsetOrMatches": {}
1073 }
1074 }
1075 }
1076 }
1077 ],
1078 "expectEvents": [
1079 {
1080 "client": "client0",
1081 "events": [
1082 {
1083 "commandStartedEvent": {
1084 "databaseName": "keyvault",
1085 "command": {
1086 "find": "datakeys",
1087 "filter": {
1088 "keyAltNames": {
1089 "$ne": "local_key"
1090 }
1091 },
1092 "readConcern": {
1093 "level": "majority"
1094 }
1095 }
1096 }
1097 },
1098 {
1099 "commandStartedEvent": {
1100 "databaseName": "keyvault",
1101 "command": {
1102 "update": "datakeys",
1103 "ordered": true,
1104 "updates": [
1105 {
1106 "q": {
1107 "_id": {
1108 "$$type": "binData"
1109 }
1110 },
1111 "u": {
1112 "$set": {
1113 "masterKey": {
1114 "provider": "local"
1115 },
1116 "keyMaterial": {
1117 "$$type": "binData"
1118 }
1119 },
1120 "$currentDate": {
1121 "updateDate": true
1122 }
1123 },
1124 "multi": {
1125 "$$unsetOrMatches": false
1126 },
1127 "upsert": {
1128 "$$unsetOrMatches": false
1129 }
1130 },
1131 {
1132 "q": {
1133 "_id": {
1134 "$$type": "binData"
1135 }
1136 },
1137 "u": {
1138 "$set": {
1139 "masterKey": {
1140 "provider": "local"
1141 },
1142 "keyMaterial": {
1143 "$$type": "binData"
1144 }
1145 },
1146 "$currentDate": {
1147 "updateDate": true
1148 }
1149 },
1150 "multi": {
1151 "$$unsetOrMatches": false
1152 },
1153 "upsert": {
1154 "$$unsetOrMatches": false
1155 }
1156 },
1157 {
1158 "q": {
1159 "_id": {
1160 "$$type": "binData"
1161 }
1162 },
1163 "u": {
1164 "$set": {
1165 "masterKey": {
1166 "provider": "local"
1167 },
1168 "keyMaterial": {
1169 "$$type": "binData"
1170 }
1171 },
1172 "$currentDate": {
1173 "updateDate": true
1174 }
1175 },
1176 "multi": {
1177 "$$unsetOrMatches": false
1178 },
1179 "upsert": {
1180 "$$unsetOrMatches": false
1181 }
1182 },
1183 {
1184 "q": {
1185 "_id": {
1186 "$$type": "binData"
1187 }
1188 },
1189 "u": {
1190 "$set": {
1191 "masterKey": {
1192 "provider": "local"
1193 },
1194 "keyMaterial": {
1195 "$$type": "binData"
1196 }
1197 },
1198 "$currentDate": {
1199 "updateDate": true
1200 }
1201 },
1202 "multi": {
1203 "$$unsetOrMatches": false
1204 },
1205 "upsert": {
1206 "$$unsetOrMatches": false
1207 }
1208 }
1209 ],
1210 "writeConcern": {
1211 "w": "majority"
1212 }
1213 }
1214 }
1215 }
1216 ]
1217 }
1218 ]
1219 },
1220 {
1221 "description": "rewrap with current KMS provider",
1222 "operations": [
1223 {
1224 "name": "rewrapManyDataKey",
1225 "object": "clientEncryption0",
1226 "arguments": {
1227 "filter": {}
1228 },
1229 "expectResult": {
1230 "bulkWriteResult": {
1231 "insertedCount": 0,
1232 "matchedCount": 5,
1233 "modifiedCount": 5,
1234 "deletedCount": 0,
1235 "upsertedCount": 0,
1236 "upsertedIds": {},
1237 "insertedIds": {
1238 "$$unsetOrMatches": {}
1239 }
1240 }
1241 }
1242 },
1243 {
1244 "name": "find",
1245 "object": "collection0",
1246 "arguments": {
1247 "filter": {},
1248 "projection": {
1249 "masterKey": 1
1250 },
1251 "sort": {
1252 "keyAltNames": 1
1253 }
1254 },
1255 "expectResult": [
1256 {
1257 "_id": {
1258 "$binary": {
1259 "base64": "YXdzYXdzYXdzYXdzYXdzYQ==",
1260 "subType": "04"
1261 }
1262 },
1263 "masterKey": {
1264 "provider": "aws",
1265 "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0",
1266 "region": "us-east-1"
1267 }
1268 },
1269 {
1270 "_id": {
1271 "$binary": {
1272 "base64": "YXp1cmVhenVyZWF6dXJlYQ==",
1273 "subType": "04"
1274 }
1275 },
1276 "masterKey": {
1277 "provider": "azure",
1278 "keyVaultEndpoint": "key-vault-csfle.vault.azure.net",
1279 "keyName": "key-name-csfle"
1280 }
1281 },
1282 {
1283 "_id": {
1284 "$binary": {
1285 "base64": "Z2NwZ2NwZ2NwZ2NwZ2NwZw==",
1286 "subType": "04"
1287 }
1288 },
1289 "masterKey": {
1290 "provider": "gcp",
1291 "projectId": "devprod-drivers",
1292 "location": "global",
1293 "keyRing": "key-ring-csfle",
1294 "keyName": "key-name-csfle"
1295 }
1296 },
1297 {
1298 "_id": {
1299 "$binary": {
1300 "base64": "a21pcGttaXBrbWlwa21pcA==",
1301 "subType": "04"
1302 }
1303 },
1304 "masterKey": {
1305 "provider": "kmip",
1306 "keyId": "1"
1307 }
1308 },
1309 {
1310 "_id": {
1311 "$binary": {
1312 "base64": "bG9jYWxrZXlsb2NhbGtleQ==",
1313 "subType": "04"
1314 }
1315 },
1316 "masterKey": {
1317 "provider": "local"
1318 }
1319 }
1320 ]
1321 }
1322 ],
1323 "expectEvents": [
1324 {
1325 "client": "client0",
1326 "events": [
1327 {
1328 "commandStartedEvent": {
1329 "databaseName": "keyvault",
1330 "command": {
1331 "find": "datakeys",
1332 "filter": {},
1333 "readConcern": {
1334 "level": "majority"
1335 }
1336 }
1337 }
1338 },
1339 {
1340 "commandStartedEvent": {
1341 "databaseName": "keyvault",
1342 "command": {
1343 "update": "datakeys",
1344 "ordered": true,
1345 "updates": [
1346 {
1347 "q": {
1348 "_id": {
1349 "$$type": "binData"
1350 }
1351 },
1352 "u": {
1353 "$set": {
1354 "masterKey": {
1355 "$$type": "object"
1356 },
1357 "keyMaterial": {
1358 "$$type": "binData"
1359 }
1360 },
1361 "$currentDate": {
1362 "updateDate": true
1363 }
1364 },
1365 "multi": {
1366 "$$unsetOrMatches": false
1367 },
1368 "upsert": {
1369 "$$unsetOrMatches": false
1370 }
1371 },
1372 {
1373 "q": {
1374 "_id": {
1375 "$$type": "binData"
1376 }
1377 },
1378 "u": {
1379 "$set": {
1380 "masterKey": {
1381 "$$type": "object"
1382 },
1383 "keyMaterial": {
1384 "$$type": "binData"
1385 }
1386 },
1387 "$currentDate": {
1388 "updateDate": true
1389 }
1390 },
1391 "multi": {
1392 "$$unsetOrMatches": false
1393 },
1394 "upsert": {
1395 "$$unsetOrMatches": false
1396 }
1397 },
1398 {
1399 "q": {
1400 "_id": {
1401 "$$type": "binData"
1402 }
1403 },
1404 "u": {
1405 "$set": {
1406 "masterKey": {
1407 "$$type": "object"
1408 },
1409 "keyMaterial": {
1410 "$$type": "binData"
1411 }
1412 },
1413 "$currentDate": {
1414 "updateDate": true
1415 }
1416 },
1417 "multi": {
1418 "$$unsetOrMatches": false
1419 },
1420 "upsert": {
1421 "$$unsetOrMatches": false
1422 }
1423 },
1424 {
1425 "q": {
1426 "_id": {
1427 "$$type": "binData"
1428 }
1429 },
1430 "u": {
1431 "$set": {
1432 "masterKey": {
1433 "$$type": "object"
1434 },
1435 "keyMaterial": {
1436 "$$type": "binData"
1437 }
1438 },
1439 "$currentDate": {
1440 "updateDate": true
1441 }
1442 },
1443 "multi": {
1444 "$$unsetOrMatches": false
1445 },
1446 "upsert": {
1447 "$$unsetOrMatches": false
1448 }
1449 },
1450 {
1451 "q": {
1452 "_id": {
1453 "$$type": "binData"
1454 }
1455 },
1456 "u": {
1457 "$set": {
1458 "masterKey": {
1459 "$$type": "object"
1460 },
1461 "keyMaterial": {
1462 "$$type": "binData"
1463 }
1464 },
1465 "$currentDate": {
1466 "updateDate": true
1467 }
1468 },
1469 "multi": {
1470 "$$unsetOrMatches": false
1471 },
1472 "upsert": {
1473 "$$unsetOrMatches": false
1474 }
1475 }
1476 ],
1477 "writeConcern": {
1478 "w": "majority"
1479 }
1480 }
1481 }
1482 },
1483 {
1484 "commandStartedEvent": {
1485 "commandName": "find"
1486 }
1487 }
1488 ]
1489 }
1490 ]
1491 }
1492 ]
1493}
View as plain text