Skip to content

Commit

Permalink
Add a (failing :() test re: ECDSA private keys
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed Sep 5, 2014
1 parent 146942c commit 76c2073
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,40 @@ def test_2_client_dsa(self):
stdout.close()
stderr.close()

def test_2_5_client_ecdsa(self):
"""
verify that SSHClient works with an ECDSA key.
"""
threading.Thread(target=self._run).start()
host_key = paramiko.RSAKey.from_private_key_file(test_path('test_rsa.key'))
public_host_key = paramiko.RSAKey(data=host_key.asbytes())

self.tc = paramiko.SSHClient()
self.tc.get_host_keys().add('[%s]:%d' % (self.addr, self.port), 'ssh-rsa', public_host_key)
self.tc.connect(self.addr, self.port, username='slowdive', key_filename=test_path('test_ecdsa.key'))

self.event.wait(1.0)
self.assertTrue(self.event.isSet())
self.assertTrue(self.ts.is_active())
self.assertEqual('slowdive', self.ts.get_username())
self.assertEqual(True, self.ts.is_authenticated())

stdin, stdout, stderr = self.tc.exec_command('yes')
schan = self.ts.accept(1.0)

schan.send('Hello there.\n')
schan.send_stderr('This is on stderr.\n')
schan.close()

self.assertEqual('Hello there.\n', stdout.readline())
self.assertEqual('', stdout.readline())
self.assertEqual('This is on stderr.\n', stderr.readline())
self.assertEqual('', stderr.readline())

stdin.close()
stdout.close()
stderr.close()

def test_3_multiple_key_files(self):
"""
verify that SSHClient accepts and tries multiple key files.
Expand Down

0 comments on commit 76c2073

Please sign in to comment.