Skip to content

Commit

Permalink
Fix #68 Handle invalid keys
Browse files Browse the repository at this point in the history
Fall back to default JSCH if the normal getJsch fails due to an
unreadable private key.
  • Loading branch information
ajoberstar committed Aug 7, 2015
1 parent d959c78 commit a2469e5
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ class JschAgentProxySessionFactory extends JschConfigSessionFactory {
*/
@Override
protected JSch getJSch(Host hc, FS fs) throws JSchException {
JSch jsch = super.getJSch(hc, fs)
JSch jsch
try {
jsch = super.getJSch(hc, fs)
} catch (JSchException e) {
jsch = super.createDefaultJsch(fs)
}

if (config.sshPrivateKeyPath) {
jsch.addIdentity(config.sshPrivateKeyPath)
Expand Down

0 comments on commit a2469e5

Please sign in to comment.