GnuPG v2.2.17.22805 with StarksoftCryptographyOpenPGP

Robert J. Hansen rjh at
Tue Dec 17 15:43:55 CET 2019

On 2019-12-16 21:00, Rick Rustad wrote:
> I'm running into some difficulties trying to encrypt and sign a file
> using gpg and Starksoft through a .Net C# API.

The good news is there's a good chance this is an easy fix.

> Might you have some suggestions?

Sure do.

> Error Msg1 with command line: C:Program
> FilesGnuPGbingpg.exe--passphrase-fd 0 --verbose --batch --trust-model
> always --pinentry-mode loopback --armor --recipient "XXXXXXXXX"
> --encrypt
>  gpg: XXXXXXXXX: skipped: No public key
> gpg: [stdin]: encryption failed: No public key

What this means is really simple: GnuPG can't find the recipient's 
public key.

GnuPG stores keys on a per-user basis, not systemwide.  So if you 
imported the recipient's public key to your local keyring, but this code 
is running as a different user, GnuPG will look in that different user's 
keyring for the public key -- not yours.

You can test this out by switching over to whatever user account this is 
running as and running "gpg --list-key XXXXXXXX".  I strongly suspect 
you'll get no output, thus showing that when running as this user GnuPG 
has no access to the public key that's on your own user keyring.

While still logged into the different user account this is running as, 
import the public key into GnuPG.  Your problems should vanish.

If this still doesn't work you'll need to dive into Starksoft, as it's 
possible they're switching users and not telling you.

More information about the Gnupg-users mailing list