I work for the VT dept of Health.
We are just setting up gpg to encrypt data going to FDA.
My command string to initiate an encrypted file is this:
gpg --output filename.xml.pgp --encrypt --recipient lexnet filename.xml
This works fine if I initiate this command using the user account that installed Gpg4Win
However, I need to initiate the gpg command by a different software product.
The GpG response is “cant find public key”.
Is there a way for me to add an option in the command string that will allow gpg to find the public key no matter what user account initiates?
Here’s one way to do it:
C:>gpg --recv-keys [Recipient’s Key ID] & gpg --trust-model always -r [Recipient’s Key ID] -o filename.xml.pgp -e filename.xml
The first command gets the key for the current account. The ampersand allows successive commands on one line. The second command encrypts the file.
I love reading the questions on this forum. I’m learning right along with you how to do things I never would’ve thought of!
Thank you very much Sean.
I thought I knew how to obtain the public key IDs.
But when I put any of the values that gpg returns from that command into the encryption string, it returns “not a key ID, skipping”
How do I obtain the public key IDs?
You’ve got it right. The “–list-keys” command should return all of the public keys on the local keyring. They should be listed with their key size followed by a forward slash and then the eight character key ID. To be sure, the eight characters after the slash are the only ones you need. You can also use any of the user IDs belonging to the key, usually the intended recipient’s name or email address, as the identifier.
If GPG is showing that the intended key is on the ring but won’t let you use it, I’m afraid I am at a loss. Something else must be going wrong.
Best of luck,