How does 'epa-encrypt' decide which private key to use? If I have two private keys, and I've only shared one of my public keys with the recipient, and I encrypt with epa-encrypt-region and select the recipient's public key, which one of my private keys will be used to encrypt?

For example, when I execute epa-encrypt-region, I get the following menu to choose which public key to encrypt with:

Select recipients for encryption.
If no one is selected, symmetric encryption will be performed.  
- `M-x epa-mark-key' to mark a key on the line
- `M-x epa-unmark-key' to unmark a key on the line

  u 372XXXXX Joe Blow <[email protected]>
  u 1F0XXXXX Joe Blow <[email protected]>
  - 7F2XXXXX Jane Doe <ja[email protected]>
  - A4DXXXXX John Doe <[email protected]>

and I am Joe Blow with two private keys, and I want to send a message to Jane Doe, who only has my gmail public key. Thus, I need to encrypt with my gmail private key. How do I know if epa-encrypt is using the right private key for encryption?

Or does 'epa-encrypt' or the key-ring auto-magically know if the recipient has my public key?

  • 1
    In this case you want to select the recipient public key in your case you have only one - 7F2XXXXX Jane Doe <[email protected]> epa will encrypt the message using the recipients public key, that way when she receives the email, she'll use the private key that correspond to that particular key to decrypt it.
    – xmonk
    Apr 23, 2015 at 12:23

1 Answer 1


When encrypting, GPG uses the recipient's public key (so only she can decrypt it, with her private key). Your own keys are not used (neither private nor public). You private key is only used either to sign what you send, or to decrypt what ou receive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.