Why two config directories with gpg4win?

Recently I upgraded to the latest gpg4win. My keys didn’t survive the upgrade, but I was able to restore them using an import in Kleopatra. While debugging this, I observed that there are two key storage directories apparently used in gpg4win, one in the appdata\roaming folder, GnuPG, and one in the home directory, .gnupg. I believe that the former is for Kleopatra, and the latter would be for command-line gpg. I was unable to find anything in the docs clarifying this, can someone please explain how this works? Even though I first imported the keys using command line gpg, emacs still couldn’t find them until I later imported them using Kleopatra.

usually there is only one configuration directory for a user and on Windows, as default: GnuPG uses (as suggested by Microsoft and usual) %APPDATA%\gnupg .

Note Agent Options (Using the GNU Privacy Guard)

From which Gpg4win version did you upgrade?

As Kleopatra uses GnuPG as backend, it uses the same directory than gpg.

However it is possible to give an option or an environment variable. Maybe EMACS uses a different home directory this way, which would explain why they do not run the same gpg.

gpg -v --version is one way to show the home directory that this version of gpg would try.

Can you shell out of emacs and try that command within there?
Is the result different than what you would get if you tried this on a regular command line, where you also call kleopatra?

Hi Bernhard,

This info is very helpful. I would suggest that it be added to a FAQ somewhere (I may have missed it if it’s already there).

I will follow your suggestions ASAP and report back here.



I have resolved this issue.
I had no environment vars or registry vars relevant to this issue set.
There were several problems. I had an extra gpg.exe executable which was installed with git for windows. I renamed this one to block its use, this doesn’t seem to interfere with my git usage. Then I had a path error, the path to gpg.exe wasn’t correct. I fixed this.
I removed the erroneous .gnupg directory from my home directory. now, gpg -v --version shows the appdata GnuPG directory as the one in use. Emacs decryption of authinfo.gpg now works correctly.
Thanks for your help.

1 Like

Hi Ian,
happy to hear that you could resolve the problem and it is working fine for you now!

(As for adding something to the FAQ, I think the knowledge is already part of the documentation, but there is a lot documentation, so my suggestion was specific to your situation - I am not sure it is a general question.)

Best Regards,