I've inherited some code that attempts to encrypt a text file by programmatically calling gpg.exe. It works fine on my WinXP Pro dev machine but will not work when I deploy to a Win Server 08 SP2 machine. The application is an ASP.NET 2.0 app in VB.NET. When I use the debugger to inspect the Process object it says the process exited with an Exit Code of 2 and the MainModule property has a value of "Access is denied". I used Process Monitor to capture some results and it seems that gpg.exe is denied access to create a pubring.gpg file in the following path:
I've also tried passing the "homedir" argument to gpg.exe to no avail. Could this be an impersonation problem of some kind? Any ideas are appreciated.
Windows Server 2008 SP2
GnuPG Version 1.4.10
Dim psi As New ProcessStartInfo(HttpContext.Current.Request.PhysicalApplicationPath & "App_Data\\gpg.exe")
psi.UseShellExecute = False
psi.CreateNoWindow = False
psi.RedirectStandardOutput = False
psi.RedirectStandardInput = True
psi.RedirectStandardError = False
psi.Arguments = " --always-trust -e -r """ & PublicKeyName & """ """ & fileLoc & """"
Dim proc As Process = Process.Start(psi)