Encryption failed when window service " local system Account"

Hi Team,
Am creating window service for PGP encryption using Starksoft.Cryptography.OpenPGP.dll.

when I start the service with “local system Account” am getting 0kb PGP file.

In case I give Username and password means am getting correct PGP file.

My client not give permanent user name and password. because monthly twice password will reset. This time am getting error.

So I want to run service with “local system Account”"

Please give any solution for this problem.

Below my sample code

Gpg gpg = new Gpg();
gpg.BinaryPath = “C:\Program Files (x86)\GnuPG\gpg.exe”;
gpg.Recipient = “12346789”;
gpg.Encrypt(sourceFileStream, DestinationFileStream);
DestinationFileStream.Flush();
DestinationFileStream…Close();

PGP_Failed.PNG

Hi,

Am creating window service for PGP encryption using Starksoft.Cryptography.OpenPGP.dll.

I don’t know anything about it. Maybe ask the provider of that thing?

As general advice: GnuPG Stores its Keys and Data under the users Home directory. E.g. c:\users<username>\AppData\Roaming\gnupg .

If you run a command with a different user like the local system account the keys etc won’t be available.

A good advice is to use the parameter “–homedir ” for all calls to gnupg which overrides the default homedirectory. That way you can set it up in a static homedir and use this homedir from different users.

There is also a note about this here:
https://wiki.gnupg.org/TroubleShooting#Windows_.3E_8_and_Server_2012_Task_Scheduler_Problems

Hi,
Thanks for valuable response.

Last 3 days am spending for this issue.

Thanks again.

Please also check out https://wiki.gnupg.org/APIs
(once there are a few more operations to be done with GnuPG,
a good robust API would use GPGME to connecto to gpg.exe).