From dc8016d21b87a3dc0803ee229ee00cf34634fd35 Mon Sep 17 00:00:00 2001 From: MineRobber___T Date: Fri, 6 Sep 2019 13:30:05 -0400 Subject: [PATCH 1/4] Passphrase to decrypt, not password While it is true that the exception called is "PasswordRequiredException", returning a message of needing a "passphrase" instead will clue the reader in that their key's password needs to go into the "Passphrase" box --- webssh/handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webssh/handler.py b/webssh/handler.py index a35eee1..c12b14c 100644 --- a/webssh/handler.py +++ b/webssh/handler.py @@ -153,7 +153,7 @@ 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' From 1a9ba5bb3167d0deb5a37c289ba43d517c7d095d Mon Sep 17 00:00:00 2001 From: khuxkm fbexl Date: Fri, 6 Sep 2019 13:50:38 -0400 Subject: [PATCH 2/4] Fix wrong password method to also say 'passphrase' --- webssh/handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webssh/handler.py b/webssh/handler.py index c12b14c..55abd55 100644 --- a/webssh/handler.py +++ b/webssh/handler.py @@ -158,7 +158,7 @@ class PrivateKey(object): 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) From 850dd39f26de2944f37813c7b60006e8c5832f8e Mon Sep 17 00:00:00 2001 From: khuxkm fbexl Date: Fri, 6 Sep 2019 13:54:24 -0400 Subject: [PATCH 3/4] Fix test for passphrase --- tests/test_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_handler.py b/tests/test_handler.py index f136863..5292eed 100644 --- a/tests/test_handler.py +++ b/tests/test_handler.py @@ -152,7 +152,7 @@ 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: From b2261367e807f8a715ec019eee864fc7f5526344 Mon Sep 17 00:00:00 2001 From: khuxkm fbexl Date: Fri, 6 Sep 2019 14:19:24 -0400 Subject: [PATCH 4/4] Fix wrong passphrase test --- tests/test_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_handler.py b/tests/test_handler.py index 5292eed..fce5187 100644 --- a/tests/test_handler.py +++ b/tests/test_handler.py @@ -157,7 +157,7 @@ class TestPrivateKey(unittest.TestCase): 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)