Run gpg.exe from asp.net website

I have an ASP.NET website written in c#, that allows users to upload a file of names and addresses, to be imported into an SQL database.  The users need to supply the file in a GnuPG encrypted file, which is then automatically decrypted and then deleted after import.

Evary part of the process works on my Visual Studio 2008 development server but when I move it to the production environment, it all seams fine apart from the decryption.

The code I'm using is as follows:
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("cmd.exe");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.WorkingDirectory = TBRv2SVs.GnuPG;
System.Diagnostics.Process process = System.Diagnostics.Process.Start(psi);
string sCommandLine = "echo " + passphrase + "| gpg.exe --passphrase-fd 0 -o \"" + outputFileNameFullPath + "\" --decrypt \"" + encryptedFile.FullName + "\"";
process.StandardInput.WriteLine(sCommandLine);
process.StandardInput.Flush();
process.StandardInput.Close();
process.WaitForExit();
process.Close();

Open in new window

boxerbillAsked:
Who is Participating?
 
boxerbillConnect With a Mentor Author Commented:
Thanks again rajapandian_81.  I think you may be on the right track but the changes to the local security policy require a restart, which has to be scheduled in and that won't be happenning this week.  Unless there is a way to refresh the local security policy without a reboot?
0
 
eguilhermeCommented:
does the asp.net/network users have write/read permission to the folder where the gpg is creating the decrypted file?
0
 
rajapandian_81Commented:
Hi,

System.Diagnostics.Process will not be supported in web application. (After configuring in IIS, it will not work). Try different kind of code.

http://www.codeguru.com/csharp/.net/net_security/pgp/article.php/c4699
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
boxerbillAuthor Commented:
Thanks eguilherme.  I've set read/write/modify permission for the local ASP.NET account and the anonymous access user account.  I have also set read remissions for both on the GnuPG executable folder.  IIS has been configured with Excecute permissions for both Scripts and Excecutable.  Still no joy.

Thanks also rajapandian 81 but that code only apears to have the capabilty to work on messages. I'm trying to decrypt files. I'm sure it's possible because it works on my development server.

I can't find any error messages anywhere to say why it's not working but everything seems to point to the lack of permission to actually run either the cmd.exe or gpg.exe command.
0
 
rajapandian_81Commented:
Have you tested from development server IIS ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.