(self)
| 1685 | # https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#14-decryption-events |
| 1686 | class TestDecryptProse(EncryptionIntegrationTest): |
| 1687 | def setUp(self): |
| 1688 | super().setUp() |
| 1689 | self.client = client_context.client |
| 1690 | self.client.db.drop_collection("decryption_events") |
| 1691 | create_key_vault(self.client.keyvault.datakeys) |
| 1692 | kms_providers_map = {"local": {"key": LOCAL_MASTER_KEY}} |
| 1693 | |
| 1694 | self.client_encryption = self.create_client_encryption( |
| 1695 | kms_providers_map, "keyvault.datakeys", self.client, CodecOptions() |
| 1696 | ) |
| 1697 | keyID = self.client_encryption.create_data_key("local") |
| 1698 | self.cipher_text = self.client_encryption.encrypt( |
| 1699 | "hello", key_id=keyID, algorithm=Algorithm.AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic |
| 1700 | ) |
| 1701 | self.malformed_cipher_text = self.cipher_text[:-1] + (self.cipher_text[-1] ^ 1).to_bytes( |
| 1702 | 1, "big" |
| 1703 | ) |
| 1704 | self.malformed_cipher_text = Binary(self.malformed_cipher_text, 6) |
| 1705 | opts = AutoEncryptionOpts( |
| 1706 | key_vault_namespace="keyvault.datakeys", kms_providers=kms_providers_map |
| 1707 | ) |
| 1708 | self.listener = AllowListEventListener("aggregate") |
| 1709 | self.encrypted_client = self.rs_or_single_client( |
| 1710 | auto_encryption_opts=opts, retryReads=False, event_listeners=[self.listener] |
| 1711 | ) |
| 1712 | |
| 1713 | def test_01_command_error(self): |
| 1714 | with self.fail_point( |
nothing calls this directly
no test coverage detected