1

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
[Cancel][OK]

  u 372XXXXX Joe Blow <joe@blow.org>
  u 1F0XXXXX Joe Blow <joe.blow@gmail.com>
  - 7F2XXXXX Jane Doe <jane@archlinux.org>
  - A4DXXXXX John Doe <john@doe.com>

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?

modulitos
  • 2,432
  • 1
  • 18
  • 36
  • 1
    In this case you want to select the recipient public key in your case you have only one `- 7F2XXXXX Jane Doe ` 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 '15 at 12:23

1 Answers1

2

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.

Stefan
  • 26,154
  • 3
  • 46
  • 84