1

当我使用包装器将 Java 应用程序作为 Windows 服务运行时,一切正常,除非应用程序尝试解密文件。它产生以下错误:

GPG 错误 >> 代码:2 >> gpg:使用 RSA 密钥加密,ID ########
gpg 解密失败:密钥不可用。

该应用程序在不作为服务运行时可以毫无问题地加密和解密文件。包装器也可以正常工作。

环境变量已在 Windows 注册表中设置和确认,但由于某种原因,系统不会查看Users\AppData\... 密钥所在的目录。

这是一个自动化的应用程序,因此没有密码来加密或解密文件。

怎么了?系统可能在哪里寻找密钥?

4

2 回答 2

1

I resolved above problem by changing the service properties. Following step I took to resolve the problem.

  1. On command line enter services.msc then hit Enter Key. It will open services window.

  2. Locate my service and right click then click properties

  3. Click on Log on Tab then click on this account radio button

  4. Click on Browse button then Enter the object name to select I entered my username for my machine and click Check Name button once User name confirmed click Ok button

  5. Enter Password and Confirm Password then click Apply click ok notice dialog box

  6. Stop the service then restart the service sends encrypted files and it works as it should be.

Why I have to do this because when I created service by default it is uses Local System account not my user account where all the keys and profile located.

Now question is or someone likes to answer:

How to alter or change Local System account in Windows OS?

于 2011-03-04T16:31:45.273 回答
0

将您的密钥环添加到 C:\Users\Default\AppData\Roaming\gnupg 文件夹。显然本地系统帐户从这里获取密钥环。

于 2011-11-01T14:59:47.457 回答