I want to tell epa to encrypt for two of my public keys. (stored in two different places). I have this at the top of the file:

# -*- mode:org; epa-file-encrypt-to: ("arthur@ul___dt.com") -*-

which causes it to select the first one key for that email. If i run epa-file-select-keys I can choose the two keys I want, though only for that session. I would prefer it remember this decision in the file so I don't have to remember to do this each time on each new computer this file is opened on.

  1. How can I specify two keys by key-id on that line?
  2. What is the actual syntax of the strings in the epa-file-encrypt-to variable? Is it defined somewhere? How are specific keys selected from this string

PS: these keys have the same user-id string and I'd prefer not to have to change that.

PPS: there is also a revoked key with the same email that it needs to not choose. I have tried on emacs 24.3.1 and emacs 25-snapshot

2 Answers 2

# -*- mode:org; epa-file-encrypt-to: ("arthur@ul___dt.com" "[email protected]") -*-

When a mail address is associated to several keys switch to the key ids. E.g. a call to epa-file-select-keys reveals key ids. The header line with fake key ids looks like:

# -*- mode:org; epa-file-encrypt-to: ("12345678ABCDEF00" "12345678ABCDEF01") -*-

I have not found a syntax-definition for variable epa-file-encrypt-to. I guess it's supposed to be a list containing identifiers for keys as they can be understood by the gpg program.

  • and it also works if you mix email addressed and the long ids Commented Jul 18, 2015 at 1:44
  • I had tried this using the short id's before asking, and though it didn't work Commented Jul 20, 2015 at 7:45
  • that comma there confused the hell out of my emacs, and i had to reencrypt the file in the command line to get rid of it. are you sure it's needed? Commented Nov 24, 2020 at 13:26
  • That comma looks wrong. Typically there is no comma in lisp lists AFAICT. Sorry for the inconvenience. I corrected the answer. See the respective edit of the answer.
    – Marco Wahl
    Commented Dec 2, 2020 at 23:27

for me leaving the comma away work. Looks like this:

# -*- mode:org; epa-file-encrypt-to: ("arthur@ul___dt.com" "[email protected]") -*-
  • Thanks for the confirmation.
    – Marco Wahl
    Commented Dec 2, 2020 at 23:28

Your Answer

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

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