@@ -214,9 +214,11 @@ def test_raw_rsa_boundary(self):
214214 rsa_obj = self .rsa .generate (1024 )
215215
216216 self .assertRaises (ValueError , rsa_obj ._decrypt , rsa_obj .n )
217+ self .assertRaises (ValueError , rsa_obj ._decrypt_to_bytes , rsa_obj .n )
217218 self .assertRaises (ValueError , rsa_obj ._encrypt , rsa_obj .n )
218219
219220 self .assertRaises (ValueError , rsa_obj ._decrypt , - 1 )
221+ self .assertRaises (ValueError , rsa_obj ._decrypt_to_bytes , - 1 )
220222 self .assertRaises (ValueError , rsa_obj ._encrypt , - 1 )
221223
222224 def test_size (self ):
@@ -265,6 +267,8 @@ def _check_public_key(self, rsaObj):
265267 # Public keys should not be able to sign or decrypt
266268 self .assertRaises (TypeError , rsaObj ._decrypt ,
267269 bytes_to_long (ciphertext ))
270+ self .assertRaises (TypeError , rsaObj ._decrypt_to_bytes ,
271+ bytes_to_long (ciphertext ))
268272
269273 # Check __eq__ and __ne__
270274 self .assertEqual (rsaObj .public_key () == rsaObj .public_key (),True ) # assert_
@@ -279,7 +283,7 @@ def _exercise_primitive(self, rsaObj):
279283 ciphertext = bytes_to_long (a2b_hex (self .ciphertext ))
280284
281285 # Test decryption
282- plaintext = bytes_to_long ( rsaObj ._decrypt (ciphertext ) )
286+ plaintext = rsaObj ._decrypt (ciphertext )
283287
284288 # Test encryption (2 arguments)
285289 new_ciphertext2 = rsaObj ._encrypt (plaintext )
@@ -304,7 +308,7 @@ def _check_decryption(self, rsaObj):
304308 ciphertext = bytes_to_long (a2b_hex (self .ciphertext ))
305309
306310 # Test plain decryption
307- new_plaintext = bytes_to_long ( rsaObj ._decrypt (ciphertext ) )
311+ new_plaintext = rsaObj ._decrypt (ciphertext )
308312 self .assertEqual (plaintext , new_plaintext )
309313
310314
0 commit comments