diff options
author | Kenneth Skovhede <kenneth@hexad.dk> | 2014-06-30 13:28:00 +0400 |
---|---|---|
committer | Kenneth Skovhede <kenneth@hexad.dk> | 2014-06-30 13:28:00 +0400 |
commit | ed725db095720e2995061fb925df5ea7b2c40886 (patch) | |
tree | a8df04c7b1f7d01cf89953b6c17595beaa8f3302 /BuildTools | |
parent | 97be4258cc37411376e43db4a5b0baca57d5ff9a (diff) |
Removed some debug code in AutoUpdateBuilder and added keyfile password as an option
Diffstat (limited to 'BuildTools')
-rw-r--r-- | BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.csproj | 1 | ||||
-rw-r--r-- | BuildTools/AutoUpdateBuilder/Program.cs | 18 |
2 files changed, 11 insertions, 8 deletions
diff --git a/BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.csproj b/BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.csproj index 5f96ddc9e..2eabe4d6c 100644 --- a/BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.csproj +++ b/BuildTools/AutoUpdateBuilder/AutoUpdateBuilder.csproj @@ -17,7 +17,6 @@ <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <ConsolePause>false</ConsolePause> - <Commandlineparameters>--input=/Users/kenneth/Udvikler/duplicati-git/Tools/SQLIteTool/obj/Debug --keyfile=/Users/kenneth/Dropbox/Privat/Duplicati-updater.key --output=/Users/kenneth/Downloads/duplicati-package --manifest=/Users/kenneth/Udvikler/duplicati-git/Updates/debug.manifest</Commandlineparameters> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>full</DebugType> diff --git a/BuildTools/AutoUpdateBuilder/Program.cs b/BuildTools/AutoUpdateBuilder/Program.cs index 30c98720a..df32e1066 100644 --- a/BuildTools/AutoUpdateBuilder/Program.cs +++ b/BuildTools/AutoUpdateBuilder/Program.cs @@ -14,11 +14,13 @@ namespace AutoUpdateBuilder string outputfolder;
string keyfile;
string manifestfile;
+ string keyfilepassword;
opts.TryGetValue("input", out inputfolder);
opts.TryGetValue("output", out outputfolder);
opts.TryGetValue("keyfile", out keyfile);
opts.TryGetValue("manifest", out manifestfile);
+ opts.TryGetValue("keyfile-password", out keyfilepassword);
if (string.IsNullOrWhiteSpace(inputfolder))
{
@@ -44,14 +46,17 @@ namespace AutoUpdateBuilder return 4;
}
- Console.WriteLine("Enter keyfile passphrase");
- string pwd = "zA8A6ZY8ejqQT9gZ"; //Console.ReadLine().Trim();
+ if (string.IsNullOrWhiteSpace(keyfilepassword))
+ {
+ Console.WriteLine("Enter keyfile passphrase: ");
+ keyfilepassword = Console.ReadLine().Trim();
+ }
if (!System.IO.File.Exists(keyfile))
{
Console.WriteLine("Keyfile not found, creating new");
var newkey = System.Security.Cryptography.RSACryptoServiceProvider.Create().ToXmlString(true);
- using (var enc = new Duplicati.Library.Encryption.AESEncryption(pwd, new Dictionary<string, string>()))
+ using (var enc = new Duplicati.Library.Encryption.AESEncryption(keyfilepassword, new Dictionary<string, string>()))
using (var fs = System.IO.File.OpenWrite(keyfile))
using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(newkey)))
enc.Encrypt(ms, fs);
@@ -62,7 +67,7 @@ namespace AutoUpdateBuilder var privkey = (System.Security.Cryptography.RSACryptoServiceProvider)System.Security.Cryptography.RSACryptoServiceProvider.Create();
- using(var enc = new Duplicati.Library.Encryption.AESEncryption(pwd, new Dictionary<string, string>()))
+ using(var enc = new Duplicati.Library.Encryption.AESEncryption(keyfilepassword, new Dictionary<string, string>()))
using(var ms = new System.IO.MemoryStream())
using(var fs = System.IO.File.OpenRead(keyfile))
{
@@ -70,7 +75,7 @@ namespace AutoUpdateBuilder ms.Position = 0;
using(var sr = new System.IO.StreamReader(ms))
- privkey.FromXmlString(sr.ReadToEnd());
+ privkey.FromXmlString(sr.ReadToEnd());
}
if (Duplicati.License.AutoUpdateSettings.SignKey == null || privkey.ToXmlString(false) != Duplicati.License.AutoUpdateSettings.SignKey.ToXmlString(false))
@@ -115,5 +120,4 @@ namespace AutoUpdateBuilder return 0;
}
}
-}
-
+}
\ No newline at end of file |