summaryrefslogtreecommitdiffhomepage
path: root/tests/test_pkey.py
diff options
context:
space:
mode:
authorMatthias Witte <m.witte@telekom.de>2014-11-25 18:15:16 +0100
committerMatthias Witte <m.witte@telekom.de>2014-11-25 18:15:16 +0100
commitb3b0f2d0dff3aef736128935302aeb6adb1ee020 (patch)
tree16d9fe959aede76a0a6ed4d1a6e59a90198dc6f8 /tests/test_pkey.py
parent47da1935dc84784bfee2e493474232bf2e0d8d37 (diff)
parent838ab5b23274ddea0b5671b7f2d5a295dcd02dfe (diff)
Merge upstream branch 'master' into add_sha2_support
Conflicts: paramiko/transport.py tests/test_transport.py
Diffstat (limited to 'tests/test_pkey.py')
-rw-r--r--tests/test_pkey.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_pkey.py b/tests/test_pkey.py
index 1468ee27..f673254f 100644
--- a/tests/test_pkey.py
+++ b/tests/test_pkey.py
@@ -21,6 +21,7 @@ Some unit tests for public/private key objects.
"""
import unittest
+import os
from binascii import hexlify
from hashlib import md5
@@ -253,3 +254,20 @@ class KeyTest (unittest.TestCase):
msg.rewind()
pub = ECDSAKey(data=key.asbytes())
self.assertTrue(pub.verify_ssh_sig(b'ice weasels', msg))
+
+ def test_salt_size(self):
+ # Read an existing encrypted private key
+ file_ = test_path('test_rsa_password.key')
+ password = 'television'
+ newfile = file_ + '.new'
+ newpassword = 'radio'
+ key = RSAKey(filename=file_, password=password)
+ # Write out a newly re-encrypted copy with a new password.
+ # When the bug under test exists, this will ValueError.
+ try:
+ key.write_private_key_file(newfile, password=newpassword)
+ # Verify the inner key data still matches (when no ValueError)
+ key2 = RSAKey(filename=newfile, password=newpassword)
+ self.assertEqual(key, key2)
+ finally:
+ os.remove(newfile)