B
Bill Gregg
I'm trying to decrypt a file using GPG and starting it via a
system.diagnostics.process. The required steps are:
1) Launch the GPG.exe with the correct parameters indicating what file
to decrypt.
2) Once GPG.exe begins, it prompts for the passphrase associated with
the key.
So in my C# code, I've created a process, configured the StartInfo for
the process to allow StandardInRedirect, started the process, and tried
to write the passphrase to the process using the StandardIn stream. But
nothing is ever sent to the process window. I've sent the passphrase
and flushed the stream 10 times in a row, but nothing ever gets written
to the process window. How can I pass a string to a process window?
Help,
Bill
See sample code:
using DotNetProcess = System.Diagnostics.Process;
string app = "gpg.exe";
string parms = " --output "+this.zipFile+" --yes --decrypt
"+this.targetFile;
DotNetProcess myProcess = new DotNetProcess();
myProcess.StartInfo.FileName =app;
myProcess.StartInfo.RedirectStandardInput=true;
myProcess.StartInfo.Arguments=parms;
myProcess.StartInfo.UseShellExecute=false;
myProcess.Start();
myProcess.StandardInput.WriteLine(EncryptionParms.PassPhrase);
myProcess.StandardInput.Flush();
system.diagnostics.process. The required steps are:
1) Launch the GPG.exe with the correct parameters indicating what file
to decrypt.
2) Once GPG.exe begins, it prompts for the passphrase associated with
the key.
So in my C# code, I've created a process, configured the StartInfo for
the process to allow StandardInRedirect, started the process, and tried
to write the passphrase to the process using the StandardIn stream. But
nothing is ever sent to the process window. I've sent the passphrase
and flushed the stream 10 times in a row, but nothing ever gets written
to the process window. How can I pass a string to a process window?
Help,
Bill
See sample code:
using DotNetProcess = System.Diagnostics.Process;
string app = "gpg.exe";
string parms = " --output "+this.zipFile+" --yes --decrypt
"+this.targetFile;
DotNetProcess myProcess = new DotNetProcess();
myProcess.StartInfo.FileName =app;
myProcess.StartInfo.RedirectStandardInput=true;
myProcess.StartInfo.Arguments=parms;
myProcess.StartInfo.UseShellExecute=false;
myProcess.Start();
myProcess.StandardInput.WriteLine(EncryptionParms.PassPhrase);
myProcess.StandardInput.Flush();