From 3b12c79a6cbf86889e3c430f35669cfbeea99679 Mon Sep 17 00:00:00 2001 From: Matthew Wong Date: Sun, 19 Jul 2015 22:46:39 -0400 Subject: ssh keys with empty passphrase should not be written as "encrypted" (said keys still worked) --- app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/src/main/java') 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); -- cgit v1.2.3