Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Choose which secret key to use when doing a gpg --encrypt --sign

Tags:

gnupg

I have multiple secret keys in my GPG keyring.

I'd like to do a gpg -e -s -a to encrypt, sign, and ascii armor the output. However, I also need to specify which secret key to use for the signature, by key id.

like image 771
Dustin Kirkland Avatar asked Mar 08 '12 20:03

Dustin Kirkland


People also ask

How do I sign and encrypt a file using GPG?

You can encrypt messages using the “–encrypt” flag for GPG. The basic syntax would be: gpg --encrypt --sign --armor -r [email protected] name_of_file.

What is secret key in GPG?

The GPG key pair comprises two types of keys: Private and Public keys. The private GPG keys are encrypted and stored in the secret keyring, and public keys are maintained with certificates attesting to their trustworthiness in the public keyring.


1 Answers

I needed the --local-user option.

gpg -e -s -a --local-user 0xDEADBEEF -r 0x01234567 
like image 156
Dustin Kirkland Avatar answered Sep 29 '22 14:09

Dustin Kirkland