Environment variable GNUPGHOME with Windows + MSYS2

Thomas Schweikle ThSchweikle at bfs.de
Tue Mar 4 15:59:00 CET 2025


Am 04.03.2025 um 10:12 schrieb Werner Koch via Gnupg-users:
> On Thu, 27 Feb 2025 16:32, Thomas Schweikle said:
> 
>> MSYS2 gpg uses "/c/msys/home/%USERNAME%/.gnupg". Now I had the idea to set
>> GNUPGHOME so both could work with the same directory:
> 
> Please do not use an MSYS build (or a Cygwin build).

You cant. You are forced to do. It is the main problem with Windows: 
most tools are installed more than once: gpg.exe comes with
- git
- msys (pacman)
- cygwin (cygwin-installer)
- RustUp
- JuliaUp
- Haskel Compiler Platform (GHCup)
- FreePascal Development Kit
- Arduino IDE
- Visual Studio (for some, but not all)
- Visual Studio Code
- gnupg
- GnuPG-VS-Desktop
- Gpg4Win

All of them compile gpg.exe by them self, most with sources from 
"https://gnupg.org". Sometimes using older builds (2.2), most use stable 
(2.4) and a minority use development versions (2.5).

> This is not supported because GnuPG has full support for Windows and
 > trying to build a mix of a Unix and Window version will eventually
 > run into problems.

This was the main problem: Keyrings can be copied between these 
versions, but all the other files generated might be incompatible and 
are points you've to look out for -- just do not copy them around.

> Further, and more important: We have never done an analysis of such a
> build regarding the random number generator.

This shouldn't be a point here, since in all cases gpg is used to sign 
binaries build before packaging for Windows. Or: gpg is used to verify 
signatures for packaged files loaded and installed from internet servers
(GHCup, RustUp, JuliaUp, msys, ArduinoIDE, etc -- btw: most of them rely 
on msys -- at least for tools)

> Take care not to run into something like the OpenSSL RNG problem
> Debian once had.

As long as you generate your keys only with one of them, this should not 
matter.

> You should be able to build GnuPG for Windows on Windows using WSL2 with
> Ubuntu or (if available Debian Bookworm).  Not tested though.

I've tried and failed to build gpg for Windows on Debian. The same 
problem arose vice versa: building for Linux on Windows. It is supposed 
to work, but it seems not something working "out of the box".

It wasn't even possible to build on Debian for FreeBSD!
But it was ok building for Debian on FreeBSD.
-- 
Thomas


More information about the Gnupg-users mailing list