From 97911c587754a7c11e594004b77c4ac53af8a468 Mon Sep 17 00:00:00 2001 From: Fabian Henneke Date: Thu, 28 May 2020 06:27:30 +0200 Subject: Use SSHJ for SSH public key authentication (#801) --- app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt') diff --git a/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt b/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt index fb7d7e82..c75f7ad3 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt @@ -146,10 +146,11 @@ abstract class BaseGitActivity : AppCompatActivity() { } if (PasswordRepository.isInitialized) PasswordRepository.addRemote("origin", newUrl, true) - // HTTPS authentication sends the password to the server, so we must wipe the password when - // the server is changed. - if (previousUrl.isNotEmpty() && newUrl != previousUrl && protocol == Protocol.Https) + // When the server changes, remote password and host key file should be deleted. + if (previousUrl.isNotEmpty() && newUrl != previousUrl) { encryptedSettings.edit { remove("https_password") } + File("$filesDir/.host_key").delete() + } url = newUrl return GitUpdateUrlResult.Ok } @@ -201,8 +202,7 @@ abstract class BaseGitActivity : AppCompatActivity() { return } } - op.executeAfterAuthentication(connectionMode, serverUser, - File("$filesDir/.ssh_key"), identity) + op.executeAfterAuthentication(connectionMode, serverUser, identity) } catch (e: Exception) { e.printStackTrace() MaterialAlertDialogBuilder(this).setMessage(e.message).show() -- cgit v1.2.3