summaryrefslogtreecommitdiffhomepage
path: root/tests/test_pkey.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2014-09-08 15:59:05 -0700
committerJeff Forcier <jeff@bitprophet.org>2014-09-08 15:59:05 -0700
commit752507a2978b0c6091ee737cd37ba1cb690926a2 (patch)
tree2610670fc4edd07ae96851c4947a3c69d360cb88 /tests/test_pkey.py
parentb076c10d00ee2cb4d465291a4ef0a4be9f048d9a (diff)
parentde391e88e0a7e75cd977f162a883aa5ffdbdc591 (diff)
Merge branch 'master' into 267-int
Conflicts: paramiko/client.py paramiko/transport.py sites/www/changelog.rst
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)