summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2017-06-06 12:06:02 -0700
committerJeff Forcier <jeff@bitprophet.org>2017-06-06 12:06:02 -0700
commit1770f24202b24461cd7b10ed0650cb269576392b (patch)
tree5b3e6716849c805e25d6309bc55c9307ea606e1a
parent357ac45b49a888eaacf7efde272b8edcf7b55a93 (diff)
flake8
-rw-r--r--paramiko/kex_ecdh_nist.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/paramiko/kex_ecdh_nist.py b/paramiko/kex_ecdh_nist.py
index 8961dd14..702a872d 100644
--- a/paramiko/kex_ecdh_nist.py
+++ b/paramiko/kex_ecdh_nist.py
@@ -23,7 +23,7 @@ class KexNistp256():
def __init__(self, transport):
self.transport = transport
- #private key, client public and server public keys
+ # private key, client public and server public keys
self.P = long(0)
self.Q_C = None
self.Q_S = None
@@ -35,7 +35,7 @@ class KexNistp256():
return
m = Message()
m.add_byte(c_MSG_KEXECDH_INIT)
- #SEC1: V2.0 2.3.3 Elliptic-Curve-Point-to-Octet-String Conversion
+ # SEC1: V2.0 2.3.3 Elliptic-Curve-Point-to-Octet-String Conversion
m.add_string(self.Q_C.public_numbers().encode_point())
self.transport._send_message(m)
self.transport._expect_packet(_MSG_KEXECDH_REPLY)
@@ -56,23 +56,25 @@ class KexNistp256():
def _parse_kexecdh_init(self, m):
Q_C_bytes = m.get_string()
- self.Q_C = ec.EllipticCurvePublicNumbers.from_encoded_point(self.curve, Q_C_bytes)
+ self.Q_C = ec.EllipticCurvePublicNumbers.from_encoded_point(
+ self.curve, Q_C_bytes
+ )
K_S = self.transport.get_server_key().asbytes()
K = self.P.exchange(ec.ECDH(), self.Q_C.public_key(default_backend()))
K = long(hexlify(K), 16)
- #compute exchange hash
+ # compute exchange hash
hm = Message()
hm.add(self.transport.remote_version, self.transport.local_version,
self.transport.remote_kex_init, self.transport.local_kex_init)
hm.add_string(K_S)
hm.add_string(Q_C_bytes)
- #SEC1: V2.0 2.3.3 Elliptic-Curve-Point-to-Octet-String Conversion
+ # SEC1: V2.0 2.3.3 Elliptic-Curve-Point-to-Octet-String Conversion
hm.add_string(self.Q_S.public_numbers().encode_point())
hm.add_mpint(long(K))
H = self.hash_algo(hm.asbytes()).digest()
self.transport._set_K_H(K, H)
sig = self.transport.get_server_key().sign_ssh_data(H)
- #construct reply
+ # construct reply
m = Message()
m.add_byte(c_MSG_KEXECDH_REPLY)
m.add_string(K_S)
@@ -84,16 +86,18 @@ class KexNistp256():
def _parse_kexecdh_reply(self, m):
K_S = m.get_string()
Q_S_bytes = m.get_string()
- self.Q_S = ec.EllipticCurvePublicNumbers.from_encoded_point(self.curve, Q_S_bytes)
+ self.Q_S = ec.EllipticCurvePublicNumbers.from_encoded_point(
+ self.curve, Q_S_bytes
+ )
sig = m.get_binary()
K = self.P.exchange(ec.ECDH(), self.Q_S.public_key(default_backend()))
K = long(hexlify(K), 16)
- #compute exchange hash and verify signature
+ # compute exchange hash and verify signature
hm = Message()
hm.add(self.transport.local_version, self.transport.remote_version,
self.transport.local_kex_init, self.transport.remote_kex_init)
hm.add_string(K_S)
- #SEC1: V2.0 2.3.3 Elliptic-Curve-Point-to-Octet-String Conversion
+ # SEC1: V2.0 2.3.3 Elliptic-Curve-Point-to-Octet-String Conversion
hm.add_string(self.Q_C.public_numbers().encode_point())
hm.add_string(Q_S_bytes)
hm.add_mpint(K)