mirror of https://github.com/huashengdun/webssh
Merge pull request #83 from MineRobber9000/patch-1
Need a passphrase to decrypt, not passwordpull/104/head
commit
8d0567329f
|
@ -152,12 +152,12 @@ class TestPrivateKey(unittest.TestCase):
|
|||
pk = self.get_pk_obj(fname, password='')
|
||||
with self.assertRaises(InvalidValueError) as ctx:
|
||||
pk.get_pkey_obj()
|
||||
self.assertIn('Need a password', str(ctx.exception))
|
||||
self.assertIn('Need a passphrase', str(ctx.exception))
|
||||
|
||||
pk = self.get_pk_obj(fname, password='wrongpass')
|
||||
with self.assertRaises(InvalidValueError) as ctx:
|
||||
pk.get_pkey_obj()
|
||||
self.assertIn('wrong password', str(ctx.exception))
|
||||
self.assertIn('wrong passphrase', str(ctx.exception))
|
||||
|
||||
pk = self.get_pk_obj(fname, password=password)
|
||||
self.assertIsInstance(pk.get_pkey_obj(), klass)
|
||||
|
|
|
@ -153,12 +153,12 @@ class PrivateKey(object):
|
|||
try:
|
||||
return pkeycls.from_private_key(self.iostr, password=password)
|
||||
except paramiko.PasswordRequiredException:
|
||||
raise InvalidValueError('Need a password to decrypt the key.')
|
||||
raise InvalidValueError('Need a passphrase to decrypt the key.')
|
||||
except paramiko.SSHException as exc:
|
||||
logging.error(str(exc))
|
||||
msg = 'Invalid key'
|
||||
if self.password:
|
||||
msg += ' or wrong password "{}" for decrypting it.'.format(
|
||||
msg += ' or wrong passphrase "{}" for decrypting it.'.format(
|
||||
self.password)
|
||||
raise InvalidValueError(msg)
|
||||
|
||||
|
|
Loading…
Reference in New Issue