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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
The Five Tenets of the Most Secure Backup

Data loss can hit a business in any number of ways. In reality, companies should expect to lose data at some point. The challenge is having a plan to recover from such an event.

rajapandian_81Commented:
Have you tested from development server IIS ?
0
boxerbillAuthor 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.