@@ -277,12 +277,14 @@ def test_encrypt_decrypt(self):
277277
278278 doc = {'_id' : 0 , 'ssn' : '000' }
279279 encrypted_ssn = client_encryption .encrypt (
280- doc ['ssn' ], Algorithm .Deterministic , key_id = key_id )
280+ doc ['ssn' ], Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic ,
281+ key_id = key_id )
281282
282283 # Ensure encryption via key_alt_name for the same key produces the
283284 # same output.
284285 encrypted_ssn2 = client_encryption .encrypt (
285- doc ['ssn' ], Algorithm .Deterministic , key_alt_name = 'name' )
286+ doc ['ssn' ], Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic ,
287+ key_alt_name = 'name' )
286288 self .assertEqual (encrypted_ssn , encrypted_ssn2 )
287289
288290 # Test decryption.
@@ -309,7 +311,8 @@ def test_bson_errors(self):
309311 unencodable_value = object ()
310312 with self .assertRaises (BSONError ):
311313 client_encryption .encrypt (
312- unencodable_value , Algorithm .Deterministic ,
314+ unencodable_value ,
315+ Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic ,
313316 key_id = Binary (uuid .uuid4 ().bytes , UUID_SUBTYPE ))
314317
315318 def test_codec_options (self ):
@@ -328,7 +331,8 @@ def test_codec_options(self):
328331 # Encrypt a UUID with JAVA_LEGACY codec options.
329332 value = uuid .uuid4 ()
330333 encrypted_legacy = client_encryption_legacy .encrypt (
331- value , Algorithm .Deterministic , key_id = key_id )
334+ value , Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic ,
335+ key_id = key_id )
332336 decrypted_value_legacy = client_encryption_legacy .decrypt (
333337 encrypted_legacy )
334338 self .assertEqual (decrypted_value_legacy , value )
@@ -338,7 +342,8 @@ def test_codec_options(self):
338342 KMS_PROVIDERS , 'admin.datakeys' , client_context .client , OPTS )
339343 self .addCleanup (client_encryption .close )
340344 encrypted_standard = client_encryption .encrypt (
341- value , Algorithm .Deterministic , key_id = key_id )
345+ value , Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic ,
346+ key_id = key_id )
342347 decrypted_standard = client_encryption .decrypt (encrypted_standard )
343348 self .assertEqual (decrypted_standard , value )
344349
@@ -531,7 +536,9 @@ def test_data_key(self):
531536
532537 # Local encrypt by key_id.
533538 local_encrypted = client_encryption .encrypt (
534- 'hello local' , Algorithm .Deterministic , key_id = local_datakey_id )
539+ 'hello local' ,
540+ Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic ,
541+ key_id = local_datakey_id )
535542 self .assertEncrypted (local_encrypted )
536543 client_encrypted .db .coll .insert_one (
537544 {'_id' : 'local' , 'value' : local_encrypted })
@@ -540,7 +547,8 @@ def test_data_key(self):
540547
541548 # Local encrypt by key_alt_name.
542549 local_encrypted_altname = client_encryption .encrypt (
543- 'hello local' , Algorithm .Deterministic ,
550+ 'hello local' ,
551+ Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic ,
544552 key_alt_name = 'local_altname' )
545553 self .assertEqual (local_encrypted_altname , local_encrypted )
546554
@@ -559,7 +567,9 @@ def test_data_key(self):
559567
560568 # AWS encrypt by key_id.
561569 aws_encrypted = client_encryption .encrypt (
562- 'hello aws' , Algorithm .Deterministic , key_id = aws_datakey_id )
570+ 'hello aws' ,
571+ Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic ,
572+ key_id = aws_datakey_id )
563573 self .assertEncrypted (aws_encrypted )
564574 client_encrypted .db .coll .insert_one (
565575 {'_id' : 'aws' , 'value' : aws_encrypted })
@@ -568,7 +578,9 @@ def test_data_key(self):
568578
569579 # AWS encrypt by key_alt_name.
570580 aws_encrypted_altname = client_encryption .encrypt (
571- 'hello aws' , Algorithm .Deterministic , key_alt_name = 'aws_altname' )
581+ 'hello aws' ,
582+ Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic ,
583+ key_alt_name = 'aws_altname' )
572584 self .assertEqual (aws_encrypted_altname , aws_encrypted )
573585
574586 # Explicitly encrypting an auto encrypted field.
@@ -627,13 +639,16 @@ def _test_external_key_vault(self, with_external_key_vault):
627639 # Authentication error.
628640 with self .assertRaises (EncryptionError ) as ctx :
629641 client_encryption .encrypt (
630- "test" , Algorithm .Deterministic , key_id = LOCAL_KEY_ID )
642+ "test" ,
643+ Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic ,
644+ key_id = LOCAL_KEY_ID )
631645 # AuthenticationFailed error.
632646 self .assertIsInstance (ctx .exception .cause , OperationFailure )
633647 self .assertEqual (ctx .exception .cause .code , 18 )
634648 else :
635649 client_encryption .encrypt (
636- "test" , Algorithm .Deterministic , key_id = LOCAL_KEY_ID )
650+ "test" , Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic ,
651+ key_id = LOCAL_KEY_ID )
637652
638653 def test_external_key_vault_1 (self ):
639654 self ._test_external_key_vault (True )
@@ -744,9 +759,10 @@ def _test_corpus(self, opts):
744759
745760 self .assertIn (value ['algo' ], ('det' , 'rand' ))
746761 if value ['algo' ] == 'det' :
747- algo = Algorithm .Deterministic
762+ algo = (Algorithm .
763+ AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic )
748764 else :
749- algo = Algorithm .Random
765+ algo = Algorithm .AEAD_AES_256_CBC_HMAC_SHA_512_Random
750766
751767 try :
752768 encrypted_val = client_encryption .encrypt (
0 commit comments