GnuPG and CreateProcess in Delphi Service

Trying to use GnuPG with Delphi (Win32). I need to sign a file with a console command like this:

"C:\Program Files\GNU\GnuPG\gpg.exe" -a -u Alex --passphrase secretpassword --yes --clearsign -o C:\Result.asc C:\InputFile.txt

I first created a normal VCL Forms application and used a function CreateProcess

, everything was fine, but when I passed this code to my service application, gpg.exe exits with code 2. Maybe I am missing something? Any ideas?

Update

Just in case someone has such a problem. GnuPG stores keys in C:\Documents And Settings\<username>\Application Data\gnupg\

, but when the service is started from a different user account (SYSTEM) it cannot find your key. GL and HF

0


a source to share


2 answers


Try dumping stderr and see if you have anything. You may be able to send a message. It might be a problem reading the passphrase. I kind of remember that I should have passed the passphrase to gpg instead of being specified as a parameter.



+2


a source


As a child device app, there is no wrapper as a parent, so child apps may simply not use stdio. Try using cmd / c or shellexecute. Or better, use a program that doesn't always require stdio.



0


a source







All Articles