Possible [minor] Bug with GPG v 2.2.1

I just installed GPG4Win v 3. Apparently, this is the first time I’ve upgraded above GnuPG v 2.0. I noticed this strange behavior while checking the functionality of my setup with the new versions:

I store my keys on a separate drive and had been using the “–no-default-keyring”, “–keyring” and “–secret-keyring” options in my “gpg.conf” file. Of course, the “–secret-keyring” option no longer works above GnuPG 2.0. So, I tried using the “–homedir” option on the command line. This worked fine for my public keyring, but the secret keyring kept coming up empty, even after a successful migration of my private keys to the “private-keys-v1.d” folder. After several attempts to make it work, I found that the only solution was to remove the “gnupg” folder entirely from my “AppData” folder. A new, empty “gnupg” folder was then created the next time I invoked GnuPG from the command line, but the “–homedir” option now read my private keys from the other drive. This is using Windows 10 64 bit Home edition with all updates except “Creators”.

I read and understand the reasoning behind moving away from using the “secring.gpg” file, and I’m fine with that. But, I would like to know if there is any way a new option can be introduced which duplicates the function of the “–secret-keyring” option, except with the “private-keys-v1.d” folder. (Or is there some other existing solution of which I am not aware?) It’s a bit bothersome to have to type the “–homedir” option every time I want to invoke GnuPG, not to mention the fact that I cannot use Kleopatra or GPA without first copying my private keys back to the “AppData” folder since the option does not work in the config file. Thank you.

Regards,
Sean C.

Hi Sean,

You should be able to set the homedir in a gnupg options (gpg.conf) file in your AppData GnuPG directory (see https://www.gnupg.org/documentation/manpage.html for reference). Alternatively you can set the environment variable “GNUPGHOME” to your desired homedir.

Best wishes,
Jochen

Jochen,

Adding the “homedir” option to the “gpg.conf” file in the default directory worked for the public keys, but not the private ones.

Adding the environment variable “GNUPGHOME” with the desired homedir did not work at all. I also tried a “HomeDir” variable with no success.

As of now, the only solution that works is typing the “–homedir” option on the command line every time I want to invoke gpg.

Regards,
Sean C.

Adding the environment variable “GNUPGHOME” with the desired homedir did not work at all.

This is surprising and I can’t reproduce a problem with that. For me it works. If I do “set GNUPGHOME=c:\testhome” it works as expected that the default homedir is ignored and everything is done in that folder. I can even start Kleopatra in that shell and it works.

If you set the Environment variable through the GUI you might need to logout / login again to have it take full effect.

I just found out through https://wald.intevation.org/forum/message.php?msg_id=5381&group_id=11 and testing that the registry key HKCU/Software/GNU/GnuPG HomeDir no longer works. This should also be a way to change the homedir. i’ll fix that for Gpg4win-3.0.1

Thank you!