我有以下系统配置:
带有 Service Pack 1 的 Windows 2008 Server 64 位
Gpg4win,版本 2.1.0
2.1.0 版中包含的 Gpg4win 组件有:
GnuPG: 2.0.17
Kleopatra: 2.1.0 (2011-02-04)
GPA: 0.9.1-svn1024
GpgOL: 1.1.2
GpgEX: 0.9.7
Claws-Mail: 3.7.8cvs47
Kompendium DE: 3.0.0
Kompendium EN: 3.0.0-beta1
我要做的是使用 GnuPG 和 Process.Start 从 .NET 3.5 Web 服务解密本地文件。
当从那台机器上的 cmd.exe 运行时,下面的这个命令工作得很好。
"c:\Program Files (x86)\GNU\GnuPG\pub\" --charset utf8 --no-tty --output c:\decrypted_file.txt" --batch -r "name_for_secret_key"
--passphrase-file "C:\path_to_passphrase_file.txt"
--decrypt "c:\encrypted_file.gpg"
但是,当从部署在 IIS 7.5 下的 Web 服务执行时,它不起作用。尝试了以下方法:
- impersonated user with admin rights (in the application pool or in the code itself) to run the process under
- ran the cmd.exe process directly with Process.Start and passed in the arguments as described above (by redirecting standard input)
结果
- exit code for gpg2.exe is 255 and nothing else happened
- in event viewer / application found errors like: Faulting application gpg2.exe, version 0.0.0.0, time stamp 0x4d6e6194, faulting module unknown, version 0.0.0.0, time stamp 0x00000000, exception code 0xc0000005, fault offset 0x00000000, process id 0x1a914, application start time 0x01cd3f46059b0031.
- by redirecting standarderror I only got the same 255 exit code
- ran Process Monitor on that machine but that hasn't helped either, there were some "Name Not Found" issues, no access denied problems and both gpg.exe and gpg2.exe results were SUCCESS and exit codes were 255.
- DEP has default settings, it's on on essential windows programs and services
你能想出一些与我已经尝试过的不同的东西来让它工作吗?