summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--paramiko/pkey.py10
-rw-r--r--tests/test_pkey.py10
2 files changed, 11 insertions, 9 deletions
diff --git a/paramiko/pkey.py b/paramiko/pkey.py
index 155a78ef..84424218 100644
--- a/paramiko/pkey.py
+++ b/paramiko/pkey.py
@@ -388,7 +388,7 @@ class PKey(object):
https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key
"""
try:
- data = decodebytes(b(''.join(lines)))
+ data = decodebytes(b("".join(lines)))
except base64.binascii.Error as e:
raise SSHException("base64 decoding error: " + str(e))
@@ -426,7 +426,7 @@ class PKey(object):
)
# Unpack salt and rounds from kdfoptions
- salt, rounds = self._uint32_cstruct_unpack(kdf_options, 'su')
+ salt, rounds = self._uint32_cstruct_unpack(kdf_options, "su")
# run bcrypt kdf to derive key and iv/nonce (32 + 16 bytes)
key_iv = bcrypt.kdf(b(password), b(salt), 48, rounds)
@@ -479,14 +479,14 @@ class PKey(object):
for f in strformat:
if f == "s":
# string
- s_size = struct.unpack(">L", data[idx:idx + 4])[0]
+ s_size = struct.unpack(">L", data[idx : idx + 4])[0]
idx += 4
s = data[idx:idx + s_size]
idx += s_size
arr.append(s)
if f == "i":
# long integer
- s_size = struct.unpack(">L", data[idx:idx + 4])[0]
+ s_size = struct.unpack(">L", data[idx : idx + 4])[0]
idx += 4
s = data[idx:idx + s_size]
idx += s_size
@@ -494,7 +494,7 @@ class PKey(object):
arr.append(i)
elif f == "u":
# 32-bit unsigned int
- u = struct.unpack(">L", data[idx:idx + 4])[0]
+ u = struct.unpack(">L", data[idx : idx + 4])[0]
idx += 4
arr.append(u)
elif f == "r":
diff --git a/tests/test_pkey.py b/tests/test_pkey.py
index f3b6fc7c..38c1fbef 100644
--- a/tests/test_pkey.py
+++ b/tests/test_pkey.py
@@ -443,21 +443,23 @@ class KeyTest(unittest.TestCase):
def test_22_load_RSA_key_new_format(self):
key = RSAKey.from_private_key_file(
- _support("test_rsa_2k_o.key"), b"television")
+ _support("test_rsa_2k_o.key"), b"television"
+ )
self.assertEqual("ssh-rsa", key.get_name())
self.assertEqual(PUB_RSA_2K_OPENSSH.split()[1], key.get_base64())
self.assertEqual(2048, key.get_bits())
- exp_rsa = b(FINGER_RSA_2K_OPENSSH.split()[1].replace(':', ''))
+ exp_rsa = b(FINGER_RSA_2K_OPENSSH.split()[1].replace(":", ""))
my_rsa = hexlify(key.get_fingerprint())
self.assertEqual(exp_rsa, my_rsa)
def test_23_load_DSS_key_new_format(self):
key = DSSKey.from_private_key_file(
- _support("test_dss_1k_o.key"), b"television")
+ _support("test_dss_1k_o.key"), b"television"
+ )
self.assertEqual("ssh-dss", key.get_name())
self.assertEqual(PUB_DSS_1K_OPENSSH.split()[1], key.get_base64())
self.assertEqual(1024, key.get_bits())
- exp_rsa = b(FINGER_DSS_1K_OPENSSH.split()[1].replace(':', ''))
+ exp_rsa = b(FINGER_DSS_1K_OPENSSH.split()[1].replace(":", ""))
my_rsa = hexlify(key.get_fingerprint())
self.assertEqual(exp_rsa, my_rsa)