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 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-web)
53 #:use-module (gnu packages python-xyz)
54 #:use-module (gnu packages time)
55 #:use-module (gnu packages tls)
56 #:use-module ((guix licenses) #:prefix license:)
57 #:use-module (srfi srfi-1))
59 (define-public python-base58
61 (name "python-base58")
66 (uri (pypi-uri "base58" version))
69 "0q1yr0n5jaf17xq98m7dma6z4rh8p19ch55l1s09gi3rk5ckqycs"))))
70 (build-system python-build-system)
72 `(("python-pyhamcrest" ,python-pyhamcrest)))
73 (home-page "https://github.com/keis/base58")
74 (synopsis "Base58 and Base58Check implementation")
75 (description "Base58 and Base58Check implementation compatible
76 with what is used by the Bitcoin network.")
77 (license license:expat)))
79 (define-public python-bcrypt
81 (name "python-bcrypt")
86 (uri (pypi-uri "bcrypt" version))
88 (base32 "0hhywhxx301cxivgxrpslrangbfpccc8y83qbwn1f57cab3nj00b"))))
89 (build-system python-build-system)
91 `(("python-pycparser" ,python-pycparser)
92 ("python-pytest" ,python-pytest)))
94 `(("python-cffi" ,python-cffi)
95 ("python-six" ,python-six)))
96 (home-page "https://github.com/pyca/bcrypt/")
98 "Modern password hashing library")
100 "Bcrypt is a Python module which provides a password hashing method based
101 on the Blowfish password hashing algorithm, as described in
102 @url{http://static.usenix.org/events/usenix99/provos.html,\"A Future-Adaptable
103 Password Scheme\"} by Niels Provos and David Mazieres.")
104 (license license:asl2.0)))
106 (define-public python2-bcrypt
107 (package-with-python2 python-bcrypt))
109 (define-public python-passlib
111 (name "python-passlib")
116 (uri (pypi-uri "passlib" version))
118 (base32 "1a5ngap7kq0b4azq8nlfg6xg5bcl1i0v1sbynhmbr631jgpnqrld"))))
119 (build-system python-build-system)
121 `(("python-nose" ,python-nose)))
123 `(("python-py-bcrypt" ,python-py-bcrypt)))
126 (modify-phases %standard-phases
127 (add-before 'check 'set-PYTHON_EGG_CACHE
128 ;; some tests require access to "$HOME/.cython"
129 (lambda* _ (setenv "PYTHON_EGG_CACHE" "/tmp") #t)))))
130 (home-page "https://bitbucket.org/ecollins/passlib")
131 (synopsis "Comprehensive password hashing framework")
133 "Passlib is a password hashing library for Python 2 & 3, which provides
134 cross-platform implementations of over 30 password hashing algorithms, as well
135 as a framework for managing existing password hashes. It's designed to be
136 useful for a wide range of tasks, from verifying a hash found in /etc/shadow,
137 to providing full-strength password hashing for multi-user application.")
138 (license license:bsd-3)))
140 (define-public python2-passlib
141 (package-with-python2 python-passlib))
143 (define-public python-py-bcrypt
145 (name "python-py-bcrypt")
150 (uri (pypi-uri "py-bcrypt" version))
153 "0y6smdggwi5s72v6p1nn53dg6w05hna3d264cq6kas0lap73p8az"))))
154 (build-system python-build-system)
155 (home-page "https://code.google.com/p/py-bcrypt")
157 "Bcrypt password hashing and key derivation")
159 "A python wrapper of OpenBSD's Blowfish password hashing code. This
160 system hashes passwords using a version of Bruce Schneier's Blowfish block
161 cipher with modifications designed to raise the cost of off-line password
162 cracking and frustrate fast hardware implementation. The computation cost of
163 the algorithm is parametrised, so it can be increased as computers get faster.
164 The intent is to make a compromise of a password database less likely to
165 result in an attacker gaining knowledge of the plaintext passwords (e.g. using
167 ;; "sha2.c" is under BSD-3;
168 ;; "blowfish.c" and "bcrypt.c" are under BSD-4;
169 ;; the rest is under ISC.
170 (license (list license:isc license:bsd-3 license:bsd-4))))
172 (define-public python2-py-bcrypt
173 (package-with-python2 python-py-bcrypt))
175 (define-public python-pyblake2
177 (name "python-pyblake2")
182 (uri (pypi-uri "pyblake2" version))
185 "0gz9hgznv5zw4qjq43xa56y0yikimx30gffvibxzm0nv5sq7xk2w"))))
186 (build-system python-build-system)
187 (home-page "https://github.com/dchest/pyblake2")
188 (synopsis "BLAKE2 hash function for Python")
189 (description "BLAKE2 is a cryptographic hash function, which offers
190 stronger security while being as fast as MD5 or SHA-1, and comes in two
191 flavors: @code{BLAKE2b}, optimized for 64-bit platforms and produces digests
192 of any size between 1 and 64 bytes, and @code{BLAKE2s}, optimized for 8- to
193 32-bit platforms and produces digests of any size between 1 and 32 bytes.
195 This package provides a Python interface for BLAKE2.")
196 ;; The COPYING file declares it as public domain, with the option to
197 ;; alternatively use and redistribute it under a variety of permissive
198 ;; licenses. cc0 is explicitly mentioned in setup.py and pyblake2module.c.
199 (license (list license:public-domain license:cc0))))
201 (define-public python-paramiko
203 (name "python-paramiko")
208 (uri (pypi-uri "paramiko" version))
211 "1jqgj2gl1pz7bi2aab1r2xq0ml0gskmm9p235cg9y32nydymm5x8"))))
212 (build-system python-build-system)
214 `(;; FIXME: Tests require many unpackaged libraries, see dev-requirements.txt.
217 `(("python-bcrypt" ,python-bcrypt)
218 ("python-pyasn1" ,python-pyasn1)
219 ("python-pynacl" ,python-pynacl)
220 ("python-cryptography" ,python-cryptography)))
221 (home-page "https://www.paramiko.org/")
222 (synopsis "SSHv2 protocol library")
223 (description "Paramiko is a python implementation of the SSHv2 protocol,
224 providing both client and server functionality. While it leverages a Python C
225 extension for low level cryptography (PyCrypto), Paramiko itself is a pure
226 Python interface around SSH networking concepts.")
227 (license license:lgpl2.1+)))
229 (define-public python2-paramiko
230 (package-with-python2 python-paramiko))
232 (define-public python-ecdsa
234 (name "python-ecdsa")
239 (uri (pypi-uri "ecdsa" version))
241 (base32 "13nx5cbfxc0gnax5zwdmp9xc40qd1llk62mv85jyrvqkbw017ik4"))))
242 (build-system python-build-system)
245 (modify-phases %standard-phases
247 (lambda _ (invoke "pytest"))))))
249 `(("python-six" ,python-six)))
251 `(("openssl" ,openssl)
252 ("python-pytest" ,python-pytest)))
253 (home-page "https://github.com/warner/python-ecdsa")
254 (synopsis "ECDSA cryptographic signature library (pure python)")
256 "This is an easy-to-use implementation of ECDSA cryptography (Elliptic
257 Curve Digital Signature Algorithm), implemented purely in Python. With this
258 library, you can quickly create keypairs (signing key and verifying key), sign
259 messages, and verify the signatures. The keys and signatures are very short,
260 making them easy to handle and incorporate into other protocols.")
261 (license license:expat)))
263 (define-public python2-ecdsa
264 (package-with-python2 python-ecdsa))
266 ;;; Pycrypto is abandoned upstream:
268 ;;; https://github.com/dlitz/pycrypto/issues/173
270 ;;; TODO Remove this package from GNU Guix.
271 (define-public python-pycrypto
273 (name "python-pycrypto")
278 (uri (pypi-uri "pycrypto" version))
279 (patches (search-patches "python-pycrypto-CVE-2013-7459.patch"))
282 "0g0ayql5b9mkjam8hym6zyg6bv77lbh66rv1fyvgqb17kfc1xkpj"))))
283 (build-system python-build-system)
289 (modify-phases %standard-phases
290 (add-before 'build 'set-build-env
291 ;; pycrypto runs an autoconf configure script behind the scenes
292 (lambda _ (setenv "CONFIG_SHELL" (which "bash")) #t)))))
293 (home-page "http://www.pycrypto.org/")
294 (synopsis "Cryptographic modules for Python")
296 "Pycrypto is a collection of both secure hash functions (such as SHA256
297 and RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal,
298 etc.). The package is structured to make adding new modules easy.")
299 (license license:public-domain)))
301 (define-public python2-pycrypto
302 (let ((pycrypto (package-with-python2 python-pycrypto)))
303 (package (inherit pycrypto)
305 `(("python" ,python-2)
308 (package-inputs pycrypto)))))))
310 (define-public python-keyring
312 (name "python-keyring")
317 (uri (pypi-uri "keyring" version))
320 "0482rmi2x6p78wl2kz8qzyq21xz1sbbfwnv5x7dggar4vkwxhzfx"))))
321 (build-system python-build-system)
323 `(("python-pytest" ,python-pytest)
324 ("python-pytest-runner" ,python-pytest-runner)
325 ("python-setuptools-scm" ,python-setuptools-scm)))
327 `(("python-pycrypto" ,python-pycrypto)))
328 (home-page "https://github.com/jaraco/keyring")
329 (synopsis "Store and access your passwords safely")
331 "The Python keyring lib provides a easy way to access the system keyring
332 service from python. It can be used in any application that needs safe
334 ;; "MIT" and PSF dual license
335 (license license:x11)))
337 (define-public python2-keyring
338 (package-with-python2 python-keyring))
340 (define-public python-certifi
342 (name "python-certifi")
346 (uri (pypi-uri "certifi" version))
349 "1bnpw7hrf9i1l9gfxjnzi45hkrvzz0pyn9ia8m4mw7sxhgb08qdj"))))
350 (build-system python-build-system)
351 (home-page "https://certifi.io/")
352 (synopsis "Python CA certificate bundle")
354 "Certifi is a Python library that contains a CA certificate bundle, which
355 is used by the Requests library to verify HTTPS requests.")
356 (license license:asl2.0)))
358 (define-public python2-certifi
359 (package-with-python2 python-certifi))
361 (define-public python-cryptography-vectors
363 (name "python-cryptography-vectors")
368 (uri (pypi-uri "cryptography_vectors" version))
371 "1g38zw90510azyfrj6mxbslx2gp9yrnv5dac0w2819k9ssdznbgi"))))
372 (build-system python-build-system)
373 (home-page "https://github.com/pyca/cryptography")
374 (synopsis "Test vectors for the cryptography package")
376 "This package contains test vectors for the cryptography package.")
377 ;; Distributed under either BSD-3 or ASL2.0
378 (license (list license:bsd-3 license:asl2.0))))
380 (define-public python2-cryptography-vectors
381 (package-with-python2 python-cryptography-vectors))
383 (define-public python-cryptography
385 (name "python-cryptography")
390 (uri (pypi-uri "cryptography" version))
393 "1inlnr36kl36551c9rcad99jmhk81v33by3glkadwdcgmi17fd76"))))
394 (build-system python-build-system)
396 `(("openssl" ,openssl)))
398 `(("python-asn1crypto" ,python-asn1crypto)
399 ("python-cffi" ,python-cffi)
400 ("python-six" ,python-six)
401 ("python-idna" ,python-idna)
402 ("python-iso8601" ,python-iso8601)))
404 `(("python-cryptography-vectors" ,python-cryptography-vectors)
405 ("python-hypothesis" ,python-hypothesis)
406 ("python-pretend" ,python-pretend)
407 ("python-pytz" ,python-pytz)
408 ("python-pytest" ,python-pytest)))
409 (home-page "https://github.com/pyca/cryptography")
410 (synopsis "Cryptographic recipes and primitives for Python")
412 "cryptography is a package which provides cryptographic recipes and
413 primitives to Python developers. It aims to be the “cryptographic standard
414 library” for Python. The package includes both high level recipes, and low
415 level interfaces to common cryptographic algorithms such as symmetric ciphers,
416 message digests and key derivation functions.")
417 ;; Distributed under either BSD-3 or ASL2.0
418 (license (list license:bsd-3 license:asl2.0))
419 (properties `((python2-variant . ,(delay python2-cryptography))))))
421 (define-public python2-cryptography
422 (let ((crypto (package-with-python2
423 (strip-python2-variant python-cryptography))))
424 (package (inherit crypto)
426 `(("python2-ipaddress" ,python2-ipaddress)
427 ("python2-backport-ssl-match-hostname"
428 ,python2-backport-ssl-match-hostname)
429 ("python2-enum34" ,python2-enum34)
430 ,@(package-propagated-inputs crypto))))))
432 (define-public python-pyopenssl
434 (name "python-pyopenssl")
439 (uri (pypi-uri "pyOpenSSL" version))
442 "007j40y7x3k8xj54dy2qnij9lldfp71k9mkflhd9vqbdiwrndjmf"))))
443 (build-system python-build-system)
446 (modify-phases %standard-phases
448 (add-after 'install 'check
449 (lambda* (#:key inputs outputs #:allow-other-keys)
450 (add-installed-pythonpath inputs outputs)
451 (invoke "py.test" "-v" "-k"
453 ;; This test tries to look up certificates from
454 ;; the compiled-in default path in OpenSSL, which
455 ;; does not exist in the build environment.
456 "not test_fallback_default_verify_paths "
457 ;; This test attempts to make a connection to
458 ;; an external web service.
459 "and not test_set_default_verify_paths")))))))
461 `(("python-cryptography" ,python-cryptography)
462 ("python-six" ,python-six)))
464 `(("openssl" ,openssl)))
466 `(("python-flaky" ,python-flaky)
467 ("python-pretend" ,python-pretend)
468 ("python-pytest" ,python-pytest)))
469 (home-page "https://github.com/pyca/pyopenssl")
470 (synopsis "Python wrapper module around the OpenSSL library")
472 "PyOpenSSL is a high-level wrapper around a subset of the OpenSSL
474 (license license:asl2.0)))
476 (define-public python2-pyopenssl
477 (package-with-python2 python-pyopenssl))
479 (define-public python-ed25519
481 (name "python-ed25519")
486 (uri (pypi-uri "ed25519" version))
489 "0ahx1nkxa0xis3cw0h5c4fpgv8mq4znkq7kajly33lc3317bk499"))))
490 (build-system python-build-system)
491 (home-page "https://github.com/warner/python-ed25519")
492 (synopsis "Ed25519 public-key signatures")
493 (description "Ed25519 public-key signatures")
494 (license license:expat)))
496 (define-public python2-ed25519
497 (package-with-python2 python-ed25519))
499 (define-public python-axolotl-curve25519
501 (name "python-axolotl-curve25519")
507 (url "https://github.com/tgalal/python-axolotl-curve25519")
508 (commit "e4a9c4de0eae27223200579c58d1f8f6d20637e2")))
509 (file-name (string-append name "-" version "-checkout"))
512 "0agap5q0hmvf6cwzjqc05kw53pjgf6942pcivpazksmg1vk400ra"))))
513 (build-system python-build-system)
515 `(;; Prevent creation of the egg. This works around
516 ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20765
517 #:configure-flags '("--root=/")))
518 (home-page "https://github.com/tgalal/python-axolotl-curve25519")
519 (synopsis "Python wrapper for curve25519 library")
520 (description "This is a python wrapper for the curve25519 library
521 with ed25519 signatures. The C code was pulled from
522 libaxolotl-android. At the moment this wrapper is meant for use by
524 (license (list license:gpl3 ; Most files
525 license:bsd-3)))) ; curve/curve25519-donna.c
527 (define-public python2-axolotl-curve25519
528 (package-with-python2 python-axolotl-curve25519))
530 (define-public python-axolotl
532 (name "python-axolotl")
538 (url "https://github.com/tgalal/python-axolotl")
540 (file-name (git-file-name name version))
541 (patches (search-patches "python-axolotl-AES-fix.patch"))
543 (base32 "0xm9qgcwf6fq7rhzfcviwhbzcbj4i7wkxkab2z55fy1x82lya9g6"))))
544 (build-system python-build-system)
547 (modify-phases %standard-phases
548 ;; Don't install tests
549 (add-before 'install 'remove-tests
551 (for-each delete-file-recursively
552 '("axolotl/tests" "build/lib/axolotl/tests"))
555 `(("python-axolotl-curve25519" ,python-axolotl-curve25519)
556 ("python-dateutil" ,python-dateutil)
557 ("python-protobuf" ,python-protobuf)
558 ("python-pycrypto" ,python-pycrypto)))
559 (home-page "https://github.com/tgalal/python-axolotl")
560 (synopsis "Python port of libaxolotl-android")
561 (description "This is a python port of libaxolotl-android. This
562 is a ratcheting forward secrecy protocol that works in synchronous and
563 asynchronous messaging environments.")
564 (license license:gpl3)))
566 (define-public python2-axolotl
567 (package-with-python2 python-axolotl))
569 ;; SlowAES isn't compatible with Python 3.
570 (define-public python2-slowaes
572 (name "python2-slowaes")
577 (uri (pypi-uri "slowaes" version))
580 "02dzajm83a7lqgxf6r3hgj64wfmcxz8gs4nvgxpvj5n19kjqlrc3"))))
581 (build-system python-build-system)
582 (arguments `(#:python ,python-2))
583 (home-page "http://code.google.com/p/slowaes/")
584 (synopsis "Implementation of AES in Python")
585 (description "This package contains an implementation of AES in Python.
586 This implementation is slow (hence the project name) but still useful when
587 faster ones are not available.")
588 (license license:asl2.0)))
590 (define-public python-pyaes
592 (name "python-pyaes")
597 (uri (pypi-uri "pyaes" version))
600 "13vdaff15k0jyfcss4b4xvfgm8xyv0nrbyw5n1qc7lrqbi0b3h82"))))
601 (build-system python-build-system)
602 (home-page "https://github.com/ricmoo/pyaes")
603 (synopsis "Implementation of AES in Python")
604 (description "This package contains a pure-Python implementation of the
605 AES block cipher algorithm and the common modes of operation (CBC, CFB, CTR,
607 (license license:expat)))
609 (define-public python2-pyaes
610 (package-with-python2 python-pyaes))
612 (define-public python-asn1crypto
614 (name "python-asn1crypto")
620 (url "https://github.com/wbond/asn1crypto.git")
622 (file-name (git-file-name name version))
625 "10lai2cs5mnz3gpaffbw1m7b885ls8328q5wxm35vfmcip1f0xmb"))))
626 (build-system python-build-system)
627 (home-page "https://github.com/wbond/asn1crypto")
628 (synopsis "ASN.1 parser and serializer in Python")
629 (description "asn1crypto is an ASN.1 parser and serializer with definitions
630 for private keys, public keys, certificates, CRL, OCSP, CMS, PKCS#3, PKCS#7,
631 PKCS#8, PKCS#12, PKCS#5, X.509 and TSP.")
632 (license license:expat)))
634 (define-public python2-asn1crypto
635 (package-with-python2 python-asn1crypto))
637 (define-public python-pynacl
639 (name "python-pynacl")
644 (uri (pypi-uri "PyNaCl" version))
645 (modules '((guix build utils)))
646 ;; Remove bundled libsodium.
647 (snippet '(begin (delete-file-recursively "src/libsodium")
651 "0330wyvggm19xhmwmz9rrr97lzbv3siwfy50gmax3vvgs7nh0q8c"))))
652 (build-system python-build-system)
655 (modify-phases %standard-phases
656 (add-before 'build 'use-system-sodium
658 (setenv "SODIUM_INSTALL" "system")
661 `(("python-hypothesis" ,python-hypothesis)
662 ("python-pytest" ,python-pytest)))
664 `(("python-cffi" ,python-cffi)
665 ("python-six" ,python-six)
666 ("libsodium" ,libsodium)))
667 (home-page "https://github.com/pyca/pynacl/")
668 (synopsis "Python bindings to libsodium")
670 "PyNaCl is a Python binding to libsodium, which is a fork of the
671 Networking and Cryptography library. These libraries have a stated goal
672 of improving usability, security and speed.")
673 (license license:asl2.0)))
675 (define-public python2-pynacl
676 (package-with-python2 python-pynacl))
678 (define-public python2-pgpdump
680 (name "python2-pgpdump")
685 (uri (pypi-uri "pgpdump" version))
688 "0s4nh8h7qsdj2yf29bspjs1zvxd4lcd11r6g11dp7fppgf2h0iqw"))))
689 (build-system python-build-system)
691 ;; Currently fails to build with Python 3.
692 (arguments `(#:python ,python-2))
694 (home-page "https://github.com/toofishes/python-pgpdump")
695 (synopsis "Python library for parsing PGP packets")
697 "Python-pgpdump is an OpenPGP packet parser based on
698 @uref{http://www.mew.org/~kazu/proj/pgpdump/, pgpdump}. It notably supports:
701 @item signature packets;
702 @item public key packets;
703 @item secret key packets;
704 @item trust, user ID, and user attribute packets;
705 @item ASCII-armor decoding and CRC check.
707 (license license:bsd-3)))
709 (define-public python2-roca-detect
711 (name "python2-roca-detect")
716 (uri (pypi-uri "roca-detect" version))
719 "1di4akyw2lf5r8zfwvyhkilz8jv8g4b66rgaqwfabmjwma6gnw27"))))
720 (build-system python-build-system)
722 ;; TODO: apk_parse_ph4, pyjks
723 `(("python2-dateutil" ,python2-dateutil)
724 ("python2-six" ,python2-six)
725 ("python2-cryptography" ,python2-cryptography)
726 ("python2-future" ,python2-future)
727 ("python2-coloredlogs" ,python2-coloredlogs)
728 ("python2-pgpdump" ,python2-pgpdump)))
730 `(;; Basic testing routine is quite simple and works with Py3
731 ;; but the rest of the code that processes the different
732 ;; key formats and extracts the modulus for inspection is
733 ;; not yet fully py3 ready.
735 (home-page "https://github.com/crocs-muni/roca")
736 (synopsis "ROCA detection tool")
738 "This tool is related to the paper entitled @i{Return of the
739 Coppersmith’s Attack: Practical Factorization of Widely Used RSA Moduli}. It
740 enables you to test public RSA keys for a presence of the described
741 vulnerability. Currently the tool supports the following key formats: X.509
742 Certificate (DER encoded, PEM encoded), RSA PEM (encoded private key, public
743 key), SSH public key, ASC-encoded OpenPGP key, APK Android application, LDIFF
745 (license license:gpl3)))
747 (define-public python-ecpy
754 (uri (pypi-uri "ECPy" version))
757 "1gc3i5s93zq6x1nkaxkq1dvmsc12vmrw0hns9f5s1hcb78ni52c8"))))
758 (build-system python-build-system)
760 `(("python-future" ,python-future)))
761 (home-page "https://github.com/ubinity/ECPy")
762 (synopsis "Pure Python Elliptic Curve Library")
763 (description "This package provides a Elliptic Curve Library in pure
765 (license license:asl2.0)))
767 (define-public python2-ecpy
768 (package-with-python2 python-ecpy))
770 (define-public python-josepy
772 (name "python-josepy")
776 (uri (pypi-uri "josepy" version))
779 "11khz8malzrv375b27jjkv66z6z6khdx1v5mkkr4vq16gp3n4p7v"))))
780 (build-system python-build-system)
782 ;; The tests require flake8 >= 3.5, which is not yet packaged.
785 `(("python-cryptography" ,python-cryptography)
786 ("python-pyopenssl" ,python-pyopenssl)
787 ("python-six" ,python-six)))
788 ;; TODO Enable when we have flake8 >= 3.5.
790 ; `(("python-coverage" ,python-coverage)
791 ; ("python-flake8" ,python-flake8)
792 ; ("python-isort" ,python-isort)
793 ; ("python-mock" ,python-mock)
794 ; ("python-pytest" ,python-pytest)
795 ; ("python-pytest-cov" ,python-pytest-cov)
796 ; ("python-pytest-cache" ,python-pytest-cache)
797 ; ("python-pytest-flake8" ,python-pytest-flake8)))
798 (home-page "https://github.com/certbot/josepy")
799 (synopsis "JOSE protocol implementation in Python")
800 (description "This package provides a Python implementation of the JOSE
801 protocol (Javascript Object Signing and Encryption).")
802 (license license:asl2.0)))
804 (define-public python2-josepy
805 (package-with-python2 python-josepy))
807 (define-public python-pycryptodome
809 (name "python-pycryptodome")
814 (uri (pypi-uri "pycryptodome" version))
817 "0dh6ky5ngxayyn5f6n7gdamjl49g3khz6pdx9sdnag1zwi8248hs"))))
818 (build-system python-build-system)
819 (home-page "https://www.pycryptodome.org")
820 (synopsis "Cryptographic library for Python")
821 (description "This package provides a cryptographic library for Python.
823 It brings the following enhancements with respect to the last official version
827 @item Authenticated encryption modes (GCM, CCM, EAX, SIV, OCB)
828 @item Accelerated AES on Intel platforms via AES-NI
829 @item First class support for PyPy
830 @item Elliptic curves cryptography (NIST P-256 curve only)
831 @item Better and more compact API (nonce and iv attributes for ciphers,
832 automatic generation of random nonces and IVs, simplified CTR cipher mode, and
834 @item SHA-3 (including SHAKE XOFs) and BLAKE2 hash algorithms
835 @item Salsa20 and ChaCha20 stream ciphers
836 @item scrypt and HKDF
837 @item Deterministic (EC)DSA
838 @item Password-protected PKCS#8 key containers
839 @item Shamir’s Secret Sharing scheme
840 @item Random numbers get sourced directly from the OS (and not from a CSPRNG
842 @item Cleaner RSA and DSA key generation (largely based on FIPS 186-4)
843 @item Major clean ups and simplification of the code base
845 (license license:bsd-2)))
847 (define-public python2-pycryptodome
848 (package-with-python2 python-pycryptodome))
850 (define-public python-m2crypto
852 (name "python-m2crypto")
857 (uri (pypi-uri "M2Crypto" version))
859 (base32 "09yirf3w77w6f49q6nxhrjm9c3a4y9s30s1k09chqrw8zdgx8sjc"))))
860 (build-system python-build-system)
861 (inputs `(("openssl" ,openssl)))
862 (home-page "https://gitlab.com/m2crypto/m2crypto")
863 (synopsis "Python crypto and TLS toolkit")
864 (description "@code{M2Crypto} is a complete Python wrapper for OpenSSL
865 featuring RSA, DSA, DH, EC, HMACs, message digests, symmetric ciphers
866 (including AES); TLS functionality to implement clients and servers; HTTPS
867 extensions to Python's httplib, urllib, and xmlrpclib; unforgeable HMAC'ing
868 AuthCookies for web session management; FTP/TLS client and server; S/MIME;
869 M2Crypto can also be used to provide TLS for Twisted. Smartcards supported
870 through the Engine interface.")
871 (properties `((python2-variant . ,(delay python2-m2crypto))))
872 (license license:expat)))
874 (define-public python2-m2crypto
875 (let ((m2crypto (package-with-python2
876 (strip-python2-variant python-m2crypto))))
877 (package (inherit m2crypto)
879 `(("python2-typing" ,python2-typing))))))
881 (define-public python-pylibscrypt
883 (name "python-pylibscrypt")
888 (uri (pypi-uri "pylibscrypt" version))
891 "1b3rgzl6dbzs08vhv41b6y4n5189wv7lr27acxn104hs45745abs"))))
892 (build-system python-build-system)
895 (modify-phases %standard-phases
896 (add-before 'build 'hard-code-path-to-libscrypt
897 (lambda* (#:key inputs #:allow-other-keys)
898 (let ((libscrypt (assoc-ref inputs "libscrypt")))
899 (substitute* "pylibscrypt/pylibscrypt.py"
900 (("find_library\\('scrypt'\\)")
901 (string-append "'" libscrypt "/lib/libscrypt.so'")))
903 ;; The library can use various scrypt implementations and tests all of
904 ;; them. Since we only provide a single implementation, most tests
905 ;; fail. Simply skip them.
907 ;; FIXME: Using "libscrypt" is the second best choice. The best one
908 ;; requires "hashlib.scrypt", provided by Python 3.6+ built with OpenSSL
909 ;; 1.1+. Use that as soon as Guix provides it.
911 `(("libscrypt" ,libscrypt)))
912 (home-page "https://github.com/jvarho/pylibscrypt")
913 (synopsis "Scrypt for Python")
914 (description "There are a lot of different scrypt modules for Python, but
915 none of them have everything that I'd like, so here's one more. It uses
917 (license license:isc)))
919 (define-public python-libnacl
921 (name "python-libnacl")
926 (uri (pypi-uri "libnacl" version))
929 "0nv7n8nfswkhl614x5mllrkvaslraa0053q11iylb337cy43vb4v"))))
930 (build-system python-build-system)
933 (modify-phases %standard-phases
934 (add-after 'unpack 'locate-libsodium
935 (lambda* (#:key inputs #:allow-other-keys)
936 (substitute* "libnacl/__init__.py"
937 (("(return ctypes.cdll.LoadLibrary\\(')libsodium.so('\\))"
939 (let ((libsodium (string-append (assoc-ref inputs "libsodium")
940 "/lib/libsodium.so")))
941 (string-append pre libsodium post)))))))))
943 `(("python-pyhamcrest" ,python-pyhamcrest)))
945 `(("libsodium" ,libsodium)))
946 (home-page "https://libnacl.readthedocs.org/")
947 (synopsis "Python bindings for libsodium based on ctypes")
948 (description "@code{libnacl} is used to gain direct access to the
949 functions exposed by @code{NaCl} library via @code{libsodium}. It has
950 been constructed to maintain extensive documentation on how to use
951 @code{NaCl} as well as being completely portable.")
952 (license license:asl2.0)))
954 (define-public python-scrypt
956 (name "python-scrypt")
961 (uri (pypi-uri "scrypt" version))
964 "0hjk71k3mgnl8siikm9lii9im8kv0rb7inkjzx78rnancra48xxr"))))
965 (build-system python-build-system)
967 `(("openssl" ,openssl)))
968 (home-page "http://bitbucket.org/mhallin/py-scrypt")
969 (synopsis "Bindings for the scrypt key derivation function library")
970 (description "This is a set of Python bindings for the scrypt key
971 derivation function.")
972 (license license:bsd-2)))
974 (define-public python-service-identity
976 (name "python-service-identity")
981 (uri (pypi-uri "service_identity" version))
984 "0b9f5qiqjy8ralzgwjgkhx82h6h8sa7532psmb8mkd65md5aan08"))))
985 (build-system python-build-system)
987 `(("python-attrs" ,python-attrs)
988 ("python-pyasn1" ,python-pyasn1)
989 ("python-pyasn1-modules" ,python-pyasn1-modules)
990 ("python-pyopenssl" ,python-pyopenssl)))
991 (home-page "https://service-identity.readthedocs.io/")
992 (synopsis "Service identity verification for PyOpenSSL")
994 "@code{service_identity} aspires to give you all the tools you need
995 for verifying whether a certificate is valid for the intended purposes.
996 In the simplest case, this means host name verification. However,
997 service_identity implements RFC 6125 fully and plans to add other
999 (license license:expat)))
1001 (define-public python2-service-identity
1002 (package-with-python2 python-service-identity))
1004 (define-public python-hkdf
1006 (name "python-hkdf")
1011 (uri (pypi-uri "hkdf" version))
1014 "1jhxk5vhxmxxjp3zj526ry521v9inzzl8jqaaf0ma65w6k332ak2"))))
1015 (build-system python-build-system)
1017 `(("python-nose" ,python-nose)))
1018 (home-page "https://github.com/casebeer/python-hkdf")
1019 (synopsis "HMAC-based Extract-and-Expand Key Derivation Function (HKDF)")
1020 (description "This package provides a Python implementation of the HMAC Key
1021 Derivation function (HKDF) defined in RFC 5869.")
1022 (license license:bsd-2)))
1024 (define-public python-spake2
1026 (name "python-spake2")
1031 (uri (pypi-uri "spake2" version))
1034 "1x16r7lrbklvfzbacb66qv9iiih6liq1y612dqh2chgf555n2yn1"))))
1035 (build-system python-build-system)
1037 `(("python-hkdf" ,python-hkdf)))
1038 (home-page "https://github.com/warner/python-spake2")
1039 (synopsis "SPAKE2 password-authenticated key exchange in Python")
1040 (description "This package provides a Python implementation of the SPAKE2
1041 Password-Authenticated Key Exchange algorithm.")
1042 (license license:expat)))
1044 (define-public python-txtorcon
1046 (name "python-txtorcon")
1051 (uri (pypi-uri "txtorcon" version))
1054 "0fxzhsc62bhmr730vj9pzallmw56gz6iykvl28a5agrycm0bfc9p"))))
1055 (build-system python-build-system)
1057 ;; The tests fail immediately due to a missing file. Reported upstream:
1058 ;; <https://github.com/meejah/txtorcon/issues/330>
1061 `(("python-automat" ,python-automat)
1062 ("python-idna" ,python-idna)
1063 ("python-incremental" ,python-incremental)
1064 ("python-ipaddress" ,python-ipaddress)
1065 ("python-service-identity" ,python-service-identity)
1066 ("python-twisted" ,python-twisted)
1067 ("python-zope-interface" ,python-zope-interface)))
1068 (home-page "https://github.com/meejah/txtorcon")
1069 (synopsis "Twisted-based Tor controller client")
1070 (description "This package provides a Twisted-based Tor controller client,
1071 with state-tracking and configuration abstractions.")
1072 (license license:expat)))
1074 (define-public python-keyutils
1076 (name "python-keyutils")
1081 (uri (pypi-uri "keyutils" version))
1084 "0lipygpzhwzzsq2k5imb1jgkmj8y4khxdwhzadjs3bd56g6bmkx9"))))
1085 (build-system python-build-system)
1087 `(("python-pytest" ,python-pytest)
1088 ("python-pytest-runner" ,python-pytest-runner)))
1090 `(("keyutils" ,keyutils)))
1093 (home-page "https://github.com/sassoftware/python-keyutils")
1094 (synopsis "Python bindings for keyutils")
1096 "This is a set of python bindings for keyutils, a key management suite
1097 that leverages the infrastructure provided by the Linux kernel for safely
1098 storing and retrieving sensitive information in your programs.")
1099 (license license:asl2.0)))
1101 (define-public python-mcuboot-imgtool
1103 (name "python-mcuboot-imgtool")
1109 (url "https://github.com/JuulLabs-OSS/mcuboot")
1110 (commit (string-append "v" version))))
1111 (file-name (git-file-name name version))
1114 "1m1csyvzq4jx81zg635ssy1n7sc0z539z0myh872ll3nwqx7wa0q"))))
1115 (build-system python-build-system)
1118 (modify-phases %standard-phases
1119 (add-after 'unpack 'fix-broken-test
1121 (substitute* "scripts/imgtool/keys/ed25519_test.py"
1122 (("raw_sign") "sign_digest"))
1124 (add-before 'build 'change-directory
1129 `(("python-click" ,python-click)
1130 ("python-intelhex" ,python-intelhex)
1131 ("python-cryptography" ,python-cryptography)))
1132 (home-page "https://mcuboot.com")
1133 (synopsis "Tool to securely sign firmware images for booting by MCUboot")
1134 (description "MCUboot is a secure bootloader for 32-bit MCUs. This
1135 package provides a tool to securely sign firmware images for booting by
1137 (license license:expat)))