Veet Vivarto
Veet Vivarto

Reputation: 361

Need to import a single GnuPG public key into the pubring

This is for a Python based GnuPg user friendly front-end program. Have been trying to find the command for importing just one public key, rather than all of them. This imorts all keys in the file gpg --import Some_pub_keys.txt

I tried this: gpg --import 6CA398EA Some_pub_keys.txt

To only import this key 6CA398EA, but it did not work.

Is there a command for importing just a single key?

Upvotes: 4

Views: 6144

Answers (1)

Ben
Ben

Reputation: 4341

What you want is this:

gpg --no-default-keyring --keyring myapp_keyring.gpg --import a_key.asc

The first flag tells GPG not to use your default keyrings, the second tells it to use the file myapp_keyring.gpg as the keyring file and the last is the import command. Note, the alternate keyring file MUST be of the GPG or OpenPGP format, so it will generally use either the .gpg or .pgp extension and not .txt (or anything else).

Upvotes: 7

Related Questions