Skip to content

Refactor key loading logic into its own method for clarity and better er...#224

Closed
alanfranz wants to merge 1 commit intoparamiko:masterfrom
alanfranz:master
Closed

Refactor key loading logic into its own method for clarity and better er...#224
alanfranz wants to merge 1 commit intoparamiko:masterfrom
alanfranz:master

Conversation

@alanfranz
Copy link
Copy Markdown

Many a time, when trying to login to a server using multiple RSA keys through the key_filename parameter, I got an error like "Not a valid DSA key file". This was puzzling because all keys were in fact RSA, and perfecly valid, and I was able to log in other servers.

In fact the issue was different: the problem lied in the fact that the public key matching the private RSA key was not in the target authorized_keys file, but the connection logic "masked" the true error with the last "saved exception", and since it tried to load DSA keys after RSA keys, the error was always "not a valid DSA key file".

This proposal splits the key loading part into its own method, with its own exception; in this situation, the correct "authentication failed" exception will be propagated. Of course, if an invalid RSA/DSA key file is found after an authentication failure, it's still the latter error that will be propagated, yet I think it's an improvement over the original behaviour.

@bitprophet bitprophet added this to the 1.15 milestone Aug 11, 2014
@bitprophet
Copy link
Copy Markdown
Member

Subsumed by #387.

@bitprophet bitprophet closed this Sep 6, 2014
@bitprophet bitprophet removed this from the 1.15 milestone Sep 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants