1{
2  "runOn": [
3    {
4      "minServerVersion": "4.1.10"
5    }
6  ],
7  "database_name": "default",
8  "collection_name": "default",
9  "data": [],
10  "json_schema": {
11    "properties": {
12      "encrypted_w_altname": {
13        "encrypt": {
14          "keyId": "/altname",
15          "bsonType": "string",
16          "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
17        }
18      },
19      "encrypted_string": {
20        "encrypt": {
21          "keyId": [
22            {
23              "$binary": {
24                "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
25                "subType": "04"
26              }
27            }
28          ],
29          "bsonType": "string",
30          "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
31        }
32      },
33      "random": {
34        "encrypt": {
35          "keyId": [
36            {
37              "$binary": {
38                "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
39                "subType": "04"
40              }
41            }
42          ],
43          "bsonType": "string",
44          "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
45        }
46      },
47      "encrypted_string_equivalent": {
48        "encrypt": {
49          "keyId": [
50            {
51              "$binary": {
52                "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
53                "subType": "04"
54              }
55            }
56          ],
57          "bsonType": "string",
58          "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
59        }
60      }
61    },
62    "bsonType": "object"
63  },
64  "key_vault_data": [
65    {
66      "status": 1,
67      "_id": {
68        "$binary": {
69          "base64": "AAAAAAAAAAAAAAAAAAAAAA==",
70          "subType": "04"
71        }
72      },
73      "masterKey": {
74        "provider": "aws",
75        "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0",
76        "region": "us-east-1"
77      },
78      "updateDate": {
79        "$date": {
80          "$numberLong": "1552949630483"
81        }
82      },
83      "keyMaterial": {
84        "$binary": {
85          "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO",
86          "subType": "00"
87        }
88      },
89      "creationDate": {
90        "$date": {
91          "$numberLong": "1552949630483"
92        }
93      },
94      "keyAltNames": [
95        "altname",
96        "another_altname"
97      ]
98    }
99  ],
100  "tests": [
101    {
102      "description": "Insert with encryption using key alt name",
103      "clientOptions": {
104        "autoEncryptOpts": {
105          "kmsProviders": {
106            "aws": {}
107          }
108        }
109      },
110      "operations": [
111        {
112          "name": "insertOne",
113          "arguments": {
114            "document": {
115              "_id": 1,
116              "encrypted_w_altname": "string0",
117              "altname": "altname"
118            }
119          }
120        }
121      ],
122      "expectations": [
123        {
124          "command_started_event": {
125            "command": {
126              "listCollections": 1,
127              "filter": {
128                "name": "default"
129              }
130            },
131            "command_name": "listCollections"
132          }
133        },
134        {
135          "command_started_event": {
136            "command": {
137              "listCollections": 1,
138              "filter": {
139                "name": "datakeys"
140              },
141              "$db": "admin"
142            },
143            "command_name": "listCollections"
144          }
145        },
146        {
147          "command_started_event": {
148            "command": {
149              "find": "datakeys",
150              "filter": {
151                "$or": [
152                  {
153                    "_id": {
154                      "$in": []
155                    }
156                  },
157                  {
158                    "keyAltNames": {
159                      "$in": [
160                        "altname"
161                      ]
162                    }
163                  }
164                ]
165              },
166              "$db": "admin",
167              "readConcern": {
168                "level": "majority"
169              }
170            },
171            "command_name": "find"
172          }
173        },
174        {
175          "command_started_event": {
176            "command": {
177              "insert": "default",
178              "documents": [
179                {
180                  "_id": 1,
181                  "encrypted_w_altname": {
182                    "$$type": "binData"
183                  },
184                  "altname": "altname"
185                }
186              ],
187              "ordered": true
188            },
189            "command_name": "insert"
190          }
191        }
192      ],
193      "outcome": {
194        "collection": {
195          "data": [
196            {
197              "_id": 1,
198              "encrypted_w_altname": {
199                "$$type": "binData"
200              },
201              "altname": "altname"
202            }
203          ]
204        }
205      }
206    },
207    {
208      "description": "Replace with key alt name fails",
209      "clientOptions": {
210        "autoEncryptOpts": {
211          "kmsProviders": {
212            "aws": {}
213          }
214        }
215      },
216      "operations": [
217        {
218          "name": "updateOne",
219          "arguments": {
220            "filter": {},
221            "update": {
222              "$set": {
223                "encrypted_w_altname": "string0"
224              }
225            },
226            "upsert": true
227          },
228          "result": {
229            "errorContains": "A non-static (JSONPointer) keyId is not supported"
230          }
231        }
232      ],
233      "outcome": {
234        "collection": {
235          "data": []
236        }
237      }
238    }
239  ]
240}
241