From 490cf6fc544f485f3cd9e5a5a26cac671f5a6269 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 14 Dec 2012 16:15:08 +0100 Subject: [PATCH] config: include both private and public keys for use in the app --- SparkleLib/SparkleConfig.cs | 14 ++++++++++---- SparkleLib/SparkleUser.cs | 4 ++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/SparkleLib/SparkleConfig.cs b/SparkleLib/SparkleConfig.cs index fdc34b9a..03404a26 100755 --- a/SparkleLib/SparkleConfig.cs +++ b/SparkleLib/SparkleConfig.cs @@ -136,11 +136,17 @@ namespace SparkleLib { string user_name = name_node.Value; string user_email = email_node.Value; - SparkleUser user = new SparkleUser (user_name, user_email); - string [] pubkey_file_paths = Directory.GetFiles (Path.GetDirectoryName (FullPath), "*.pub"); + SparkleUser user = new SparkleUser (user_name, user_email); - if (pubkey_file_paths.Length > 0) - user.PublicKey = File.ReadAllText (pubkey_file_paths [0]); + string [] private_key_file_paths = Directory.GetFiles (Path.GetDirectoryName (FullPath), "*.key"); + + if (private_key_file_paths.Length > 0) { + user.PrivateKey = File.ReadAllText (private_key_file_paths [0]); + user.PrivateKeyFilePath = private_key_file_paths [0]; + + user.PublicKey = File.ReadAllText (private_key_file_paths [0] + ".pub"); + user.PublicKeyFilePath = private_key_file_paths [0] + ".pub"; + } return user; } diff --git a/SparkleLib/SparkleUser.cs b/SparkleLib/SparkleUser.cs index ef44bc41..f15234a4 100644 --- a/SparkleLib/SparkleUser.cs +++ b/SparkleLib/SparkleUser.cs @@ -24,7 +24,11 @@ namespace SparkleLib { public readonly string Name; public readonly string Email; + public string PrivateKey; + public string PrivateKeyFilePath; + public string PublicKey; + public string PublicKeyFilePath; public SparkleUser (string name, string email)