ssh keys with empty passphrase should not be written as "encrypted" (said keys still worked)

This commit is contained in:
Matthew Wong 2015-07-19 22:46:39 -04:00
parent 7e0b860816
commit 3b12c79a6c

View file

@ -175,7 +175,11 @@ public class SshKeyGen extends AppCompatActivity {
File file = new File(getFilesDir() + "/.ssh_key"); File file = new File(getFilesDir() + "/.ssh_key");
FileOutputStream out = new FileOutputStream(file, false); 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"); file = new File(getFilesDir() + "/.ssh_key.pub");
out = new FileOutputStream(file, false); out = new FileOutputStream(file, false);