summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2017-05-26 21:39:23 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2017-06-03 02:02:46 -0400
commit470666558262fd1caed64e6482e3727aceed158d (patch)
tree084fc152281dae0d8516ff8ab71ed8e67be2a0b5
parent9b98d347ce2b1ba371e4689ea42c22962ed32e8e (diff)
pep8
-rw-r--r--paramiko/ed25519key.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/paramiko/ed25519key.py b/paramiko/ed25519key.py
index 3e447eb7..01abea97 100644
--- a/paramiko/ed25519key.py
+++ b/paramiko/ed25519key.py
@@ -30,6 +30,7 @@ from paramiko.ssh_exception import SSHException, PasswordRequiredException
OPENSSH_AUTH_MAGIC = b"openssh-key-v1\x00"
+
def unpad(data):
# At the moment, this is only used for unpadding private keys on disk, and
# only unencrypted ones at that. In the future, if either of those changes,
@@ -63,7 +64,6 @@ class Ed25519Key(PKey):
self._signing_key = signing_key
self._verifying_key = verifying_key
-
def _parse_signing_key_data(self, data, password):
from paramiko.transport import Transport
# We may eventually want this to be usable for other key types, as
@@ -84,7 +84,9 @@ class Ed25519Key(PKey):
raise SSHException('Invalid key')
elif kdfname == "bcrypt":
if not password:
- raise PasswordRequiredException('Private key file is encrypted')
+ raise PasswordRequiredException(
+ 'Private key file is encrypted'
+ )
kdf = Message(kdfoptions)
bcrypt_salt = kdf.get_binary()
bcrypt_rounds = kdf.get_int()
@@ -120,7 +122,9 @@ class Ed25519Key(PKey):
cipher['mode'](key[cipher['key-size']:]),
backend=default_backend()
).decryptor()
- private_data = decryptor.update(private_ciphertext) + decryptor.finalize()
+ private_data = (
+ decryptor.update(private_ciphertext) + decryptor.finalize()
+ )
message = Message(unpad(private_data))
if message.get_int() != message.get_int():
@@ -138,7 +142,8 @@ class Ed25519Key(PKey):
signing_key = nacl.signing.SigningKey(key_data[:32])
# Verify that all the public keys are the same...
assert (
- signing_key.verify_key.encode() == public == public_keys[i] == key_data[32:]
+ signing_key.verify_key.encode() == public == public_keys[i] ==
+ key_data[32:]
)
signing_keys.append(signing_key)
# Comment, ignore.