You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm trying to identify whether an arbitrary file is (1) a SSH private key, (2) using which algo, (3) if it has a passphrase and if yes (4) if the passphrase I provide is valid.
I use a trial and error process basing myself on the exceptions raised, so if I need a passphrase I have paramiko.ssh_exception.PasswordRequiredException telling me so. If I try to load an ECDSA with paramiko.RSAKey.from_private_key_file, I have an paramiko.ssh_exception.SSHException. But if I try to load a RSA key with the same line using a wrong passphrase, I still have a SSHException, and I must check the string value of the exception to differenciate (if "checkints do not match" in str(e):)
It would be great to have for instance a paramiko.ssh_exception.InvalidPasswordException (raised in pkey.py line 477) so that people (at least I :D ) don't have to rely on parsing the error string :)
The text was updated successfully, but these errors were encountered:
Hi,
I'm trying to identify whether an arbitrary file is (1) a SSH private key, (2) using which algo, (3) if it has a passphrase and if yes (4) if the passphrase I provide is valid.
I use a trial and error process basing myself on the exceptions raised, so if I need a passphrase I have
paramiko.ssh_exception.PasswordRequiredException
telling me so. If I try to load an ECDSA withparamiko.RSAKey.from_private_key_file
, I have anparamiko.ssh_exception.SSHException
. But if I try to load a RSA key with the same line using a wrong passphrase, I still have aSSHException
, and I must check the string value of the exception to differenciate (if "checkints do not match" in str(e):
)It would be great to have for instance a
paramiko.ssh_exception.InvalidPasswordException
(raised inpkey.py
line 477) so that people (at least I :D ) don't have to rely on parsing the error string :)The text was updated successfully, but these errors were encountered: