1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016 Mike Gerwitz <mtg@gnu.org>
5 ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
6 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
7 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2018, 2019 Chris Marusich <cmmarusich@gmail.com>
10 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages security-token)
28 #:use-module (gnu packages)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix gexp)
33 #:use-module (guix git-download)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system glib-or-gtk)
36 #:use-module (guix build-system python)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages curl)
39 #:use-module (gnu packages check)
40 #:use-module (gnu packages docbook)
41 #:use-module (gnu packages documentation)
42 #:use-module (gnu packages dns)
43 #:use-module (gnu packages gettext)
44 #:use-module (gnu packages graphviz)
45 #:use-module (gnu packages gtk)
46 #:use-module (gnu packages libusb)
47 #:use-module (gnu packages linux)
48 #:use-module (gnu packages man)
49 #:use-module (gnu packages networking)
50 #:use-module (gnu packages cyrus-sasl)
51 #:use-module (gnu packages popt)
52 #:use-module (gnu packages readline)
53 #:use-module (gnu packages tls)
54 #:use-module (gnu packages tex)
55 #:use-module (gnu packages perl)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages python)
58 #:use-module (gnu packages python-crypto)
59 #:use-module (gnu packages python-xyz)
60 #:use-module (gnu packages swig)
61 #:use-module (gnu packages web)
62 #:use-module (gnu packages xml))
71 "https://ccid.apdu.fr/files/"
72 name "-" version ".tar.bz2"))
75 "0z7zafdg75fr1adlv2x0zz34s07gljcjg2lsz76s1048w1xhh5xc"))))
76 (build-system gnu-build-system)
78 `(#:configure-flags (list (string-append "--enable-usbdropdir=" %output
81 (modify-phases %standard-phases
82 (add-after 'unpack 'patch-Makefile
84 (substitute* "src/Makefile.in"
85 (("/bin/echo") (which "echo")))
88 `(("pcsc-lite" ,pcsc-lite) ; only required for headers
90 ("pkg-config" ,pkg-config)))
92 `(("libusb" ,libusb)))
93 (home-page "https://ccid.apdu.fr/")
94 (synopsis "PC/SC driver for USB smart card devices")
96 "This package provides a PC/SC IFD handler implementation for devices
97 compliant with the CCID and ICCD protocols. It supports a wide range of
98 readers and is needed to communicate with such devices through the
99 @command{pcscd} resource manager.")
100 (license license:lgpl2.1+)))
102 (define-public eid-mw
110 (url "https://github.com/Fedict/eid-mw")
111 (commit (string-append "v" version))))
113 (base32 "1q82fw63xzrnrgh1wyh457hal6vfdl6swqfq7l6kviywiwlzx7kd"))))
114 (build-system glib-or-gtk-build-system)
116 `(("autoconf" ,autoconf)
117 ("automake" ,automake)
118 ("gettext" ,gnu-gettext)
120 ("pkg-config" ,pkg-config)
126 ("pcsc-lite" ,pcsc-lite)
128 ("libproxy" ,libproxy)
130 ("cyrus-sasl" ,cyrus-sasl)))
133 (modify-phases %standard-phases
134 (add-after 'unpack 'bootstrap
136 ;; configure.ac relies on ‘git --describe’ to get the version.
137 ;; Patch it to just return the real version number directly.
138 (substitute* "scripts/build-aux/genver.sh"
139 (("/bin/sh") (which "sh"))
140 (("^(GITDESC=).*" match) (string-append match ,version "\n")))
141 (invoke "sh" "./bootstrap.sh"))))))
142 (synopsis "Belgian eID Middleware")
143 (description "The Belgian eID Middleware is required to authenticate with
144 online services using the Belgian electronic identity card.")
145 (home-page "https://github.com/Fedict/eid-mw")
146 (license license:lgpl3)))
148 (define-public libyubikey
155 "https://developers.yubico.com/yubico-c/Releases/"
156 name "-" version ".tar.gz"))
159 "009l3k2zyn06dbrlja2d4p2vfnzjhlcqxi88v02mlrnb17mx1v84"))))
160 (build-system gnu-build-system)
161 (synopsis "Development kit for the YubiKey authentication device")
163 "This package contains a C library and command-line tools that make up
164 the low-level development kit for the Yubico YubiKey authentication device.")
165 (home-page "https://developers.yubico.com/yubico-c/")
166 (license license:bsd-2)))
168 (define-public pcsc-lite
175 "https://pcsclite.apdu.fr/files/"
176 name "-" version ".tar.bz2"))
179 "14l7irs1nsh8b036ag4cfy8wryyysch78scz5dw6xxqwqgnpjvfp"))))
180 (build-system gnu-build-system)
182 `(#:configure-flags '("--enable-usbdropdir=/var/lib/pcsc/drivers"
183 "--disable-libsystemd")))
185 `(("perl" ,perl) ; for pod2man
186 ("pkg-config" ,pkg-config)))
188 `(("libudev" ,eudev)))
189 (home-page "https://pcsclite.apdu.fr/")
190 (synopsis "Middleware to access a smart card using PC/SC")
192 "pcsc-lite provides an interface to communicate with smartcards and
193 readers using the SCard API. pcsc-lite is used to connect to the PC/SC daemon
194 from a client application and provide access to the desired reader.")
195 (license (list license:bsd-3 ; pcsc-lite
196 license:isc ; src/strlcat.c src/strlcpy.c
197 license:gpl3+)))) ; src/spy/*
199 (define-public ykclient
206 "https://developers.yubico.com/yubico-c-client/Releases/"
207 name "-" version ".tar.gz"))
210 "05jhx9waj3pl120ddnwap1v3bjrnbfhvf3lxs2xmhpcmwzpwsqgl"))))
211 (build-system gnu-build-system)
213 ;; There's just one test, and it requires network access to access
214 ;; yubico.com, so skip it.
215 (arguments '(#:tests? #f))
217 (native-inputs `(("pkg-config" ,pkg-config)
218 ("help2man" ,help2man)))
219 (inputs `(("curl" ,curl)))
220 (synopsis "C library to validate one-time-password YubiKeys")
222 "YubiKey C Client Library (libykclient) is a C library used to validate a
223 one-time-password (OTP) YubiKey against Yubico’s servers. See the Yubico
224 website for more information about Yubico and the YubiKey.")
225 (home-page "https://developers.yubico.com/yubico-c-client/")
226 (license license:bsd-2)))
228 (define-public opensc
235 "https://github.com/OpenSC/OpenSC/releases/download/"
236 version "/opensc-" version ".tar.gz"))
239 "09jqzl18z5qfrf4vf2nvbpdm3mphpgfkl3ww1clkaxh2z56hwnic"))))
240 (build-system gnu-build-system)
243 (modify-phases %standard-phases
244 ;; By setting an absolute path here, we arrange for OpenSC to
245 ;; successfully dlopen libpcsclite.so.1 by default. The user can
246 ;; still override this if they want to, by specifying a custom OpenSC
247 ;; configuration file at runtime.
248 (add-after 'unpack 'set-default-libpcsclite.so.1-path
249 (lambda* (#:key inputs #:allow-other-keys)
250 (let ((libpcsclite (string-append (assoc-ref inputs "pcsc-lite")
251 "/lib/libpcsclite.so.1")))
252 (substitute* "configure"
253 (("DEFAULT_PCSC_PROVIDER=\"libpcsclite\\.so\\.1\"")
255 "DEFAULT_PCSC_PROVIDER=\"" libpcsclite "\"")))
257 (add-before 'check 'disable-broken-test
259 ;; XXX: This test is fixed in git, remove this phase for >= 0.19.
260 (substitute* "doc/tools/Makefile"
261 (("TESTS = test-manpage.sh") "TESTS = "))
264 `(("readline" ,readline)
266 ("pcsc-lite" ,pcsc-lite)
269 `(("libxslt" ,libxslt)
270 ("docbook-xsl" ,docbook-xsl)
271 ("pkg-config" ,pkg-config)))
272 (home-page "https://github.com/OpenSC/OpenSC/wiki")
273 (synopsis "Tools and libraries related to smart cards")
275 "OpenSC is a set of software tools and libraries to work with smart
276 cards, with the focus on smart cards with cryptographic capabilities. OpenSC
277 facilitate the use of smart cards in security applications such as
278 authentication, encryption and digital signatures. OpenSC implements the PKCS
279 #15 standard and the PKCS #11 API.")
280 (license license:lgpl2.1+)))
282 (define-public yubico-piv-tool
284 (name "yubico-piv-tool")
289 "https://developers.yubico.com/yubico-piv-tool/Releases/"
290 name "-" version ".tar.gz"))
293 "10xgdc51xvszkxmsvqnbjs8ixxz7rfnfahh3wn8glllynmszbhwi"))))
294 (build-system gnu-build-system)
296 `(("gengetopt" ,gengetopt)
298 ("pcsc-lite" ,pcsc-lite)
299 ("openssl" ,openssl)))
301 `(("doxygen" ,doxygen)
302 ("graphviz" ,graphviz)
303 ("help2man" ,help2man)
305 ("texlive-bin" ,texlive-bin)
306 ("pkg-config" ,pkg-config)))
307 (home-page "https://developers.yubico.com/yubico-piv-tool/")
308 (synopsis "Interact with the PIV application on a YubiKey")
310 "The Yubico PIV tool is used for interacting with the Privilege and
311 Identification Card (PIV) application on a YubiKey. With it you may generate
312 keys on the device, import keys and certificates, create certificate requests,
313 and other operations. It includes a library and a command-line tool.")
314 ;; The file ykcs11/pkcs11.h also declares an additional, very short free
315 ;; license for that one file. Please see it for details. The vast
316 ;; majority of files are licensed under bsd-2.
317 (license license:bsd-2)))
319 (define-public yubikey-personalization
321 (name "yubikey-personalization")
326 "https://developers.yubico.com/" name
327 "/Releases/ykpers-" version ".tar.gz"))
330 "0jhvnavjrpwzmmjcw486df5s48j53njqgyz36yz3dskbaz3kwlfr"))))
331 (build-system gnu-build-system)
333 '(#:configure-flags (list (string-append "--with-udevrulesdir="
334 (assoc-ref %outputs "out")
335 "/lib/udev/rules.d"))))
339 ;; The library "libyubikey" is also known as "yubico-c".
340 ("libyubikey" ,libyubikey)))
342 `(("pkg-config" ,pkg-config)
344 (home-page "https://developers.yubico.com/yubikey-personalization/")
345 (synopsis "Library and tools to personalize YubiKeys")
347 "The YubiKey Personalization package contains a C library and command
348 line tools for personalizing YubiKeys. You can use these to set an AES key,
349 retrieve a YubiKey's serial number, and so forth.")
350 (license license:bsd-2)))
352 (define-public python-pyscard
354 (name "python-pyscard")
358 ;; The maintainer publishes releases on various sites, but
359 ;; SourceForge is apparently the only one with a signed release.
361 "mirror://sourceforge/pyscard/pyscard/pyscard%20"
362 version "/pyscard-" version ".tar.gz"))
365 "15fh00z1an6r5j7hrz3jlq0rb3jygwf3x4jcwsa008bv8vpcg7gm"))))
366 (build-system python-build-system)
369 (modify-phases %standard-phases
370 ;; Tell pyscard where to find the PCSC include directory.
371 (add-after 'unpack 'patch-platform-include-dirs
372 (lambda* (#:key inputs #:allow-other-keys)
373 (let ((pcsc-include-dir (string-append
374 (assoc-ref inputs "pcsc-lite")
376 (substitute* "setup.py"
377 (("platform_include_dirs = \\[.*?\\]")
379 "platform_include_dirs = ['" pcsc-include-dir "']")))
381 ;; pyscard wants to dlopen libpcsclite, so tell it where it is.
382 (add-after 'unpack 'patch-dlopen
383 (lambda* (#:key inputs #:allow-other-keys)
384 (substitute* "smartcard/scard/winscarddll.c"
385 (("lib = \"libpcsclite\\.so\\.1\";")
388 (string-append (assoc-ref inputs "pcsc-lite")
389 "/lib/libpcsclite.so.1"))))
392 `(("pcsc-lite" ,pcsc-lite)))
395 (home-page "https://github.com/LudovicRousseau/pyscard")
396 (synopsis "Smart card library for Python")
398 "The pyscard smart card library is a framework for building smart card
399 aware applications in Python. The smart card module is built on top of the
400 PCSC API Python wrapper module.")
401 (license license:lgpl2.1+)))
403 (define-public python2-pyscard
404 (package-with-python2 python-pyscard))
406 (define-public libu2f-host
414 "https://developers.yubico.com"
415 "/libu2f-host/Releases/libu2f-host-" version ".tar.xz"))
418 "1hnh3f4scx07v9jfkr1nnxasmydk1cmivn0nijcp2p75bc1fznip"))))
419 (build-system gnu-build-system)
422 (list "--enable-gtk-doc"
423 (string-append "--with-udevrulesdir="
424 (assoc-ref %outputs "out")
425 "/lib/udev/rules.d"))
427 (modify-phases %standard-phases
428 (add-after 'unpack 'patch-docbook-xml
429 (lambda* (#:key inputs #:allow-other-keys)
430 ;; Avoid a network connection attempt during the build.
431 (substitute* "gtk-doc/u2f-host-docs.xml"
432 (("http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd")
433 (string-append (assoc-ref inputs "docbook-xml")
434 "/xml/dtd/docbook/docbookx.dtd")))
440 `(("help2man" ,help2man)
441 ("gengetopt" ,gengetopt)
442 ("pkg-config" ,pkg-config)
444 ("docbook-xml" ,docbook-xml-4.3)
446 (home-page "https://developers.yubico.com/libu2f-host/")
447 ;; TRANSLATORS: The U2F protocol has a "server side" and a "host side".
448 (synopsis "U2F host-side C library and tool")
450 "Libu2f-host provides a C library and command-line tool that implements
451 the host-side of the Universal 2nd Factor (U2F) protocol. There are APIs to
452 talk to a U2F device and perform the U2F Register and U2F Authenticate
454 ;; Most files are LGPLv2.1+, but some files are GPLv3+.
455 (license (list license:lgpl2.1+ license:gpl3+))))
457 (define-public python-fido2
459 (name "python-fido2")
465 "https://github.com/Yubico/python-fido2/releases/download/"
466 version "/fido2-" version ".tar.gz"))
469 "1pl8d2pr6jzqj4y9qiaddhjgnl92kikjxy0bgzm2jshkzzic8mp3"))
471 ;; Remove bundled dependency.
472 #~(delete-file "fido2/public_suffix_list.dat"))))
473 (build-system python-build-system)
476 (modify-phases %standard-phases
477 (add-after 'unpack 'install-public-suffix-list
478 (lambda* (#:key inputs #:allow-other-keys)
480 (string-append (assoc-ref inputs "public-suffix-list")
481 "/share/public-suffix-list-"
482 ,(package-version public-suffix-list)
483 "/public_suffix_list.dat")
484 "fido2/public_suffix_list.dat")
487 `(("python-cryptography" ,python-cryptography)
488 ("python-six" ,python-six)))
490 `(("python-mock" ,python-mock)
491 ("python-pyfakefs" ,python-pyfakefs)
492 ("public-suffix-list" ,public-suffix-list)))
493 (home-page "https://github.com/Yubico/python-fido2")
494 (synopsis "Python library for communicating with FIDO devices over USB")
496 "This Python library provides functionality for communicating with a Fast
497 IDentity Online (FIDO) device over Universal Serial Bus (USB) as well as
498 verifying attestation and assertion signatures. It aims to support the FIDO
499 Universal 2nd Factor (U2F) and FIDO 2.0 protocols for communicating with a USB
500 authenticator via the Client-to-Authenticator Protocol (CTAP 1 and 2). In
501 addition to this low-level device access, classes defined in the
502 @code{fido2.client} and @code{fido2.server} modules implement higher level
503 operations which are useful when interfacing with an Authenticator, or when
504 implementing a Relying Party.")
505 ;; python-fido2 contains some derivative files originally from pyu2f
506 ;; (https://github.com/google/pyu2f). These files are licensed under the
507 ;; Apache License, version 2.0. The maintainers have customized these
508 ;; files for internal use, so they are not really a bundled dependency.
509 (license (list license:bsd-2 license:asl2.0))))
511 (define-public python2-fido2
512 (package-with-python2 python-fido2))
514 (define-public python-yubikey-manager
516 (name "python-yubikey-manager")
521 "https://developers.yubico.com/yubikey-manager/Releases"
522 "/yubikey-manager-" version ".tar.gz"))
525 "11rsmcaj60k3y5m5gdhr2nbbz0w5dm3m04klyxz0fh5hnpcmr7fm"))))
526 (build-system python-build-system)
528 `(("python-six" ,python-six)
529 ("python-pyscard" ,python-pyscard)
530 ("python-pyusb" ,python-pyusb)
531 ("python-click" ,python-click)
532 ("python-cryptography" ,python-cryptography)
533 ("python-pyopenssl" ,python-pyopenssl)
534 ("python-fido2" ,python-fido2)))
536 `(("yubikey-personalization" ,yubikey-personalization)
537 ("pcsc-lite" ,pcsc-lite)
541 ("python-mock" ,python-mock)))
542 (home-page "https://developers.yubico.com/yubikey-manager/")
543 (synopsis "Command line tool and library for configuring a YubiKey")
545 "Python library and command line tool for configuring a YubiKey. Note
546 that after installing this package, you might still need to add appropriate
547 udev rules to your system configuration to be able to configure the YubiKey as
548 an unprivileged user.")
549 (license license:bsd-2)))
551 (define-public python2-yubikey-manager
552 (package-with-python2 python-yubikey-manager))