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

18

3

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.

Alex

Posted 2016-08-21T01:06:15.510

Reputation: 499

Answers

20

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.

Anton Liakhovitch

Posted 2016-08-21T01:06:15.510

Reputation: 571

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 – 2016-08-21T04:53:23.413

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) – Anton Liakhovitch – 2016-08-21T07:35:24.497

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. – Prof. Falken contract breached – 2018-03-05T13:17:12.423

11

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.

not2qubit

Posted 2016-08-21T01:06:15.510

Reputation: 1 234

1I 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 – 2017-10-06T16:22:02.690