Skip to content

Commit

Permalink
Merge branch '2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed Jun 13, 2017
2 parents 772d493 + 47f9048 commit e5645e5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
7 changes: 7 additions & 0 deletions paramiko/ed25519key.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ def asbytes(self):
m.add_string(v.encode())
return m.asbytes()

def __hash__(self):
if self.can_sign():
v = self._signing_key.verify_key
else:
v = self._verifying_key
return hash((self.get_name(), v))

def get_name(self):
return "ssh-ed25519"

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
'Programming Language :: Python :: 3.6',
],
install_requires=[
'bcrypt>=3.0.0',
'bcrypt>=3.1.3',
'cryptography>=1.1',
'pynacl>=1.0.1',
'pyasn1>=0.1.7',
Expand Down
6 changes: 6 additions & 0 deletions sites/www/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Changelog
=========

* :bug:`993` Ed25519 host keys were not comparable/hashable, causing an
exception if such a key existed in a ``known_hosts`` file. Thanks to Oleh
Prypin for the report and Pierce Lopez for the fix.
* :bug:`990` The (added in 2.2.0) ``bcrypt`` dependency should have been on
version 3.1.3 or greater (was initially set to 3.0.0 or greater.) Thanks to
Paul Howarth for the report.
* :release:`2.2.0 <2017-06-09>`
* :release:`2.1.3 <2017-06-09>`
* :release:`2.0.6 <2017-06-09>`
Expand Down
10 changes: 9 additions & 1 deletion tests/test_pkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,17 @@ def test_ed25519(self):
key2 = Ed25519Key.from_private_key_file(
test_path('test_ed25519_password.key'), b'abc123'
)

self.assertNotEqual(key1.asbytes(), key2.asbytes())

def test_ed25519_compare(self):
# verify that the private & public keys compare equal
key = Ed25519Key.from_private_key_file(test_path('test_ed25519.key'))
self.assertEqual(key, key)
pub = Ed25519Key(data=key.asbytes())
self.assertTrue(key.can_sign())
self.assertTrue(not pub.can_sign())
self.assertEqual(key, pub)

def test_keyfile_is_actually_encrypted(self):
# Read an existing encrypted private key
file_ = test_path('test_rsa_password.key')
Expand Down

0 comments on commit e5645e5

Please sign in to comment.