keys: Keep keys in ssh/ subfolder

This commit is contained in:
Hylke Bons 2016-03-25 19:37:39 +00:00
parent ce5adbe4ba
commit c840050c78
2 changed files with 7 additions and 1 deletions

View file

@ -780,7 +780,10 @@ namespace SparkleShare {
private string [] CreateKeys ()
{
string keys_path = Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath);
// TODO: Make a proper member for this
string config_path = Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath);
string keys_path = Path.Combine (config_path, "ssh");
string key_file_name = DateTime.Now.ToString ("yyyy-MM-dd_HH\\hmm");
return SparkleKeys.GenerateKeyPair (keys_path, key_file_name);

View file

@ -31,6 +31,9 @@ namespace SparkleShare {
key_name += ".key";
string key_file_path = Path.Combine (output_path, key_name);
if (!Directory.Exists (output_path))
Directory.CreateDirectory (output_path);
if (File.Exists (key_file_path)) {
SparkleLogger.LogInfo ("Auth", "A key pair exists ('" + key_name + "'), leaving it untouched");
return new string [] { key_file_path, key_file_path + ".pub" };