mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-01 14:55:19 +00:00
Don't ask for ssh key passphrase if key is not encrypted with one #106
This commit is contained in:
@@ -9,6 +9,8 @@ import android.text.InputType;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.jcraft.jsch.JSch;
|
||||
import com.jcraft.jsch.KeyPair;
|
||||
import com.zeapo.pwdstore.R;
|
||||
import com.zeapo.pwdstore.UserPreference;
|
||||
import com.zeapo.pwdstore.git.config.GitConfigSessionFactory;
|
||||
@@ -133,7 +135,9 @@ public abstract class GitOperation {
|
||||
passphrase.setHint("Passphrase");
|
||||
passphrase.setWidth(LinearLayout.LayoutParams.MATCH_PARENT);
|
||||
passphrase.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
|
||||
JSch jsch = new JSch();
|
||||
KeyPair keyPair = KeyPair.load(jsch, callingActivity.getFilesDir() + "/.ssh_key");
|
||||
if (keyPair.isEncrypted()) {
|
||||
new AlertDialog.Builder(callingActivity)
|
||||
.setTitle(callingActivity.getResources().getString(R.string.passphrase_dialog_title))
|
||||
.setMessage(callingActivity.getResources().getString(R.string.passphrase_dialog_text))
|
||||
@@ -153,6 +157,9 @@ public abstract class GitOperation {
|
||||
// Do nothing.
|
||||
}
|
||||
}).show();
|
||||
} else {
|
||||
setAuthentication(sshKey, username, "").execute();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
final EditText password = new EditText(callingActivity);
|
||||
|
Reference in New Issue
Block a user