fetcher git crypto: Send password to openssl command through stdin. Closes #1443

This commit is contained in:
Hylke Bons 2013-12-06 23:38:12 +00:00
parent dd8c8a8fdf
commit 765fe05f81
2 changed files with 8 additions and 4 deletions

View file

@ -284,16 +284,18 @@ namespace SparkleLib.Git {
process.StartInfo.WorkingDirectory = TargetFolder;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.FileName = "openssl";
process.StartInfo.Arguments = "enc -d -aes-256-cbc -base64 -S " + this.crypto_salt +
" -pass pass:\"" + password + "\" -in \"" + password_check_file_path + "\"";
process.StartInfo.Arguments = "enc -d -aes-256-cbc -base64 -pass stdin" +
"-in \"" + password_check_file_path + "\"";
SparkleLogger.LogInfo ("Cmd | " + System.IO.Path.GetFileName (process.StartInfo.WorkingDirectory),
System.IO.Path.GetFileName (process.StartInfo.FileName) + " " + process.StartInfo.Arguments);
process.Start ();
process.StandardInput.WriteLine (password);
process.WaitForExit ();
if (process.ExitCode == 0) {

View file

@ -515,8 +515,10 @@ namespace SparkleShare {
public void CheckCryptoPasswordPage (string password)
{
bool is_password_correct = Program.Controller.CheckPassword (password);
UpdateCryptoPasswordContinueButtonEvent (is_password_correct);
new Thread(() => {
bool is_password_correct = Program.Controller.CheckPassword (password);
UpdateCryptoPasswordContinueButtonEvent (is_password_correct);
}).Start ();
}