config: include both private and public keys for use in the app

This commit is contained in:
Hylke Bons 2012-12-14 16:15:08 +01:00
parent 7cf1e375e9
commit 27da1ba870
2 changed files with 14 additions and 4 deletions

View file

@ -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;
}

View file

@ -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)