Writing to a Process

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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();




*** Sent via Developersdex http://www.developersdex.com ***
.



Relevant Pages

  • Inexcusable weakness in Kmail / GnuPG
    ... a journo, i can't take any chances, so i don't keep my passphrase in memory. ... So i decrypt the incoming message, and then i reply to it ... If you forward an encrypted memo as an attachment, ... While it's always good for us to be paranoid, ...
    (Bugtraq)
  • Question about password checkin
    ... I want to do a symetric crypt program wich crypt and decrypt file using a ... To decrypt a file, a dialog box will ask a pass-phrase. ... When entering passphrase for decrypting, I decryp the complete file, I ... compute the hash and I compare. ...
    (sci.crypt)
  • [opensuse] UPDATE: gpg2 pass phrase problem.
    ... And more importantly how do I get it to NEVER EVER cache the passphrase. ... from the same command shell 2 seconds ago. ... or if the pinentry popup passphrase input box doesn't wait ... I do NOT expect gpg to decrypt the file based on ...
    (SuSE)
  • fileno
    ... I am using gpg within a Perl program to decrypt some data files. ... use fileno function but it is hanging waiting on the passphrase. ...
    (perl.beginners)
  • Re: Beginner Question:Gnupg Decryption
    ... I would need to specify both, the private keys passphrase and the key- ... id in order to decrypt ... email recipients could burteforce the message and easily detect weak ... From the fact that this CGI program has been written in Haskell, ...
    (sci.crypt)