aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wong <wongma@protonmail.ch>2015-07-19 22:46:39 -0400
committerMatthew Wong <wongma@protonmail.ch>2015-07-19 22:46:39 -0400
commit3b12c79a6cbf86889e3c430f35669cfbeea99679 (patch)
treeaea3303a8847e0950f08ee407670fc269de70ad2
parent7e0b860816cdea00ad717ef294bbf7ed91393d4e (diff)
ssh keys with empty passphrase should not be written as "encrypted" (said keys still worked)
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java b/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java
index 11db75b4..40c44065 100644
--- a/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java
+++ b/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java
@@ -175,7 +175,11 @@ public class SshKeyGen extends AppCompatActivity {
File file = new File(getFilesDir() + "/.ssh_key");
FileOutputStream out = new FileOutputStream(file, false);
- kp.writePrivateKey(out, passphrase.getBytes());
+ if (passphrase.length() > 0) {
+ kp.writePrivateKey(out, passphrase.getBytes());
+ } else {
+ kp.writePrivateKey(out);
+ }
file = new File(getFilesDir() + "/.ssh_key.pub");
out = new FileOutputStream(file, false);