Skip to content

Commit

Permalink
Fixed a bug in ssh login with encrypted private key
Browse files Browse the repository at this point in the history
Check the type of the returned error instead of the error message to
determine if the private key file is encrypted by a passphrase.
  • Loading branch information
gilbertchen committed Apr 17, 2020
1 parent 4c3557e commit 835af11
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/duplicacy_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func CreateStorage(preference Preference, resetPassword bool, threads int) (stor
} else {
keySigner, err = ssh.ParsePrivateKey(content)
if err != nil {
if strings.Contains(err.Error(), "cannot decode encrypted private keys") {
if _, ok := err.(*ssh.PassphraseMissingError); ok {
LOG_TRACE("SSH_PUBLICKEY", "The private key file is encrypted")
passphrase = GetPassword(preference, "ssh_passphrase", "Enter the passphrase to decrypt the private key file:", false, resetPassword)
if len(passphrase) == 0 {
Expand Down

1 comment on commit 835af11

@gilbertchen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Duplicacy Forum. There might be relevant details there:

https://forum.duplicacy.com/t/duplicacy-web-with-sftp-password-protected-ssh-keyfile-stopped-working-bug-in-v2-5-0/3494/4

Please sign in to comment.