diff options
author | Jean-Paul Calderone <exarkun@divmod.com> | 2011-09-14 10:16:46 -0400 |
---|---|---|
committer | Jean-Paul Calderone <exarkun@divmod.com> | 2011-09-14 10:16:46 -0400 |
commit | 105cb95768adb64babd682a8038f1edea337ff27 (patch) | |
tree | 06c558ddcc074eb52f9f41f76dc142b3fd51c753 /OpenSSL/test | |
parent | 8e37f7628d1974176ab57bdad52429395c46a5fc (diff) | |
download | pyopenssl-105cb95768adb64babd682a8038f1edea337ff27.tar.gz |
Add a test for returning the wrong type from a passphrase callback
Diffstat (limited to 'OpenSSL/test')
-rw-r--r-- | OpenSSL/test/test_crypto.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/OpenSSL/test/test_crypto.py b/OpenSSL/test/test_crypto.py index 47b3df3..4c66d6e 100644 --- a/OpenSSL/test/test_crypto.py +++ b/OpenSSL/test/test_crypto.py @@ -2045,6 +2045,17 @@ class FunctionTests(TestCase): self.assertEqual(called, [False]) + def test_load_privatekey_passphrase_wrong_return_type(self): + """ + :py:obj:`load_privatekey` raises :py:obj:`ValueError` if the passphrase + callback returns something other than a byte string. + """ + self.assertRaises( + ValueError, + load_privatekey, + FILETYPE_PEM, encryptedPrivateKeyPEM, lambda *args: 3) + + def test_dump_privatekey_wrong_args(self): """ :py:obj:`dump_privatekey` raises :py:obj:`TypeError` if called with the wrong number |