how to install gpg on cygwin? currently it's missing

I have cygwin installed on Win 7 but can't see gpg in /usr/bin/.. is this normal? How can i get it? I am trying to verify a linux ISO and need this to check the signature file.


Solution 1:

Luckily, gpg is included in Cygwin's software repository. Just run the cygwin installer(setup-x86_64.exe or setup-x86.exe) again, and when the package select menu comes up, search for "gnupg". Check the "gnupg" option that appears under utils, finish the update, and you're done. It should install gpg and any dependencies.

If, for some reason, this does NOT work, you can compile it yourself. I can give detailed instructions upon request, but for now- this page explains how to compile (most) linux programs under Cygwin, and this page provides instructions on downloading the source code.

Solution 2:

UPDATE (2018-10-20)

The information below is now obsolete, since as of today the current Cygwin gnupg2 package version is at 2.2.10-1 and the one coming with the most recent gpg4win (3.1.3) is at 2.2.10.


Unfortunately the Cygwin provided packages for GnuPG is way outdated and still using the deprecated gnupg1.4. This is indeed sad as everything else seem to work great. So you might think to download the Windows native Gpg4win, but that is a mistake. Also that package is outdated (as of 2017-05-10) with the latest release of 2.3.3 (2016-08-18), only using gnupg 2.0.30. So what to do?

Instead, go to the GnuPG download page and select the download labelled as "Simple installer for the current GnuPG". That will download the latest *.exe from their FTP site. Install it. GnuPG Bugs are tracked here.

However, the old original Cygwin gpg binary is located in /usr/bin/gpg.exe and that path is taking precedence over the new Windows one. So to see the new version you have to give the full path.

$ gpg --version
gpg (GnuPG) 1.4.21
...
Home: ~/.gnupg
...

$ /cygdrive/c/Program\ Files\ \(x86\)/GnuPG/bin/gpg.exe --version

gpg (GnuPG) 2.1.20
libgcrypt 1.7.6
...

Home: C:/Users/xxxx/AppData/Roaming/gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

The easy solution to reach the new binary is by soft-linking it.

$ ln -s /cygdrive/c/Program\ Files\ \(x86\)/GnuPG/bin/gpg.exe /usr/bin/gpg2
$ ln -s /cygdrive/c/Program\ Files\ \(x86\)/GnuPG/bin/gpg-agent.exe /usr/bin/gpg-agent
# And others depending on your need

$ gpg2 --version
gpg (GnuPG) 2.1.20
libgcrypt 1.7.6
...

All good! Finally, notice that your key-chains will be located in the Cygwin $HOME for the old gpg, whereas in the /cygdrive/c/Users/xxxx/AppData/Roaming/gnupg/ for the new one.

Of course, you can alway go the long way of compiling and installing the latest from sources.

Solution 3:

The real answer for me, in 2020, is that it's called

gpg2

in cygwin now, not gpg. How was I supposed to know that? The cygwin package is gnupg2, which is not found if one searches for gpg in the cygwin installer. As this thread is the top hit searching for "gpg cygwin" maybe I'll save someone some time.