1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Eric Dvorsak <eric@dvorsak.fr>
3 ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2015, 2016, 2017, 2019 Leo Famulari <leo@famulari.name>
5 ;;; Copyright © 2016, 2017, 2020 Marius Bakke <mbakke@fastmail.com>
6 ;;; Copyright © 2017 Ben Sturmfels <ben@sturm.com.au>
7 ;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
8 ;;; Copyright © 2015 Cyril Roelandt <tipecaml@gmail.com>
9 ;;; Copyright © 2014, 2017 Eric Bavier <bavier@member.fsf.org>
10 ;;; Copyright © 2015, 2016 David Thompson <davet@gnu.org>
11 ;;; Copyright © 2016, 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
12 ;;; Copyright © 2016, 2017 ng0 <ng0@n0.is>
13 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
14 ;;; Copyright © 2015, 2016, 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
15 ;;; Copyright © 2016 Danny Milosavljevic <dannym+a@scratchpost.org>
16 ;;; Copyright © 2016, 2017 Arun Isaac <arunisaac@systemreboot.net>
17 ;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au>
18 ;;; Copyright © 2018 Tomáš Čech <sleep_walker@gnu.org>
19 ;;; Copyright © 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr>
20 ;;; Copyright © 2018 Vagrant Cascadian <vagrant@debian.org>
21 ;;; Copyright © 2018 Nam Nguyen <namn@berkeley.edu>
22 ;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
23 ;;; Copyright © 2019 Clément Lassieur <clement@lassieur.org>
25 ;;; This file is part of GNU Guix.
27 ;;; GNU Guix is free software; you can redistribute it and/or modify it
28 ;;; under the terms of the GNU General Public License as published by
29 ;;; the Free Software Foundation; either version 3 of the License, or (at
30 ;;; your option) any later version.
32 ;;; GNU Guix is distributed in the hope that it will be useful, but
33 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
34 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 ;;; GNU General Public License for more details.
37 ;;; You should have received a copy of the GNU General Public License
38 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
40 (define-module (gnu packages python-crypto)
41 #:use-module (guix packages)
42 #:use-module (guix download)
43 #:use-module (guix git-download)
44 #:use-module (guix build-system python)
45 #:use-module (gnu packages)
46 #:use-module (gnu packages check)
47 #:use-module (gnu packages crypto)
48 #:use-module (gnu packages libffi)
49 #:use-module (gnu packages multiprecision)
50 #:use-module (gnu packages protobuf)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages python-check)
53 #:use-module (gnu packages python-web)
54 #:use-module (gnu packages python-xyz)
55 #:use-module (gnu packages time)
56 #:use-module (gnu packages tls)
57 #:use-module ((guix licenses) #:prefix license:)
58 #:use-module (srfi srfi-1))
60 (define-public python-base58
62 (name "python-base58")
67 (uri (pypi-uri "base58" version))
70 "0q1yr0n5jaf17xq98m7dma6z4rh8p19ch55l1s09gi3rk5ckqycs"))))
71 (build-system python-build-system)
73 `(("python-pyhamcrest" ,python-pyhamcrest)))
74 (home-page "https://github.com/keis/base58")
75 (synopsis "Base58 and Base58Check implementation")
76 (description "Base58 and Base58Check implementation compatible
77 with what is used by the Bitcoin network.")
78 (license license:expat)))
80 (define-public python-bcrypt
82 (name "python-bcrypt")
87 (uri (pypi-uri "bcrypt" version))
89 (base32 "0hhywhxx301cxivgxrpslrangbfpccc8y83qbwn1f57cab3nj00b"))))
90 (build-system python-build-system)
92 `(("python-pycparser" ,python-pycparser)
93 ("python-pytest" ,python-pytest)))
95 `(("python-cffi" ,python-cffi)
96 ("python-six" ,python-six)))
97 (home-page "https://github.com/pyca/bcrypt/")
99 "Modern password hashing library")
101 "Bcrypt is a Python module which provides a password hashing method based
102 on the Blowfish password hashing algorithm, as described in
103 @url{http://static.usenix.org/events/usenix99/provos.html,\"A Future-Adaptable
104 Password Scheme\"} by Niels Provos and David Mazieres.")
105 (license license:asl2.0)))
107 (define-public python2-bcrypt
108 (package-with-python2 python-bcrypt))
110 (define-public python-passlib
112 (name "python-passlib")
117 (uri (pypi-uri "passlib" version))
119 (base32 "1a5ngap7kq0b4azq8nlfg6xg5bcl1i0v1sbynhmbr631jgpnqrld"))))
120 (build-system python-build-system)
122 `(("python-nose" ,python-nose)))
124 `(("python-py-bcrypt" ,python-py-bcrypt)))
127 (modify-phases %standard-phases
128 (add-before 'check 'set-PYTHON_EGG_CACHE
129 ;; some tests require access to "$HOME/.cython"
130 (lambda* _ (setenv "PYTHON_EGG_CACHE" "/tmp") #t)))))
131 (home-page "https://bitbucket.org/ecollins/passlib")
132 (synopsis "Comprehensive password hashing framework")
134 "Passlib is a password hashing library for Python 2 & 3, which provides
135 cross-platform implementations of over 30 password hashing algorithms, as well
136 as a framework for managing existing password hashes. It's designed to be
137 useful for a wide range of tasks, from verifying a hash found in /etc/shadow,
138 to providing full-strength password hashing for multi-user application.")
139 (license license:bsd-3)))
141 (define-public python2-passlib
142 (package-with-python2 python-passlib))
144 (define-public python-py-bcrypt
146 (name "python-py-bcrypt")
151 (uri (pypi-uri "py-bcrypt" version))
154 "0y6smdggwi5s72v6p1nn53dg6w05hna3d264cq6kas0lap73p8az"))))
155 (build-system python-build-system)
156 (home-page "https://code.google.com/p/py-bcrypt")
158 "Bcrypt password hashing and key derivation")
160 "A python wrapper of OpenBSD's Blowfish password hashing code. This
161 system hashes passwords using a version of Bruce Schneier's Blowfish block
162 cipher with modifications designed to raise the cost of off-line password
163 cracking and frustrate fast hardware implementation. The computation cost of
164 the algorithm is parametrised, so it can be increased as computers get faster.
165 The intent is to make a compromise of a password database less likely to
166 result in an attacker gaining knowledge of the plaintext passwords (e.g. using
168 ;; "sha2.c" is under BSD-3;
169 ;; "blowfish.c" and "bcrypt.c" are under BSD-4;
170 ;; the rest is under ISC.
171 (license (list license:isc license:bsd-3 license:bsd-4))))
173 (define-public python2-py-bcrypt
174 (package-with-python2 python-py-bcrypt))
176 (define-public python-pyblake2
178 (name "python-pyblake2")
183 (uri (pypi-uri "pyblake2" version))
186 "0gz9hgznv5zw4qjq43xa56y0yikimx30gffvibxzm0nv5sq7xk2w"))))
187 (build-system python-build-system)
188 (home-page "https://github.com/dchest/pyblake2")
189 (synopsis "BLAKE2 hash function for Python")
190 (description "BLAKE2 is a cryptographic hash function, which offers
191 stronger security while being as fast as MD5 or SHA-1, and comes in two
192 flavors: @code{BLAKE2b}, optimized for 64-bit platforms and produces digests
193 of any size between 1 and 64 bytes, and @code{BLAKE2s}, optimized for 8- to
194 32-bit platforms and produces digests of any size between 1 and 32 bytes.
196 This package provides a Python interface for BLAKE2.")
197 ;; The COPYING file declares it as public domain, with the option to
198 ;; alternatively use and redistribute it under a variety of permissive
199 ;; licenses. cc0 is explicitly mentioned in setup.py and pyblake2module.c.
200 (license (list license:public-domain license:cc0))))
202 (define-public python-paramiko
204 (name "python-paramiko")
209 (uri (pypi-uri "paramiko" version))
212 "1jqgj2gl1pz7bi2aab1r2xq0ml0gskmm9p235cg9y32nydymm5x8"))))
213 (build-system python-build-system)
215 `(;; FIXME: Tests require many unpackaged libraries, see dev-requirements.txt.
218 `(("python-bcrypt" ,python-bcrypt)
219 ("python-pyasn1" ,python-pyasn1)
220 ("python-pynacl" ,python-pynacl)
221 ("python-cryptography" ,python-cryptography)))
222 (home-page "https://www.paramiko.org/")
223 (synopsis "SSHv2 protocol library")
224 (description "Paramiko is a python implementation of the SSHv2 protocol,
225 providing both client and server functionality. While it leverages a Python C
226 extension for low level cryptography (PyCrypto), Paramiko itself is a pure
227 Python interface around SSH networking concepts.")
228 (license license:lgpl2.1+)))
230 (define-public python2-paramiko
231 (package-with-python2 python-paramiko))
233 (define-public python-ecdsa
235 (name "python-ecdsa")
240 (uri (pypi-uri "ecdsa" version))
242 (base32 "13nx5cbfxc0gnax5zwdmp9xc40qd1llk62mv85jyrvqkbw017ik4"))))
243 (build-system python-build-system)
246 (modify-phases %standard-phases
248 (lambda _ (invoke "pytest"))))))
250 `(("python-six" ,python-six)))
252 `(("openssl" ,openssl)
253 ("python-pytest" ,python-pytest)))
254 (home-page "https://github.com/warner/python-ecdsa")
255 (synopsis "ECDSA cryptographic signature library (pure python)")
257 "This is an easy-to-use implementation of ECDSA cryptography (Elliptic
258 Curve Digital Signature Algorithm), implemented purely in Python. With this
259 library, you can quickly create keypairs (signing key and verifying key), sign
260 messages, and verify the signatures. The keys and signatures are very short,
261 making them easy to handle and incorporate into other protocols.")
262 (license license:expat)))
264 (define-public python2-ecdsa
265 (package-with-python2 python-ecdsa))
267 ;;; Pycrypto is abandoned upstream:
269 ;;; https://github.com/dlitz/pycrypto/issues/173
271 ;;; TODO Remove this package from GNU Guix.
272 (define-public python-pycrypto
274 (name "python-pycrypto")
279 (uri (pypi-uri "pycrypto" version))
280 (patches (search-patches "python-pycrypto-CVE-2013-7459.patch"))
283 "0g0ayql5b9mkjam8hym6zyg6bv77lbh66rv1fyvgqb17kfc1xkpj"))))
284 (build-system python-build-system)
290 (modify-phases %standard-phases
291 (add-before 'build 'set-build-env
292 ;; pycrypto runs an autoconf configure script behind the scenes
293 (lambda _ (setenv "CONFIG_SHELL" (which "bash")) #t)))))
294 (home-page "http://www.pycrypto.org/")
295 (synopsis "Cryptographic modules for Python")
297 "Pycrypto is a collection of both secure hash functions (such as SHA256
298 and RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal,
299 etc.). The package is structured to make adding new modules easy.")
300 (license license:public-domain)))
302 (define-public python2-pycrypto
303 (let ((pycrypto (package-with-python2 python-pycrypto)))
304 (package (inherit pycrypto)
306 `(("python" ,python-2)
309 (package-inputs pycrypto)))))))
311 (define-public python-keyring
313 (name "python-keyring")
318 (uri (pypi-uri "keyring" version))
321 "1k0w3yh3fz0qp0cvkxdiinq9jzbrnc6bd88qpjz34x3cgcr94psz"))
322 (modules '((guix build utils)))
324 ;; https://github.com/jaraco/keyring/issues/414
325 '(begin (substitute* "tests/test_packaging.py"
326 (("ep, =") "(ep,) =")) #t))))
327 (build-system python-build-system)
330 (modify-phases %standard-phases
333 ;; Not clear why this test fails.
334 (delete-file "tests/test_packaging.py")
335 (substitute* "pytest.ini"
337 (invoke "pytest"))))))
339 `(("python-pytest" ,python-pytest)
340 ("python-pytest-checkdocs" ,python-pytest-checkdocs)
341 ("python-pytest-cov" ,python-pytest-cov)
342 ("python-pytest-flake8" ,python-pytest-flake8)
343 ("python-setuptools-scm" ,python-setuptools-scm)))
345 `(("python-importlib-metadata" ,python-importlib-metadata)
346 ("python-secretstorage" ,python-secretstorage)))
347 (home-page "https://github.com/jaraco/keyring")
348 (synopsis "Store and access your passwords safely")
350 "The Python keyring lib provides a easy way to access the system keyring
351 service from python. It can be used in any application that needs safe
353 ;; "MIT" and PSF dual license
354 (properties `((python2-variant . ,(delay python2-keyring))))
355 (license license:x11)))
357 (define-public python2-keyring
358 (let ((keyring (package-with-python2
359 (strip-python2-variant python-keyring))))
362 (name "python2-keyring")
367 (uri (pypi-uri "keyring" version))
370 "0482rmi2x6p78wl2kz8qzyq21xz1sbbfwnv5x7dggar4vkwxhzfx"))))
372 `(#:python ,python-2))
374 `(("python2-pytest" ,python2-pytest)
375 ("python2-pytest-runner" ,python2-pytest-runner)
376 ("python2-setuptools-scm" ,python2-setuptools-scm)))
378 `(("python2-pycrypto" ,python2-pycrypto))))))
380 (define-public python-certifi
382 (name "python-certifi")
386 (uri (pypi-uri "certifi" version))
389 "1bnpw7hrf9i1l9gfxjnzi45hkrvzz0pyn9ia8m4mw7sxhgb08qdj"))))
390 (build-system python-build-system)
391 (home-page "https://certifi.io/")
392 (synopsis "Python CA certificate bundle")
394 "Certifi is a Python library that contains a CA certificate bundle, which
395 is used by the Requests library to verify HTTPS requests.")
396 (license license:asl2.0)))
398 (define-public python2-certifi
399 (package-with-python2 python-certifi))
401 (define-public python-cryptography-vectors
403 (name "python-cryptography-vectors")
408 (uri (pypi-uri "cryptography_vectors" version))
411 "1g38zw90510azyfrj6mxbslx2gp9yrnv5dac0w2819k9ssdznbgi"))))
412 (build-system python-build-system)
413 (home-page "https://github.com/pyca/cryptography")
414 (synopsis "Test vectors for the cryptography package")
416 "This package contains test vectors for the cryptography package.")
417 ;; Distributed under either BSD-3 or ASL2.0
418 (license (list license:bsd-3 license:asl2.0))))
420 (define-public python2-cryptography-vectors
421 (package-with-python2 python-cryptography-vectors))
423 (define-public python-cryptography
425 (name "python-cryptography")
430 (uri (pypi-uri "cryptography" version))
433 "1inlnr36kl36551c9rcad99jmhk81v33by3glkadwdcgmi17fd76"))))
434 (build-system python-build-system)
436 `(("openssl" ,openssl)))
438 `(("python-asn1crypto" ,python-asn1crypto)
439 ("python-cffi" ,python-cffi)
440 ("python-six" ,python-six)
441 ("python-idna" ,python-idna)
442 ("python-iso8601" ,python-iso8601)))
444 `(("python-cryptography-vectors" ,python-cryptography-vectors)
445 ("python-hypothesis" ,python-hypothesis)
446 ("python-pretend" ,python-pretend)
447 ("python-pytz" ,python-pytz)
448 ("python-pytest" ,python-pytest)))
449 (home-page "https://github.com/pyca/cryptography")
450 (synopsis "Cryptographic recipes and primitives for Python")
452 "cryptography is a package which provides cryptographic recipes and
453 primitives to Python developers. It aims to be the “cryptographic standard
454 library” for Python. The package includes both high level recipes, and low
455 level interfaces to common cryptographic algorithms such as symmetric ciphers,
456 message digests and key derivation functions.")
457 ;; Distributed under either BSD-3 or ASL2.0
458 (license (list license:bsd-3 license:asl2.0))
459 (properties `((python2-variant . ,(delay python2-cryptography))))))
461 (define-public python2-cryptography
462 (let ((crypto (package-with-python2
463 (strip-python2-variant python-cryptography))))
464 (package (inherit crypto)
466 `(("python2-ipaddress" ,python2-ipaddress)
467 ("python2-backport-ssl-match-hostname"
468 ,python2-backport-ssl-match-hostname)
469 ("python2-enum34" ,python2-enum34)
470 ,@(package-propagated-inputs crypto))))))
472 (define-public python-pyopenssl
474 (name "python-pyopenssl")
479 (uri (pypi-uri "pyOpenSSL" version))
482 "007j40y7x3k8xj54dy2qnij9lldfp71k9mkflhd9vqbdiwrndjmf"))))
483 (build-system python-build-system)
486 (modify-phases %standard-phases
488 (add-after 'install 'check
489 (lambda* (#:key inputs outputs #:allow-other-keys)
490 (add-installed-pythonpath inputs outputs)
491 ;; PyOpenSSL runs tests against a certificate with a fixed
492 ;; expiry time. To ensure successful builds in the future,
493 ;; set the time to roughly the release date.
494 (invoke "faketime" "2019-01-01" "py.test" "-v" "-k"
496 ;; This test tries to look up certificates from
497 ;; the compiled-in default path in OpenSSL, which
498 ;; does not exist in the build environment.
499 "not test_fallback_default_verify_paths "
500 ;; This test attempts to make a connection to
501 ;; an external web service.
502 "and not test_set_default_verify_paths")))))))
504 `(("python-cryptography" ,python-cryptography)
505 ("python-six" ,python-six)))
507 `(("openssl" ,openssl)))
509 `(("libfaketime" ,libfaketime)
510 ("python-flaky" ,python-flaky)
511 ("python-pretend" ,python-pretend)
512 ("python-pytest" ,python-pytest)))
513 (home-page "https://github.com/pyca/pyopenssl")
514 (synopsis "Python wrapper module around the OpenSSL library")
516 "PyOpenSSL is a high-level wrapper around a subset of the OpenSSL
518 (license license:asl2.0)))
520 (define-public python2-pyopenssl
521 (package-with-python2 python-pyopenssl))
523 (define-public python-ed25519
525 (name "python-ed25519")
530 (uri (pypi-uri "ed25519" version))
533 "0ahx1nkxa0xis3cw0h5c4fpgv8mq4znkq7kajly33lc3317bk499"))))
534 (build-system python-build-system)
535 (home-page "https://github.com/warner/python-ed25519")
536 (synopsis "Ed25519 public-key signatures")
537 (description "Ed25519 public-key signatures")
538 (license license:expat)))
540 (define-public python2-ed25519
541 (package-with-python2 python-ed25519))
543 (define-public python-axolotl-curve25519
545 (name "python-axolotl-curve25519")
551 (url "https://github.com/tgalal/python-axolotl-curve25519")
552 (commit "e4a9c4de0eae27223200579c58d1f8f6d20637e2")))
553 (file-name (string-append name "-" version "-checkout"))
556 "0agap5q0hmvf6cwzjqc05kw53pjgf6942pcivpazksmg1vk400ra"))))
557 (build-system python-build-system)
559 `(;; Prevent creation of the egg. This works around
560 ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20765
561 #:configure-flags '("--root=/")))
562 (home-page "https://github.com/tgalal/python-axolotl-curve25519")
563 (synopsis "Python wrapper for curve25519 library")
564 (description "This is a python wrapper for the curve25519 library
565 with ed25519 signatures. The C code was pulled from
566 libaxolotl-android. At the moment this wrapper is meant for use by
568 (license (list license:gpl3 ; Most files
569 license:bsd-3)))) ; curve/curve25519-donna.c
571 (define-public python2-axolotl-curve25519
572 (package-with-python2 python-axolotl-curve25519))
574 (define-public python-axolotl
576 (name "python-axolotl")
582 (url "https://github.com/tgalal/python-axolotl")
584 (file-name (git-file-name name version))
585 (patches (search-patches "python-axolotl-AES-fix.patch"))
587 (base32 "0xm9qgcwf6fq7rhzfcviwhbzcbj4i7wkxkab2z55fy1x82lya9g6"))))
588 (build-system python-build-system)
591 (modify-phases %standard-phases
592 ;; Don't install tests
593 (add-before 'install 'remove-tests
595 (for-each delete-file-recursively
596 '("axolotl/tests" "build/lib/axolotl/tests"))
599 `(("python-axolotl-curve25519" ,python-axolotl-curve25519)
600 ("python-dateutil" ,python-dateutil)
601 ("python-protobuf" ,python-protobuf)
602 ("python-pycrypto" ,python-pycrypto)))
603 (home-page "https://github.com/tgalal/python-axolotl")
604 (synopsis "Python port of libaxolotl-android")
605 (description "This is a python port of libaxolotl-android. This
606 is a ratcheting forward secrecy protocol that works in synchronous and
607 asynchronous messaging environments.")
608 (license license:gpl3)))
610 (define-public python2-axolotl
611 (package-with-python2 python-axolotl))
613 ;; SlowAES isn't compatible with Python 3.
614 (define-public python2-slowaes
616 (name "python2-slowaes")
621 (uri (pypi-uri "slowaes" version))
624 "02dzajm83a7lqgxf6r3hgj64wfmcxz8gs4nvgxpvj5n19kjqlrc3"))))
625 (build-system python-build-system)
626 (arguments `(#:python ,python-2))
627 (home-page "http://code.google.com/p/slowaes/")
628 (synopsis "Implementation of AES in Python")
629 (description "This package contains an implementation of AES in Python.
630 This implementation is slow (hence the project name) but still useful when
631 faster ones are not available.")
632 (license license:asl2.0)))
634 (define-public python-pyaes
636 (name "python-pyaes")
641 (uri (pypi-uri "pyaes" version))
644 "13vdaff15k0jyfcss4b4xvfgm8xyv0nrbyw5n1qc7lrqbi0b3h82"))))
645 (build-system python-build-system)
646 (home-page "https://github.com/ricmoo/pyaes")
647 (synopsis "Implementation of AES in Python")
648 (description "This package contains a pure-Python implementation of the
649 AES block cipher algorithm and the common modes of operation (CBC, CFB, CTR,
651 (license license:expat)))
653 (define-public python2-pyaes
654 (package-with-python2 python-pyaes))
656 (define-public python-asn1crypto
658 (name "python-asn1crypto")
664 (url "https://github.com/wbond/asn1crypto.git")
666 (file-name (git-file-name name version))
669 "10lai2cs5mnz3gpaffbw1m7b885ls8328q5wxm35vfmcip1f0xmb"))))
670 (build-system python-build-system)
671 (home-page "https://github.com/wbond/asn1crypto")
672 (synopsis "ASN.1 parser and serializer in Python")
673 (description "asn1crypto is an ASN.1 parser and serializer with definitions
674 for private keys, public keys, certificates, CRL, OCSP, CMS, PKCS#3, PKCS#7,
675 PKCS#8, PKCS#12, PKCS#5, X.509 and TSP.")
676 (license license:expat)))
678 (define-public python2-asn1crypto
679 (package-with-python2 python-asn1crypto))
681 (define-public python-pynacl
683 (name "python-pynacl")
688 (uri (pypi-uri "PyNaCl" version))
689 (modules '((guix build utils)))
690 ;; Remove bundled libsodium.
691 (snippet '(begin (delete-file-recursively "src/libsodium")
695 "0330wyvggm19xhmwmz9rrr97lzbv3siwfy50gmax3vvgs7nh0q8c"))))
696 (build-system python-build-system)
699 (modify-phases %standard-phases
700 (add-before 'build 'use-system-sodium
702 (setenv "SODIUM_INSTALL" "system")
705 `(("python-hypothesis" ,python-hypothesis)
706 ("python-pytest" ,python-pytest)))
708 `(("python-cffi" ,python-cffi)
709 ("python-six" ,python-six)
710 ("libsodium" ,libsodium)))
711 (home-page "https://github.com/pyca/pynacl/")
712 (synopsis "Python bindings to libsodium")
714 "PyNaCl is a Python binding to libsodium, which is a fork of the
715 Networking and Cryptography library. These libraries have a stated goal
716 of improving usability, security and speed.")
717 (license license:asl2.0)))
719 (define-public python2-pynacl
720 (package-with-python2 python-pynacl))
722 (define-public python2-pgpdump
724 (name "python2-pgpdump")
729 (uri (pypi-uri "pgpdump" version))
732 "0s4nh8h7qsdj2yf29bspjs1zvxd4lcd11r6g11dp7fppgf2h0iqw"))))
733 (build-system python-build-system)
735 ;; Currently fails to build with Python 3.
736 (arguments `(#:python ,python-2))
738 (home-page "https://github.com/toofishes/python-pgpdump")
739 (synopsis "Python library for parsing PGP packets")
741 "Python-pgpdump is an OpenPGP packet parser based on
742 @uref{http://www.mew.org/~kazu/proj/pgpdump/, pgpdump}. It notably supports:
745 @item signature packets;
746 @item public key packets;
747 @item secret key packets;
748 @item trust, user ID, and user attribute packets;
749 @item ASCII-armor decoding and CRC check.
751 (license license:bsd-3)))
753 (define-public python2-roca-detect
755 (name "python2-roca-detect")
760 (uri (pypi-uri "roca-detect" version))
763 "1di4akyw2lf5r8zfwvyhkilz8jv8g4b66rgaqwfabmjwma6gnw27"))))
764 (build-system python-build-system)
766 ;; TODO: apk_parse_ph4, pyjks
767 `(("python2-dateutil" ,python2-dateutil)
768 ("python2-six" ,python2-six)
769 ("python2-cryptography" ,python2-cryptography)
770 ("python2-future" ,python2-future)
771 ("python2-coloredlogs" ,python2-coloredlogs)
772 ("python2-pgpdump" ,python2-pgpdump)))
774 `(;; Basic testing routine is quite simple and works with Py3
775 ;; but the rest of the code that processes the different
776 ;; key formats and extracts the modulus for inspection is
777 ;; not yet fully py3 ready.
779 (home-page "https://github.com/crocs-muni/roca")
780 (synopsis "ROCA detection tool")
782 "This tool is related to the paper entitled @i{Return of the
783 Coppersmith’s Attack: Practical Factorization of Widely Used RSA Moduli}. It
784 enables you to test public RSA keys for a presence of the described
785 vulnerability. Currently the tool supports the following key formats: X.509
786 Certificate (DER encoded, PEM encoded), RSA PEM (encoded private key, public
787 key), SSH public key, ASC-encoded OpenPGP key, APK Android application, LDIFF
789 (license license:gpl3)))
791 (define-public python-ecpy
798 (uri (pypi-uri "ECPy" version))
801 "1gc3i5s93zq6x1nkaxkq1dvmsc12vmrw0hns9f5s1hcb78ni52c8"))))
802 (build-system python-build-system)
804 `(("python-future" ,python-future)))
805 (home-page "https://github.com/ubinity/ECPy")
806 (synopsis "Pure Python Elliptic Curve Library")
807 (description "This package provides a Elliptic Curve Library in pure
809 (license license:asl2.0)))
811 (define-public python2-ecpy
812 (package-with-python2 python-ecpy))
814 (define-public python-josepy
816 (name "python-josepy")
820 (uri (pypi-uri "josepy" version))
823 "11khz8malzrv375b27jjkv66z6z6khdx1v5mkkr4vq16gp3n4p7v"))))
824 (build-system python-build-system)
826 ;; The tests require flake8 >= 3.5, which is not yet packaged.
829 `(("python-cryptography" ,python-cryptography)
830 ("python-pyopenssl" ,python-pyopenssl)
831 ("python-six" ,python-six)))
832 ;; TODO Enable when we have flake8 >= 3.5.
834 ; `(("python-coverage" ,python-coverage)
835 ; ("python-flake8" ,python-flake8)
836 ; ("python-isort" ,python-isort)
837 ; ("python-mock" ,python-mock)
838 ; ("python-pytest" ,python-pytest)
839 ; ("python-pytest-cov" ,python-pytest-cov)
840 ; ("python-pytest-cache" ,python-pytest-cache)
841 ; ("python-pytest-flake8" ,python-pytest-flake8)))
842 (home-page "https://github.com/certbot/josepy")
843 (synopsis "JOSE protocol implementation in Python")
844 (description "This package provides a Python implementation of the JOSE
845 protocol (Javascript Object Signing and Encryption).")
846 (license license:asl2.0)))
848 (define-public python2-josepy
849 (package-with-python2 python-josepy))
851 (define-public python-pycryptodome
853 (name "python-pycryptodome")
858 (uri (pypi-uri "pycryptodome" version))
861 "0dh6ky5ngxayyn5f6n7gdamjl49g3khz6pdx9sdnag1zwi8248hs"))))
862 (build-system python-build-system)
863 (home-page "https://www.pycryptodome.org")
864 (synopsis "Cryptographic library for Python")
865 (description "This package provides a cryptographic library for Python.
867 It brings the following enhancements with respect to the last official version
871 @item Authenticated encryption modes (GCM, CCM, EAX, SIV, OCB)
872 @item Accelerated AES on Intel platforms via AES-NI
873 @item First class support for PyPy
874 @item Elliptic curves cryptography (NIST P-256 curve only)
875 @item Better and more compact API (nonce and iv attributes for ciphers,
876 automatic generation of random nonces and IVs, simplified CTR cipher mode, and
878 @item SHA-3 (including SHAKE XOFs) and BLAKE2 hash algorithms
879 @item Salsa20 and ChaCha20 stream ciphers
880 @item scrypt and HKDF
881 @item Deterministic (EC)DSA
882 @item Password-protected PKCS#8 key containers
883 @item Shamir’s Secret Sharing scheme
884 @item Random numbers get sourced directly from the OS (and not from a CSPRNG
886 @item Cleaner RSA and DSA key generation (largely based on FIPS 186-4)
887 @item Major clean ups and simplification of the code base
889 (license license:bsd-2)))
891 (define-public python2-pycryptodome
892 (package-with-python2 python-pycryptodome))
894 (define-public python-m2crypto
896 (name "python-m2crypto")
901 (uri (pypi-uri "M2Crypto" version))
903 (base32 "09yirf3w77w6f49q6nxhrjm9c3a4y9s30s1k09chqrw8zdgx8sjc"))))
904 (build-system python-build-system)
905 (inputs `(("openssl" ,openssl)))
906 (home-page "https://gitlab.com/m2crypto/m2crypto")
907 (synopsis "Python crypto and TLS toolkit")
908 (description "@code{M2Crypto} is a complete Python wrapper for OpenSSL
909 featuring RSA, DSA, DH, EC, HMACs, message digests, symmetric ciphers
910 (including AES); TLS functionality to implement clients and servers; HTTPS
911 extensions to Python's httplib, urllib, and xmlrpclib; unforgeable HMAC'ing
912 AuthCookies for web session management; FTP/TLS client and server; S/MIME;
913 M2Crypto can also be used to provide TLS for Twisted. Smartcards supported
914 through the Engine interface.")
915 (properties `((python2-variant . ,(delay python2-m2crypto))))
916 (license license:expat)))
918 (define-public python2-m2crypto
919 (let ((m2crypto (package-with-python2
920 (strip-python2-variant python-m2crypto))))
921 (package (inherit m2crypto)
923 `(("python2-typing" ,python2-typing))))))
925 (define-public python-pylibscrypt
927 (name "python-pylibscrypt")
932 (uri (pypi-uri "pylibscrypt" version))
935 "1b3rgzl6dbzs08vhv41b6y4n5189wv7lr27acxn104hs45745abs"))))
936 (build-system python-build-system)
939 (modify-phases %standard-phases
940 (add-before 'build 'hard-code-path-to-libscrypt
941 (lambda* (#:key inputs #:allow-other-keys)
942 (let ((libscrypt (assoc-ref inputs "libscrypt")))
943 (substitute* "pylibscrypt/pylibscrypt.py"
944 (("find_library\\('scrypt'\\)")
945 (string-append "'" libscrypt "/lib/libscrypt.so'")))
947 ;; The library can use various scrypt implementations and tests all of
948 ;; them. Since we only provide a single implementation, most tests
949 ;; fail. Simply skip them.
951 ;; FIXME: Using "libscrypt" is the second best choice. The best one
952 ;; requires "hashlib.scrypt", provided by Python 3.6+ built with OpenSSL
953 ;; 1.1+. Use that as soon as Guix provides it.
955 `(("libscrypt" ,libscrypt)))
956 (home-page "https://github.com/jvarho/pylibscrypt")
957 (synopsis "Scrypt for Python")
958 (description "There are a lot of different scrypt modules for Python, but
959 none of them have everything that I'd like, so here's one more. It uses
961 (license license:isc)))
963 (define-public python-libnacl
965 (name "python-libnacl")
970 (uri (pypi-uri "libnacl" version))
973 "0nv7n8nfswkhl614x5mllrkvaslraa0053q11iylb337cy43vb4v"))))
974 (build-system python-build-system)
977 (modify-phases %standard-phases
978 (add-after 'unpack 'locate-libsodium
979 (lambda* (#:key inputs #:allow-other-keys)
980 (substitute* "libnacl/__init__.py"
981 (("(return ctypes.cdll.LoadLibrary\\(')libsodium.so('\\))"
983 (let ((libsodium (string-append (assoc-ref inputs "libsodium")
984 "/lib/libsodium.so")))
985 (string-append pre libsodium post)))))))))
987 `(("python-pyhamcrest" ,python-pyhamcrest)))
989 `(("libsodium" ,libsodium)))
990 (home-page "https://libnacl.readthedocs.org/")
991 (synopsis "Python bindings for libsodium based on ctypes")
992 (description "@code{libnacl} is used to gain direct access to the
993 functions exposed by @code{NaCl} library via @code{libsodium}. It has
994 been constructed to maintain extensive documentation on how to use
995 @code{NaCl} as well as being completely portable.")
996 (license license:asl2.0)))
998 (define-public python-scrypt
1000 (name "python-scrypt")
1005 (uri (pypi-uri "scrypt" version))
1008 "0hjk71k3mgnl8siikm9lii9im8kv0rb7inkjzx78rnancra48xxr"))))
1009 (build-system python-build-system)
1011 `(("openssl" ,openssl)))
1012 (home-page "http://bitbucket.org/mhallin/py-scrypt")
1013 (synopsis "Bindings for the scrypt key derivation function library")
1014 (description "This is a set of Python bindings for the scrypt key
1015 derivation function.")
1016 (license license:bsd-2)))
1018 (define-public python-service-identity
1020 (name "python-service-identity")
1025 (uri (pypi-uri "service_identity" version))
1028 "0b9f5qiqjy8ralzgwjgkhx82h6h8sa7532psmb8mkd65md5aan08"))))
1029 (build-system python-build-system)
1031 `(("python-attrs" ,python-attrs)
1032 ("python-pyasn1" ,python-pyasn1)
1033 ("python-pyasn1-modules" ,python-pyasn1-modules)
1034 ("python-pyopenssl" ,python-pyopenssl)))
1035 (home-page "https://service-identity.readthedocs.io/")
1036 (synopsis "Service identity verification for PyOpenSSL")
1038 "@code{service_identity} aspires to give you all the tools you need
1039 for verifying whether a certificate is valid for the intended purposes.
1040 In the simplest case, this means host name verification. However,
1041 service_identity implements RFC 6125 fully and plans to add other
1042 relevant RFCs too.")
1043 (license license:expat)))
1045 (define-public python2-service-identity
1046 (package-with-python2 python-service-identity))
1048 (define-public python-hkdf
1050 (name "python-hkdf")
1055 (uri (pypi-uri "hkdf" version))
1058 "1jhxk5vhxmxxjp3zj526ry521v9inzzl8jqaaf0ma65w6k332ak2"))))
1059 (build-system python-build-system)
1061 `(("python-nose" ,python-nose)))
1062 (home-page "https://github.com/casebeer/python-hkdf")
1063 (synopsis "HMAC-based Extract-and-Expand Key Derivation Function (HKDF)")
1064 (description "This package provides a Python implementation of the HMAC Key
1065 Derivation function (HKDF) defined in RFC 5869.")
1066 (license license:bsd-2)))
1068 (define-public python-spake2
1070 (name "python-spake2")
1075 (uri (pypi-uri "spake2" version))
1078 "1x16r7lrbklvfzbacb66qv9iiih6liq1y612dqh2chgf555n2yn1"))))
1079 (build-system python-build-system)
1081 `(("python-hkdf" ,python-hkdf)))
1082 (home-page "https://github.com/warner/python-spake2")
1083 (synopsis "SPAKE2 password-authenticated key exchange in Python")
1084 (description "This package provides a Python implementation of the SPAKE2
1085 Password-Authenticated Key Exchange algorithm.")
1086 (license license:expat)))
1088 (define-public python-txtorcon
1090 (name "python-txtorcon")
1095 (uri (pypi-uri "txtorcon" version))
1098 "0fxzhsc62bhmr730vj9pzallmw56gz6iykvl28a5agrycm0bfc9p"))))
1099 (build-system python-build-system)
1101 ;; The tests fail immediately due to a missing file. Reported upstream:
1102 ;; <https://github.com/meejah/txtorcon/issues/330>
1105 `(("python-automat" ,python-automat)
1106 ("python-idna" ,python-idna)
1107 ("python-incremental" ,python-incremental)
1108 ("python-ipaddress" ,python-ipaddress)
1109 ("python-service-identity" ,python-service-identity)
1110 ("python-twisted" ,python-twisted)
1111 ("python-zope-interface" ,python-zope-interface)))
1112 (home-page "https://github.com/meejah/txtorcon")
1113 (synopsis "Twisted-based Tor controller client")
1114 (description "This package provides a Twisted-based Tor controller client,
1115 with state-tracking and configuration abstractions.")
1116 (license license:expat)))
1118 (define-public python-keyutils
1120 (name "python-keyutils")
1125 (uri (pypi-uri "keyutils" version))
1128 "0lipygpzhwzzsq2k5imb1jgkmj8y4khxdwhzadjs3bd56g6bmkx9"))))
1129 (build-system python-build-system)
1131 `(("python-pytest" ,python-pytest)
1132 ("python-pytest-runner" ,python-pytest-runner)))
1134 `(("keyutils" ,keyutils)))
1137 (home-page "https://github.com/sassoftware/python-keyutils")
1138 (synopsis "Python bindings for keyutils")
1140 "This is a set of python bindings for keyutils, a key management suite
1141 that leverages the infrastructure provided by the Linux kernel for safely
1142 storing and retrieving sensitive information in your programs.")
1143 (license license:asl2.0)))
1145 (define-public python-mcuboot-imgtool
1147 (name "python-mcuboot-imgtool")
1153 (url "https://github.com/JuulLabs-OSS/mcuboot")
1154 (commit (string-append "v" version))))
1155 (file-name (git-file-name name version))
1158 "1m1csyvzq4jx81zg635ssy1n7sc0z539z0myh872ll3nwqx7wa0q"))))
1159 (build-system python-build-system)
1162 (modify-phases %standard-phases
1163 (add-after 'unpack 'fix-broken-test
1165 (substitute* "scripts/imgtool/keys/ed25519_test.py"
1166 (("raw_sign") "sign_digest"))
1168 (add-before 'build 'change-directory
1173 `(("python-click" ,python-click)
1174 ("python-intelhex" ,python-intelhex)
1175 ("python-cryptography" ,python-cryptography)))
1176 (home-page "https://mcuboot.com")
1177 (synopsis "Tool to securely sign firmware images for booting by MCUboot")
1178 (description "MCUboot is a secure bootloader for 32-bit MCUs. This
1179 package provides a tool to securely sign firmware images for booting by
1181 (license license:expat)))
1183 (define-public python-secretstorage
1185 (name "python-secretstorage")
1190 (uri (pypi-uri "SecretStorage" version))
1193 "1xmzr0j3066s220bss4nkgqbiwb5k4kkp2rkpqlqwjb5kfc8mnhm"))))
1194 (build-system python-build-system)
1196 '(#:tests? #f)) ; Tests require a running dbus service.
1198 `(("python-cryptography" ,python-cryptography)
1199 ("python-jeepney" ,python-jeepney)))
1200 (home-page "https://github.com/mitya57/secretstorage")
1201 (synopsis "Python bindings to FreeDesktop.org Secret Service API")
1203 "@code{python-secretstorage} provides a way for securely storing passwords
1204 and other secrets. It uses D-Bus Secret Service API that is supported by GNOME
1205 Keyring (since version 2.30) and KSecretsService. SecretStorage supports most
1206 of the functions provided by Secret Service, including creating and deleting
1207 items and collections, editing items, locking and unlocking collections
1208 (asynchronous unlocking is also supported).")
1209 (license license:bsd-3)))
1211 (define-public python-jeepney
1213 (name "python-jeepney")
1218 (uri (pypi-uri "jeepney" version))
1221 "1fz9lb5fl831sijg2j0sbki698j2z6awbblas7mz3gp9jz2xi9hb"))))
1222 (build-system python-build-system)
1224 `(("python-testpath" ,python-testpath)
1225 ("python-tornado" ,python-tornado)
1226 ("python-pytest" ,python-pytest)))
1227 (home-page "https://gitlab.com/takluyver/jeepney")
1228 (synopsis "Low-level, pure Python DBus protocol wrapper")
1230 "This is a low-level, pure Python DBus protocol client. It has an
1231 I/O-free core, and integration modules for different event loops.")
1232 (license license:expat)))