diff options
author | Andrew Wason <rectalogic@rectalogic.com> | 2019-02-09 11:23:39 -0500 |
---|---|---|
committer | Andrew Wason <rectalogic@rectalogic.com> | 2019-02-09 11:23:39 -0500 |
commit | 893cda63da0f708e4c335a69003746c32ad51895 (patch) | |
tree | da3736fbb732e148daac54a18c3f3be85205e305 | |
parent | a2fa7d3f3514b75f23f3992986f08e3ed1212caf (diff) |
Fix numbers vs key mixups
-rw-r--r-- | paramiko/ecdsakey.py | 5 | ||||
-rw-r--r-- | paramiko/kex_ecdh_nist.py | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/paramiko/ecdsakey.py b/paramiko/ecdsakey.py index 3e8e2526..b607eee1 100644 --- a/paramiko/ecdsakey.py +++ b/paramiko/ecdsakey.py @@ -160,12 +160,11 @@ class ECDSAKey(PKey): pointinfo = msg.get_binary() try: - numbers = ec.EllipticCurvePublicKey.from_encoded_point( + self.verifying_key = ec.EllipticCurvePublicKey.from_encoded_point( self.ecdsa_curve.curve_class(), pointinfo - ).public_numbers() + ) except ValueError: raise SSHException("Invalid public key") - self.verifying_key = numbers.public_key(backend=default_backend()) @classmethod def supported_key_format_identifiers(cls): diff --git a/paramiko/kex_ecdh_nist.py b/paramiko/kex_ecdh_nist.py index beabbe5f..ad5c9c79 100644 --- a/paramiko/kex_ecdh_nist.py +++ b/paramiko/kex_ecdh_nist.py @@ -66,9 +66,9 @@ class KexNistp256: Q_C_bytes = m.get_string() self.Q_C = ec.EllipticCurvePublicKey.from_encoded_point( self.curve, Q_C_bytes - ).public_numbers() + ) K_S = self.transport.get_server_key().asbytes() - K = self.P.exchange(ec.ECDH(), self.Q_C.public_key(default_backend())) + K = self.P.exchange(ec.ECDH(), self.Q_C) K = long(hexlify(K), 16) # compute exchange hash hm = Message() @@ -110,9 +110,9 @@ class KexNistp256: Q_S_bytes = m.get_string() self.Q_S = ec.EllipticCurvePublicKey.from_encoded_point( self.curve, Q_S_bytes - ).public_numbers() + ) sig = m.get_binary() - K = self.P.exchange(ec.ECDH(), self.Q_S.public_key(default_backend())) + K = self.P.exchange(ec.ECDH(), self.Q_S) K = long(hexlify(K), 16) # compute exchange hash and verify signature hm = Message() |