1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
5 ;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
7 ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
8 ;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
10 ;;; Copyright © 2016 Nils Gillmann <ng0@libertad.pw>
11 ;;; Copyright © 2016 Christopher Baines <mail@cbaines.net>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages gnupg)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages adns)
32 #:use-module (gnu packages curl)
33 #:use-module (gnu packages openldap)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages pth)
36 #:use-module (gnu packages python)
37 #:use-module (gnu packages qt)
38 #:use-module (gnu packages readline)
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages databases)
41 #:use-module (gnu packages gtk)
42 #:use-module (gnu packages glib)
43 #:use-module (gnu packages gnome)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages ncurses)
46 #:use-module (gnu packages tls)
47 #:use-module (guix packages)
48 #:use-module (guix download)
49 #:use-module (guix build-system gnu)
50 #:use-module (guix build-system python))
52 (define-public libgpg-error
59 (uri (string-append "mirror://gnupg/libgpg-error/libgpg-error-"
63 "0h75sf1ngr750c3fjfn4583q7wz40qm63jhg8vjfdrbx936f2s4j"))))
64 (build-system gnu-build-system)
65 (home-page "https://gnupg.org")
66 (synopsis "Library of error values for GnuPG components")
68 "Libgpg-error is a small library that defines common error values
69 for all GnuPG components. Among these are GPG, GPGSM, GPGME,
70 GPG-Agent, libgcrypt, Libksba, DirMngr, Pinentry, SmartCard
71 Daemon and possibly more in the future.")
72 (license license:lgpl2.0+)
73 (properties '((ftp-server . "ftp.gnupg.org")
74 (ftp-directory . "/gcrypt/libgpg-error")))))
76 (define-public libgcrypt
82 (uri (string-append "mirror://gnupg/libgcrypt/libgcrypt-"
86 "0wbh6fq5zi9wg2xcfvfpwh7dv52jihivx1vm4h91c2kx0w8n3b6x"))))
87 (build-system gnu-build-system)
89 `(("libgpg-error-host" ,libgpg-error)))
91 ;; Needed here for the 'gpg-error' program.
92 `(("libgpg-error-native" ,libgpg-error)))
94 ;; The '--with-gpg-error-prefix' argument is needed because otherwise
95 ;; 'configure' uses 'gpg-error-config' to determine the '-L' flag, and
96 ;; the 'gpg-error-config' it runs is the native one---i.e., the wrong one.
98 (list (string-append "--with-gpg-error-prefix="
99 (assoc-ref %build-inputs "libgpg-error-host")))))
100 (outputs '("out" "debug"))
101 (home-page "https://gnupg.org/")
102 (synopsis "Cryptographic function library")
104 "Libgcrypt is a general-purpose cryptographic library. It provides the
105 standard cryptographic building blocks such as symmetric ciphers, hash
106 algorithms, public key algorithms, large integer functions and random number
108 (license license:lgpl2.0+)
109 (properties '((ftp-server . "ftp.gnupg.org")
110 (ftp-directory . "/gcrypt/libgcrypt")))))
112 (define-public libgcrypt-1.5
113 (package (inherit libgcrypt)
118 (uri (string-append "mirror://gnupg/libgcrypt/libgcrypt-"
122 "0ydy7bgra5jbq9mxl5x031nif3m6y3balc6ndw2ngj11wnsjc61h"))))))
124 (define-public libassuan
131 (uri (string-append "mirror://gnupg/libassuan/libassuan-"
135 "0w9bmasln4z8mn16s1is55a06w3nv8jbyal496z5jvr5vcxkm112"))))
136 (build-system gnu-build-system)
138 `(("libgpg-error" ,libgpg-error) ("pth" ,pth)))
139 (home-page "https://gnupg.org")
141 "IPC library used by GnuPG and related software")
143 "Libassuan is a small library implementing the so-called Assuan
144 protocol. This protocol is used for IPC between most newer
145 GnuPG components. Both, server and client side functions are
147 (license license:lgpl2.0+)
148 (properties '((ftp-server . "ftp.gnupg.org")
149 (ftp-directory . "/gcrypt/libassuan")))))
151 (define-public libksba
159 "mirror://gnupg/libksba/libksba-"
163 "0h53q4sns1jz1pkmhcz5wp9qrfn9f5g9i3vjv6dafwzzlvblyi21"))))
164 (build-system gnu-build-system)
166 `(("libgpg-error" ,libgpg-error)))
168 `(("libgpg-error" ,libgpg-error)))
171 (list ,@(if (%current-target-system)
172 '("CC_FOR_BUILD=gcc")
174 (string-append "--with-gpg-error-prefix="
175 (assoc-ref %build-inputs "libgpg-error")))))
176 (home-page "https://www.gnupg.org")
177 (synopsis "CMS and X.509 access library")
179 "KSBA (pronounced Kasbah) is a library to make X.509 certificates
180 as well as the CMS easily accessible by other applications. Both
181 specifications are building blocks of S/MIME and TLS.")
182 (license license:gpl3+)
183 (properties '((ftp-server . "ftp.gnupg.org")
184 (ftp-directory . "/gcrypt/libksba")))))
194 "mirror://gnupg/npth/npth-"
198 "12n0nvhw4fzwp0k7gjv3rc6pdml0qiinbbfiz4ilg6pl5kdxvnvd"))))
199 (build-system gnu-build-system)
200 (home-page "https://www.gnupg.org")
201 (synopsis "Non-preemptive thread library")
203 "Npth is a library to provide the GNU Pth API and thus a non-preemptive
204 threads implementation.
206 In contrast to GNU Pth is is based on the system's standard threads
207 implementation. This allows the use of libraries which are not
208 compatible to GNU Pth.")
209 (license (list license:lgpl3+ license:gpl2+)))) ; dual license
217 (uri (string-append "mirror://gnupg/gnupg/gnupg-" version
221 "1pgz02gd84ab94w4xdg67p9z8kvkyr9d523bvcxxd2hviwh1m362"))))
222 (build-system gnu-build-system)
224 `(("pkg-config" ,pkg-config)))
230 ("libassuan" ,libassuan)
231 ("libgcrypt" ,libgcrypt)
232 ("libgpg-error" ,libgpg-error)
235 ("openldap" ,openldap)
236 ("readline" ,readline)
240 `(#:configure-flags '("--enable-gpg2-is-gpg")
242 (modify-phases %standard-phases
243 (add-before 'configure 'patch-config-files
245 (substitute* "tests/openpgp/defs.inc"
246 (("/bin/pwd") (which "pwd")))
248 (add-after 'build 'patch-scheme-tests
250 (substitute* (find-files "tests" ".\\.scm$")
251 (("/usr/bin/env gpgscm")
252 (string-append (getcwd) "/tests/gpgscm/gpgscm")))))
253 (add-before 'check 'set-home
254 ;; Some tests require write access to $HOME, otherwise leading to
255 ;; 'failed to create directory /homeless-shelter/.asy' error.
257 (setenv "HOME" "/tmp")
259 (home-page "https://gnupg.org/")
260 (synopsis "GNU Privacy Guard")
262 "The GNU Privacy Guard is a complete implementation of the OpenPGP
263 standard. It is used to encrypt and sign data and communication. It
264 features powerful key management and the ability to access public key
265 servers. It includes several libraries: libassuan (IPC between GnuPG
266 components), libgpg-error (centralized GnuPG error values), and
267 libskba (working with X.509 certificates and CMS data).")
268 (license license:gpl3+)
269 (properties '((ftp-server . "ftp.gnupg.org")
270 (ftp-directory . "/gcrypt/gnupg")))))
272 (define-public gnupg-2.0
273 (package (inherit gnupg)
277 (uri (string-append "mirror://gnupg/gnupg/gnupg-" version
281 "0wax4cy14hh0h7kg9hj0hjn9424b71z8lrrc5kbsasrn9xd7hag3"))))
287 ("libassuan" ,libassuan)
288 ("libgcrypt" ,libgcrypt)
289 ("libgpg-error" ,libgpg-error)
292 ("openldap" ,openldap)
294 ("readline" ,readline)))
297 (modify-phases %standard-phases
298 (add-before 'configure 'patch-config-files
300 (substitute* "tests/openpgp/Makefile.in"
301 (("/bin/sh") (which "bash")))
303 (add-after 'install 'rename-v2-commands
304 (lambda* (#:key outputs #:allow-other-keys)
305 ;; Upstream suggests removing the trailing '2' from command names:
306 ;; <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22883#58>.
307 (let ((out (assoc-ref outputs "out")))
308 (with-directory-excursion (string-append out "/bin")
309 (rename-file "gpgv2" "gpgv")
310 (rename-file "gpg2" "gpg")
312 ;; Keep the old name around to ease transition.
313 (symlink "gpgv" "gpgv2")
314 (symlink "gpg" "gpg2")
317 (define-public gnupg-1
318 (package (inherit gnupg)
322 (uri (string-append "mirror://gnupg/gnupg/gnupg-" version
326 "0xi2mshq8f6zbarb5f61c9w2qzwrdbjm4q8fqsrwlzc51h8a6ivb"))))
332 ("readline" ,readline)
333 ("libgpg-error" ,libgpg-error)))
336 (modify-phases %standard-phases
337 (add-after 'unpack 'patch-check-sh
339 (substitute* "checks/Makefile.in"
340 (("/bin/sh") (which "bash"))))))))))
349 (uri (string-append "mirror://gnupg/gpgme/gpgme-" version
353 "17892sclz3yg45wbyqqrzzpq3l0icbnfl28f101b3062g8cy97dh"))))
354 (build-system gnu-build-system)
356 ;; Needs to be propagated because gpgme.h includes gpg-error.h.
357 `(("libgpg-error" ,libgpg-error)))
359 `(("gnupg" ,gnupg-2.0)
360 ("libassuan" ,libassuan)))
361 (arguments '(#:make-flags '("GPG=gpg2")))
362 (home-page "https://www.gnupg.org/related_software/gpgme/")
363 (synopsis "Library providing simplified access to GnuPG functionality")
365 "GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG
366 easier for applications. It provides a High-Level Crypto API for encryption,
367 decryption, signing, signature verification and key management. Currently
368 it uses GnuPG as its backend but the API isn't restricted to this engine.
370 Because the direct use of GnuPG from an application can be a complicated
371 programming task, it is suggested that all software should try to use GPGME
372 instead. This way bug fixes or improvements can be done at a central place
373 and every application benefits from this.")
374 (license license:lgpl2.1+)))
376 (define-public python-pygpgme
378 (name "python-pygpgme")
383 (uri (pypi-uri "pygpgme" version))
386 "1q82p3gs6lwq8j8dxk4pvrwk3jpww1zqcjrzznl9clh10z28gn2z"))
387 ;; Unfortunately, we have to disable some tests due to some gpg-agent
389 ;; https://bugs.launchpad.net/pygpgme/+bug/999949
390 (patches (search-patches "pygpgme-disable-problematic-tests.patch"))))
393 (modify-phases %standard-phases
394 (add-before 'build 'make-build
396 (zero? (system* "make" "build"))))
399 (zero? (system* "make" "check")))))))
400 (build-system python-build-system)
402 `(("gnupg" ,gnupg-2.0)
404 (home-page "https://launchpad.net/pygpgme")
405 (synopsis "Python module for working with OpenPGP messages")
407 "PyGPGME is a Python module that lets you sign, verify, encrypt and
408 decrypt messages using the OpenPGP format by making use of GPGME.")
409 (license license:lgpl2.1+)))
411 (define-public python2-pygpgme
412 (let ((base (package-with-python2 python-pygpgme)))
416 `(("python2-setuptools" ,python2-setuptools)
417 ,@(package-native-inputs base))))))
419 (define-public python-gnupg
421 (name "python-gnupg")
426 (uri (pypi-uri "python-gnupg" version))
429 "0nkbs9c8f30lra7ca39kg91x8cyxn0jb61vih4qky839gpbwwwiq"))))
430 (build-system python-build-system)
433 (modify-phases %standard-phases
436 (substitute* "test_gnupg.py"
437 ;; Exported keys don't have a version line!
438 (("del k1\\[1\\]") "#")
439 ;; Unsure why this test fails.
440 (("'test_search_keys'") "True")
441 (("def test_search_keys") "def disabled__search_keys"))
442 (setenv "USERNAME" "guixbuilder")
443 ;; The doctests are extremely slow and sometimes time out,
444 ;; so we disable them.
445 (zero? (system* "python"
446 "test_gnupg.py" "--no-doctests")))))))
448 `(("gnupg" ,gnupg-1)))
449 (home-page "https://packages.python.org/python-gnupg/index.html")
450 (synopsis "Wrapper for the GNU Privacy Guard")
452 "This module allows easy access to GnuPG’s key management, encryption
453 and signature functionality from Python programs.")
454 (license license:bsd-3)))
456 (define-public python2-gnupg
457 (package-with-python2 python-gnupg))
466 "https://github.com/jaymzh/pius/releases/download/v"
467 version "/pius-" version ".tar.bz2"))
470 "0k94mlr7l12mplph7pdgjbampqha47d8mfjq69n4xm80qwbn1rq1"))))
471 (build-system python-build-system)
472 (inputs `(("perl" ,perl) ;for 'pius-party-worksheet'
473 ("gpg" ,gnupg-2.0))) ;2.1 fails to talk to gpg-agent 2.0
476 #:python ,python-2 ;uses the Python 2 'print' syntax
478 (modify-phases %standard-phases
480 'build 'set-gpg-file-name
481 (lambda* (#:key inputs outputs #:allow-other-keys)
482 (let* ((gpg (string-append (assoc-ref inputs "gpg")
484 (substitute* "libpius/constants.py"
485 (("/usr/bin/gpg2") gpg))))))))
486 (synopsis "Programs to simplify GnuPG key signing")
488 "Pius (PGP Individual UID Signer) helps attendees of PGP keysigning
489 parties. It is the main utility and makes it possible to quickly and easily
490 sign each UID on a set of PGP keys. It is designed to take the pain out of
491 the sign-all-the-keys part of PGP Keysigning Party while adding security
494 pius-keyring-mgr and pius-party-worksheet help organisers of
495 PGP keysigning parties.")
496 (license license:gpl2)
497 (home-page "https://www.phildev.net/pius/index.shtml")))
499 (define-public signing-party
501 (name "signing-party")
505 (uri (string-append "mirror://debian/pool/main/s/signing-party/"
506 "signing-party_" version ".orig.tar.gz"))
508 "188gp0prbh8qs29lq3pbf0qibfd6jq4fk7i0pfrybl8aahvm84rx"))))
509 (build-system gnu-build-system)
510 (inputs `(("perl" ,perl)))
514 (modify-phases %standard-phases
515 (add-after 'unpack 'remove-spurious-links
516 (lambda _ (delete-file "keyanalyze/pgpring/depcomp")))
518 (lambda* (#:key outputs #:allow-other-keys)
519 (let ((out (assoc-ref outputs "out")))
520 (substitute* "keyanalyze/Makefile"
521 (("LDLIBS") (string-append "CC=" (which "gcc") "\nLDLIBS")))
522 (substitute* "keyanalyze/Makefile"
523 (("./configure") (string-append "./configure --prefix=" out)))
524 (substitute* "keyanalyze/pgpring/configure"
525 (("/bin/sh") (which "bash")))
526 (substitute* "gpgwrap/Makefile"
528 (string-append "} clean\ninstall:\n\tinstall -D bin/gpgwrap "
529 out "/bin/gpgwrap\n")))
530 (substitute* '("gpgsigs/Makefile" "keyanalyze/Makefile"
531 "keylookup/Makefile" "sig2dot/Makefile"
532 "springgraph/Makefile")
535 (lambda* (#:key outputs #:allow-other-keys #:rest args)
536 (let ((out (assoc-ref outputs "out"))
537 (install (assoc-ref %standard-phases 'install)))
541 (copy-file (string-append dir "/" file)
542 (string-append out "/bin/" file)))
543 '("caff" "caff" "caff" "gpgdir" "gpg-key2ps"
544 "gpglist" "gpg-mailkeys" "gpgparticipants")
545 '("caff" "pgp-clean" "pgp-fixkey" "gpgdir" "gpg-key2ps"
546 "gpglist" "gpg-mailkeys" "gpgparticipants"))
549 (copy-file (string-append dir "/" file)
550 (string-append out "/share/man/man1/" file)))
551 '("caff" "caff" "caff" "gpgdir"
552 "gpg-key2ps" "gpglist" "gpg-mailkeys"
553 "gpgparticipants" "gpgsigs" "gpgwrap/doc"
554 "keyanalyze" "keyanalyze/pgpring" "keyanalyze")
555 '("caff.1" "pgp-clean.1" "pgp-fixkey.1" "gpgdir.1"
556 "gpg-key2ps.1" "gpglist.1" "gpg-mailkeys.1"
557 "gpgparticipants.1" "gpgsigs.1" "gpgwrap.1"
558 "process_keys.1" "pgpring.1" "keyanalyze.1"))))))))
559 (synopsis "Collection of scripts for simplifying gnupg key signing")
561 "Signing-party is a collection for all kinds of PGP/GnuPG related things,
562 including tools for signing keys, keyring analysis, and party preparation.
564 @item caff: CA - Fire and Forget signs and mails a key
565 @item pgp-clean: removes all non-self signatures from key
566 @item pgp-fixkey: removes broken packets from keys
567 @item gpg-mailkeys: simply mail out a signed key to its owner
568 @item gpg-key2ps: generate PostScript file with fingerprint paper strips
569 @item gpgdir: recursive directory encryption tool
570 @item gpglist: show who signed which of your UIDs
571 @item gpgsigs: annotates list of GnuPG keys with already done signatures
572 @item gpgparticipants: create list of party participants for the organiser
573 @item gpgwrap: a passphrase wrapper
574 @item keyanalyze: minimum signing distance (MSD) analysis on keyrings
575 @item keylookup: ncurses wrapper around gpg --search
576 @item sig2dot: converts a list of GnuPG signatures to a .dot file
577 @item springgraph: creates a graph from a .dot file
579 ;; gpl2+ for almost all programs, except for keyanalyze: gpl2
580 ;; and caff and gpgsigs: bsd-3, see
581 ;; http://packages.debian.org/changelogs/pool/main/s/signing-party/current/copyright
582 (license license:gpl2)
583 (home-page "https://pgp-tools.alioth.debian.org/")))
585 (define-public pinentry-tty
587 (name "pinentry-tty")
591 (uri (string-append "mirror://gnupg/pinentry/pinentry-"
595 "1cp7wjqr6nx31mdclr61s2h84ijqjl0ph99kgj4vyawpjj1j1633"))))
596 (build-system gnu-build-system)
598 `(#:configure-flags '("--enable-pinentry-tty")))
600 `(("ncurses" ,ncurses)
601 ("libassuan" ,libassuan)
602 ("libsecret" ,libsecret "out")))
604 `(("pkg-config" ,pkg-config)))
605 (home-page "https://gnupg.org/aegypten2/")
606 (synopsis "GnuPG's interface to passphrase input")
608 "Pinentry provides a console that allows users to enter a passphrase when
609 @code{gpg} is run and needs it.")
610 (license license:gpl2+)))
612 (define-public pinentry-gtk2
614 (inherit pinentry-tty)
615 (name "pinentry-gtk2")
619 ,@(package-inputs pinentry-tty)))
621 "Pinentry provides a console and a GTK+ GUI that allows users to enter a
622 passphrase when @code{gpg} is run and needs it.")))
624 (define-public pinentry-gnome3
626 (inherit pinentry-tty)
627 (name "pinentry-gnome3")
632 ,@(package-inputs pinentry-tty)))
634 `(#:configure-flags '("--enable-pinentry-gnome3")))
636 "Pinentry provides a console and a GUI designed for use with GNOME@tie{}3
637 that allows users to enter a passphrase when required by @code{gpg} or other
640 (define-public pinentry-qt
642 (inherit pinentry-tty)
646 ,@(package-inputs pinentry-tty)))
648 `(#:configure-flags '("CXXFLAGS=-std=gnu++11")))
650 "Pinentry provides a console and a Qt GUI that allows users to enter a
651 passphrase when @code{gpg} is run and needs it.")))
653 (define-public pinentry
654 (package (inherit pinentry-gtk2)
657 (define-public paperkey
663 (uri (string-append "http://www.jabberwocky.com/"
664 "software/paperkey/paperkey-"
668 "1yybj8bj68v4lxwpn596b6ismh2fyixw5vlqqg26byrn4d9dfmsv"))))
669 (build-system gnu-build-system)
672 (modify-phases %standard-phases
673 (add-before 'check 'patch-check-scripts
675 (substitute* '("checks/roundtrip.sh"
676 "checks/roundtrip-raw.sh")
677 (("/bin/echo") "echo"))
679 (home-page "http://www.jabberwocky.com/software/paperkey/")
680 (synopsis "Backup OpenPGP keys to paper")
682 "Paperkey extracts the secret bytes from an OpenPGP (GnuPG, PGP, etc) key
683 for printing with paper and ink, which have amazingly long retention
684 qualities. To reconstruct a secret key, you re-enter those
685 bytes (whether by hand, OCR, QR code, or the like) and paperkey can use
686 them to transform your existing public key into a secret key.")
687 (license license:gpl2+)))