21

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.

4 Answers 4

23

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.

4
  • followup: i am trying to verify the authenticity of gpg4win (from their site). i have a trusted gpg install already. when i import their certificate i seem to get a different fingerprint then what's listed on the web-site.. is that possible?
    – Alex
    Aug 21, 2016 at 4:53
  • If the signature is the proper one for that file, it should match. If not, you're either doing something wrong, something isn't acting like it's supposed to, or someone messed with the file. To troubleshoot- try downloading gpg4win again or using the SHA1 checksum to verify instead. Also, since this question is now about GPG itself rather than Cygwin, I recommend asking it separately(you have a very narrow chance of finding an expert in both Cygwin and gpg) Aug 21, 2016 at 7:35
  • Worked fine to compile, just remember to compile and install the GPG libs. The configure of GPG script will tell you which ones to get though, if you miss something. Mar 5, 2018 at 13:17
  • There is no gpg in Cywin 1.7.33.
    – WebViewer
    Dec 18, 2022 at 9:01
14

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 always go the long way of compiling and installing the latest from sources.

2
  • 1
    I just want to note that gnupg2 is an available package on cygwin now. It's not quite the latest (currently 2.1.23 compared to 2.2.1 available directly from GnuPG), but a great improvement over the prior state of affairs.
    – dcsohl
    Oct 6, 2017 at 16:22
  • This version seems to be incompatible with the original gpg in Linux. It crashes with "gpg: packet(13) too large".
    – WebViewer
    Dec 18, 2022 at 9:23
4

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.

2

I did following to use GPG2 with Git on Cygwin (including gpg-agent for caching GPG passwords):

  • Installed the gnupg2 Cygwin package (version 2.2.27-1).
  • Configured git to use gnupg2: git config --global gpg.program $(which gpg2)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .