1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Eric Dvorsak <eric@dvorsak.fr>
3 ;;; Copyright © 2015, 2016, 2017, 2018, 2019 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>
23 ;;; This file is part of GNU Guix.
25 ;;; GNU Guix is free software; you can redistribute it and/or modify it
26 ;;; under the terms of the GNU General Public License as published by
27 ;;; the Free Software Foundation; either version 3 of the License, or (at
28 ;;; your option) any later version.
30 ;;; GNU Guix is distributed in the hope that it will be useful, but
31 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
32 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 ;;; GNU General Public License for more details.
35 ;;; You should have received a copy of the GNU General Public License
36 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
38 (define-module (gnu packages python-crypto)
39 #:use-module (guix packages)
40 #:use-module (guix download)
41 #:use-module (guix git-download)
42 #:use-module (guix build-system python)
43 #:use-module (gnu packages)
44 #:use-module (gnu packages check)
45 #:use-module (gnu packages crypto)
46 #:use-module (gnu packages libffi)
47 #:use-module (gnu packages multiprecision)
48 #:use-module (gnu packages protobuf)
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages python-web)
51 #:use-module (gnu packages python-xyz)
52 #:use-module (gnu packages time)
53 #:use-module (gnu packages tls)
54 #:use-module ((guix licenses) #:prefix license:)
55 #:use-module (srfi srfi-1))
57 (define-public python-base58
59 (name "python-base58")
64 (uri (pypi-uri "base58" version))
67 "0q1yr0n5jaf17xq98m7dma6z4rh8p19ch55l1s09gi3rk5ckqycs"))))
68 (build-system python-build-system)
70 `(("python-pyhamcrest" ,python-pyhamcrest)))
71 (home-page "https://github.com/keis/base58")
72 (synopsis "Base58 and Base58Check implementation")
73 (description "Base58 and Base58Check implementation compatible
74 with what is used by the Bitcoin network.")
75 (license license:expat)))
77 (define-public python-bcrypt
79 (name "python-bcrypt")
84 (uri (pypi-uri "bcrypt" version))
87 "1sh2xh0iragdq8dhssc1cdd02nppjq7b5kmv0qladfi2s9cnfqs4"))))
88 (build-system python-build-system)
90 `(("python-pycparser" ,python-pycparser)
91 ("python-pytest" ,python-pytest)))
93 `(("python-cffi" ,python-cffi)
94 ("python-six" ,python-six)))
95 (home-page "https://github.com/pyca/bcrypt/")
97 "Modern password hashing library")
99 "Bcrypt is a Python module which provides a password hashing method based
100 on the Blowfish password hashing algorithm, as described in
101 @url{http://static.usenix.org/events/usenix99/provos.html,\"A Future-Adaptable
102 Password Scheme\"} by Niels Provos and David Mazieres.")
103 (license license:asl2.0)))
105 (define-public python2-bcrypt
106 (package-with-python2 python-bcrypt))
108 (define-public python-passlib
110 (name "python-passlib")
115 (uri (pypi-uri "passlib" version))
118 "1q2khqpj9rlcgdmkypjdq1kswvhjf72bq0zk2cv669cc2dj8z51x"))))
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")
132 "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 parametised, 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))
243 "1yj31j0asmrx4an9xvsaj2icdmzy6pw0glfpqrrkrphwdpi1xkv4"))))
244 (build-system python-build-system)
246 `(("openssl" ,openssl)))
248 "https://github.com/warner/python-ecdsa")
250 "ECDSA cryptographic signature library (pure python)")
252 "This is an easy-to-use implementation of ECDSA cryptography (Elliptic
253 Curve Digital Signature Algorithm), implemented purely in Python. With this
254 library, you can quickly create keypairs (signing key and verifying key), sign
255 messages, and verify the signatures. The keys and signatures are very short,
256 making them easy to handle and incorporate into other protocols.")
257 (license license:expat)))
259 (define-public python2-ecdsa
260 (package-with-python2 python-ecdsa))
262 ;;; Pycrypto is abandoned upstream:
264 ;;; https://github.com/dlitz/pycrypto/issues/173
266 ;;; TODO Remove this package from GNU Guix.
267 (define-public python-pycrypto
269 (name "python-pycrypto")
274 (uri (pypi-uri "pycrypto" version))
275 (patches (search-patches "python-pycrypto-CVE-2013-7459.patch"))
278 "0g0ayql5b9mkjam8hym6zyg6bv77lbh66rv1fyvgqb17kfc1xkpj"))))
279 (build-system python-build-system)
285 (modify-phases %standard-phases
286 (add-before 'build 'set-build-env
287 ;; pycrypto runs an autoconf configure script behind the scenes
288 (lambda _ (setenv "CONFIG_SHELL" (which "bash")) #t)))))
289 (home-page "http://www.pycrypto.org/")
290 (synopsis "Cryptographic modules for Python")
292 "Pycrypto is a collection of both secure hash functions (such as SHA256
293 and RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal,
294 etc.). The package is structured to make adding new modules easy.")
295 (license license:public-domain)))
297 (define-public python2-pycrypto
298 (let ((pycrypto (package-with-python2 python-pycrypto)))
299 (package (inherit pycrypto)
301 `(("python" ,python-2)
304 (package-inputs pycrypto)))))))
306 (define-public python-keyring
308 (name "python-keyring")
313 (uri (pypi-uri "keyring" version))
316 "0482rmi2x6p78wl2kz8qzyq21xz1sbbfwnv5x7dggar4vkwxhzfx"))))
317 (build-system python-build-system)
319 `(("python-pytest" ,python-pytest)
320 ("python-pytest-runner" ,python-pytest-runner)
321 ("python-setuptools-scm" ,python-setuptools-scm)))
323 `(("python-pycrypto" ,python-pycrypto)))
324 (home-page "https://github.com/jaraco/keyring")
325 (synopsis "Store and access your passwords safely")
327 "The Python keyring lib provides a easy way to access the system keyring
328 service from python. It can be used in any application that needs safe
330 ;; "MIT" and PSF dual license
331 (license license:x11)))
333 (define-public python2-keyring
334 (package-with-python2 python-keyring))
336 (define-public python-certifi
338 (name "python-certifi")
342 (uri (pypi-uri "certifi" version))
345 "1bnpw7hrf9i1l9gfxjnzi45hkrvzz0pyn9ia8m4mw7sxhgb08qdj"))))
346 (build-system python-build-system)
347 (home-page "https://certifi.io/")
348 (synopsis "Python CA certificate bundle")
350 "Certifi is a Python library that contains a CA certificate bundle, which
351 is used by the Requests library to verify HTTPS requests.")
352 (license license:asl2.0)))
354 (define-public python2-certifi
355 (package-with-python2 python-certifi))
357 (define-public python-cryptography-vectors
359 (name "python-cryptography-vectors")
364 (uri (pypi-uri "cryptography_vectors" version))
367 "1g38zw90510azyfrj6mxbslx2gp9yrnv5dac0w2819k9ssdznbgi"))))
368 (build-system python-build-system)
369 (home-page "https://github.com/pyca/cryptography")
370 (synopsis "Test vectors for the cryptography package")
372 "This package contains test vectors for the cryptography package.")
373 ;; Distributed under either BSD-3 or ASL2.0
374 (license (list license:bsd-3 license:asl2.0))))
376 (define-public python2-cryptography-vectors
377 (package-with-python2 python-cryptography-vectors))
379 (define-public python-cryptography
381 (name "python-cryptography")
386 (uri (pypi-uri "cryptography" version))
389 "1inlnr36kl36551c9rcad99jmhk81v33by3glkadwdcgmi17fd76"))))
390 (build-system python-build-system)
392 `(("openssl" ,openssl)))
394 `(("python-asn1crypto" ,python-asn1crypto)
395 ("python-cffi" ,python-cffi)
396 ("python-six" ,python-six)
397 ("python-idna" ,python-idna)
398 ("python-iso8601" ,python-iso8601)))
400 `(("python-cryptography-vectors" ,python-cryptography-vectors)
401 ("python-hypothesis" ,python-hypothesis)
402 ("python-pretend" ,python-pretend)
403 ("python-pytz" ,python-pytz)
404 ("python-pytest" ,python-pytest)))
405 (home-page "https://github.com/pyca/cryptography")
406 (synopsis "Cryptographic recipes and primitives for Python")
408 "cryptography is a package which provides cryptographic recipes and
409 primitives to Python developers. It aims to be the “cryptographic standard
410 library” for Python. The package includes both high level recipes, and low
411 level interfaces to common cryptographic algorithms such as symmetric ciphers,
412 message digests and key derivation functions.")
413 ;; Distributed under either BSD-3 or ASL2.0
414 (license (list license:bsd-3 license:asl2.0))
415 (properties `((python2-variant . ,(delay python2-cryptography))))))
417 (define-public python2-cryptography
418 (let ((crypto (package-with-python2
419 (strip-python2-variant python-cryptography))))
420 (package (inherit crypto)
422 `(("python2-ipaddress" ,python2-ipaddress)
423 ("python2-backport-ssl-match-hostname"
424 ,python2-backport-ssl-match-hostname)
425 ("python2-enum34" ,python2-enum34)
426 ,@(package-propagated-inputs crypto))))))
428 (define-public python-pyopenssl
430 (name "python-pyopenssl")
435 (uri (pypi-uri "pyOpenSSL" version))
438 "007j40y7x3k8xj54dy2qnij9lldfp71k9mkflhd9vqbdiwrndjmf"))))
439 (build-system python-build-system)
442 (modify-phases %standard-phases
444 (add-after 'install 'check
445 (lambda* (#:key inputs outputs #:allow-other-keys)
446 (add-installed-pythonpath inputs outputs)
447 (invoke "py.test" "-v" "-k"
449 ;; This test tries to look up certificates from
450 ;; the compiled-in default path in OpenSSL, which
451 ;; does not exist in the build environment.
452 "not test_fallback_default_verify_paths "
453 ;; This test attempts to make a connection to
454 ;; an external web service.
455 "and not test_set_default_verify_paths")))))))
457 `(("python-cryptography" ,python-cryptography)
458 ("python-six" ,python-six)))
460 `(("openssl" ,openssl)))
462 `(("python-flaky" ,python-flaky)
463 ("python-pretend" ,python-pretend)
464 ("python-pytest" ,python-pytest)))
465 (home-page "https://github.com/pyca/pyopenssl")
466 (synopsis "Python wrapper module around the OpenSSL library")
468 "PyOpenSSL is a high-level wrapper around a subset of the OpenSSL
470 (license license:asl2.0)))
472 (define-public python2-pyopenssl
473 (package-with-python2 python-pyopenssl))
475 (define-public python-ed25519
477 (name "python-ed25519")
482 (uri (pypi-uri "ed25519" version))
485 "0ahx1nkxa0xis3cw0h5c4fpgv8mq4znkq7kajly33lc3317bk499"))))
486 (build-system python-build-system)
487 (home-page "https://github.com/warner/python-ed25519")
488 (synopsis "Ed25519 public-key signatures")
489 (description "Ed25519 public-key signatures")
490 (license license:expat)))
492 (define-public python2-ed25519
493 (package-with-python2 python-ed25519))
495 (define-public python-axolotl-curve25519
497 (name "python-axolotl-curve25519")
503 (url "https://github.com/tgalal/python-axolotl-curve25519")
504 (commit "e4a9c4de0eae27223200579c58d1f8f6d20637e2")))
505 (file-name (string-append name "-" version "-checkout"))
508 "0agap5q0hmvf6cwzjqc05kw53pjgf6942pcivpazksmg1vk400ra"))))
509 (build-system python-build-system)
511 `(;; Prevent creation of the egg. This works around
512 ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20765
513 #:configure-flags '("--root=/")))
514 (home-page "https://github.com/tgalal/python-axolotl-curve25519")
515 (synopsis "Python wrapper for curve25519 library")
516 (description "This is a python wrapper for the curve25519 library
517 with ed25519 signatures. The C code was pulled from
518 libaxolotl-android. At the moment this wrapper is meant for use by
520 (license (list license:gpl3 ; Most files
521 license:bsd-3)))) ; curve/curve25519-donna.c
523 (define-public python2-axolotl-curve25519
524 (package-with-python2 python-axolotl-curve25519))
526 (define-public python-axolotl
528 (name "python-axolotl")
534 "https://github.com/tgalal/python-axolotl/archive/"
536 (file-name (string-append name "-" version ".tar.gz"))
537 (patches (search-patches "python-axolotl-AES-fix.patch"))
539 (base32 "0badsgkgz0ir3hqynxzsfjgacppi874syvvmgccc6j164053x6zm"))))
540 (build-system python-build-system)
543 (modify-phases %standard-phases
544 ;; Don't install tests
545 (add-before 'install 'remove-tests
547 (for-each delete-file-recursively
548 '("axolotl/tests" "build/lib/axolotl/tests"))
551 `(("python-axolotl-curve25519" ,python-axolotl-curve25519)
552 ("python-dateutil" ,python-dateutil)
553 ("python-protobuf" ,python-protobuf)
554 ("python-pycrypto" ,python-pycrypto)))
555 (home-page "https://github.com/tgalal/python-axolotl")
556 (synopsis "Python port of libaxolotl-android")
557 (description "This is a python port of libaxolotl-android. This
558 is a ratcheting forward secrecy protocol that works in synchronous and
559 asynchronous messaging environments.")
560 (license license:gpl3)))
562 (define-public python2-axolotl
563 (package-with-python2 python-axolotl))
565 ;; SlowAES isn't compatible with Python 3.
566 (define-public python2-slowaes
568 (name "python2-slowaes")
573 (uri (pypi-uri "slowaes" version))
576 "02dzajm83a7lqgxf6r3hgj64wfmcxz8gs4nvgxpvj5n19kjqlrc3"))))
577 (build-system python-build-system)
578 (arguments `(#:python ,python-2))
579 (home-page "http://code.google.com/p/slowaes/")
580 (synopsis "Implementation of AES in Python")
581 (description "This package contains an implementation of AES in Python.
582 This implementation is slow (hence the project name) but still useful when
583 faster ones are not available.")
584 (license license:asl2.0)))
586 (define-public python-pyaes
588 (name "python-pyaes")
593 (uri (pypi-uri "pyaes" version))
596 "13vdaff15k0jyfcss4b4xvfgm8xyv0nrbyw5n1qc7lrqbi0b3h82"))))
597 (build-system python-build-system)
598 (home-page "https://github.com/ricmoo/pyaes")
599 (synopsis "Implementation of AES in Python")
600 (description "This package contains a pure-Python implementation of the
601 AES block cipher algorithm and the common modes of operation (CBC, CFB, CTR,
603 (license license:expat)))
605 (define-public python2-pyaes
606 (package-with-python2 python-pyaes))
608 (define-public python-asn1crypto
610 (name "python-asn1crypto")
616 (url "https://github.com/wbond/asn1crypto.git")
618 (file-name (git-file-name name version))
621 "10lai2cs5mnz3gpaffbw1m7b885ls8328q5wxm35vfmcip1f0xmb"))))
622 (build-system python-build-system)
623 (home-page "https://github.com/wbond/asn1crypto")
624 (synopsis "ASN.1 parser and serializer in Python")
625 (description "asn1crypto is an ASN.1 parser and serializer with definitions
626 for private keys, public keys, certificates, CRL, OCSP, CMS, PKCS#3, PKCS#7,
627 PKCS#8, PKCS#12, PKCS#5, X.509 and TSP.")
628 (license license:expat)))
630 (define-public python2-asn1crypto
631 (package-with-python2 python-asn1crypto))
633 (define-public python-pynacl
635 (name "python-pynacl")
640 (uri (pypi-uri "PyNaCl" version))
641 (modules '((guix build utils)))
642 ;; Remove bundled libsodium.
643 (snippet '(begin (delete-file-recursively "src/libsodium")
647 "0330wyvggm19xhmwmz9rrr97lzbv3siwfy50gmax3vvgs7nh0q8c"))))
648 (build-system python-build-system)
651 (modify-phases %standard-phases
652 (add-before 'build 'use-system-sodium
654 (setenv "SODIUM_INSTALL" "system")
657 `(("python-hypothesis" ,python-hypothesis)
658 ("python-pytest" ,python-pytest)))
660 `(("python-cffi" ,python-cffi)
661 ("python-six" ,python-six)
662 ("libsodium" ,libsodium)))
663 (home-page "https://github.com/pyca/pynacl/")
664 (synopsis "Python bindings to libsodium")
666 "PyNaCl is a Python binding to libsodium, which is a fork of the
667 Networking and Cryptography library. These libraries have a stated goal
668 of improving usability, security and speed.")
669 (license license:asl2.0)))
671 (define-public python2-pynacl
672 (package-with-python2 python-pynacl))
674 (define-public python2-pgpdump
676 (name "python2-pgpdump")
681 (uri (pypi-uri "pgpdump" version))
684 "0s4nh8h7qsdj2yf29bspjs1zvxd4lcd11r6g11dp7fppgf2h0iqw"))))
685 (build-system python-build-system)
687 ;; Currently fails to build with Python 3.
688 (arguments `(#:python ,python-2))
690 (home-page "https://github.com/toofishes/python-pgpdump")
691 (synopsis "Python library for parsing PGP packets")
693 "Python-pgpdump is an OpenPGP packet parser based on
694 @uref{http://www.mew.org/~kazu/proj/pgpdump/, pgpdump}. It notably supports:
697 @item signature packets;
698 @item public key packets;
699 @item secret key packets;
700 @item trust, user ID, and user attribute packets;
701 @item ASCII-armor decoding and CRC check.
703 (license license:bsd-3)))
705 (define-public python2-roca-detect
707 (name "python2-roca-detect")
712 (uri (pypi-uri "roca-detect" version))
715 "1di4akyw2lf5r8zfwvyhkilz8jv8g4b66rgaqwfabmjwma6gnw27"))))
716 (build-system python-build-system)
718 ;; TODO: apk_parse_ph4, pyjks
719 `(("python2-dateutil" ,python2-dateutil)
720 ("python2-six" ,python2-six)
721 ("python2-cryptography" ,python2-cryptography)
722 ("python2-future" ,python2-future)
723 ("python2-coloredlogs" ,python2-coloredlogs)
724 ("python2-pgpdump" ,python2-pgpdump)))
726 `(;; Basic testing routine is quite simple and works with Py3
727 ;; but the rest of the code that processes the different
728 ;; key formats and extracts the modulus for inspection is
729 ;; not yet fully py3 ready.
731 (home-page "https://github.com/crocs-muni/roca")
732 (synopsis "ROCA detection tool")
734 "This tool is related to the paper entitled @i{Return of the
735 Coppersmith’s Attack: Practical Factorization of Widely Used RSA Moduli}. It
736 enables you to test public RSA keys for a presence of the described
737 vulnerability. Currently the tool supports the following key formats: X.509
738 Certificate (DER encoded, PEM encoded), RSA PEM (encoded private key, public
739 key), SSH public key, ASC-encoded OpenPGP key, APK Android application, LDIFF
741 (license license:gpl3)))
743 (define-public python-ecpy
750 (uri (pypi-uri "ECPy" version))
753 "1gc3i5s93zq6x1nkaxkq1dvmsc12vmrw0hns9f5s1hcb78ni52c8"))))
754 (build-system python-build-system)
756 `(("python-future" ,python-future)))
757 (home-page "https://github.com/ubinity/ECPy")
758 (synopsis "Pure Python Elliptic Curve Library")
759 (description "This package provides a Elliptic Curve Library in pure
761 (license license:asl2.0)))
763 (define-public python2-ecpy
764 (package-with-python2 python-ecpy))
766 (define-public python-josepy
768 (name "python-josepy")
772 (uri (pypi-uri "josepy" version))
775 "11khz8malzrv375b27jjkv66z6z6khdx1v5mkkr4vq16gp3n4p7v"))))
776 (build-system python-build-system)
778 ;; The tests require flake8 >= 3.5, which is not yet packaged.
781 `(("python-cryptography" ,python-cryptography)
782 ("python-pyopenssl" ,python-pyopenssl)
783 ("python-six" ,python-six)))
784 ;; TODO Enable when we have flake8 >= 3.5.
786 ; `(("python-coverage" ,python-coverage)
787 ; ("python-flake8" ,python-flake8)
788 ; ("python-isort" ,python-isort)
789 ; ("python-mock" ,python-mock)
790 ; ("python-pytest" ,python-pytest)
791 ; ("python-pytest-cov" ,python-pytest-cov)
792 ; ("python-pytest-cache" ,python-pytest-cache)
793 ; ("python-pytest-flake8" ,python-pytest-flake8)))
794 (home-page "https://github.com/certbot/josepy")
795 (synopsis "JOSE protocol implementation in Python")
796 (description "This package provides a Python implementation of the JOSE
797 protocol (Javascript Object Signing and Encryption).")
798 (license license:asl2.0)))
800 (define-public python2-josepy
801 (package-with-python2 python-josepy))
803 (define-public python-pycryptodome
805 (name "python-pycryptodome")
810 (uri (pypi-uri "pycryptodome" version))
813 "0dh6ky5ngxayyn5f6n7gdamjl49g3khz6pdx9sdnag1zwi8248hs"))))
814 (build-system python-build-system)
815 (home-page "https://www.pycryptodome.org")
816 (synopsis "Cryptographic library for Python")
817 (description "This package provides a cryptographic library for Python.
819 It brings the following enhancements with respect to the last official version
823 @item Authenticated encryption modes (GCM, CCM, EAX, SIV, OCB)
824 @item Accelerated AES on Intel platforms via AES-NI
825 @item First class support for PyPy
826 @item Elliptic curves cryptography (NIST P-256 curve only)
827 @item Better and more compact API (nonce and iv attributes for ciphers,
828 automatic generation of random nonces and IVs, simplified CTR cipher mode, and
830 @item SHA-3 (including SHAKE XOFs) and BLAKE2 hash algorithms
831 @item Salsa20 and ChaCha20 stream ciphers
832 @item scrypt and HKDF
833 @item Deterministic (EC)DSA
834 @item Password-protected PKCS#8 key containers
835 @item Shamir’s Secret Sharing scheme
836 @item Random numbers get sourced directly from the OS (and not from a CSPRNG
838 @item Cleaner RSA and DSA key generation (largely based on FIPS 186-4)
839 @item Major clean ups and simplification of the code base
841 (license license:bsd-2)))
843 (define-public python2-pycryptodome
844 (package-with-python2 python-pycryptodome))
846 (define-public python-m2crypto
848 (name "python-m2crypto")
853 (uri (pypi-uri "M2Crypto" version))
855 (base32 "1iizrpkn4c2n70nvcjqlmnk6fz3vddkrjmwavz1zlsnwv8f7bcm1"))))
856 (build-system python-build-system)
857 (inputs `(("openssl" ,openssl)))
858 (home-page "https://gitlab.com/m2crypto/m2crypto")
859 (synopsis "Python crypto and TLS toolkit")
860 (description "@code{M2Crypto} is a complete Python wrapper for OpenSSL
861 featuring RSA, DSA, DH, EC, HMACs, message digests, symmetric ciphers
862 (including AES); TLS functionality to implement clients and servers; HTTPS
863 extensions to Python's httplib, urllib, and xmlrpclib; unforgeable HMAC'ing
864 AuthCookies for web session management; FTP/TLS client and server; S/MIME;
865 M2Crypto can also be used to provide TLS for Twisted. Smartcards supported
866 through the Engine interface.")
867 (properties `((python2-variant . ,(delay python2-m2crypto))))
868 (license license:expat)))
870 (define-public python2-m2crypto
871 (let ((m2crypto (package-with-python2
872 (strip-python2-variant python-m2crypto))))
873 (package (inherit m2crypto)
875 `(("python2-typing" ,python2-typing))))))
877 (define-public python-pylibscrypt
879 (name "python-pylibscrypt")
884 (uri (pypi-uri "pylibscrypt" version))
887 "1b3rgzl6dbzs08vhv41b6y4n5189wv7lr27acxn104hs45745abs"))))
888 (build-system python-build-system)
891 (modify-phases %standard-phases
892 (add-before 'build 'hard-code-path-to-libscrypt
893 (lambda* (#:key inputs #:allow-other-keys)
894 (let ((libscrypt (assoc-ref inputs "libscrypt")))
895 (substitute* "pylibscrypt/pylibscrypt.py"
896 (("find_library\\('scrypt'\\)")
897 (string-append "'" libscrypt "/lib/libscrypt.so'")))
899 ;; The library can use various scrypt implementations and tests all of
900 ;; them. Since we only provide a single implementation, most tests
901 ;; fail. Simply skip them.
903 ;; FIXME: Using "libscrypt" is the second best choice. The best one
904 ;; requires "hashlib.scrypt", provided by Python 3.6+ built with OpenSSL
905 ;; 1.1+. Use that as soon as Guix provides it.
907 `(("libscrypt" ,libscrypt)))
908 (home-page "https://github.com/jvarho/pylibscrypt")
909 (synopsis "Scrypt for Python")
910 (description "There are a lot of different scrypt modules for Python, but
911 none of them have everything that I'd like, so here's one more. It uses
913 (license license:isc)))
915 (define-public python-libnacl
917 (name "python-libnacl")
922 (uri (pypi-uri "libnacl" version))
925 "0nv7n8nfswkhl614x5mllrkvaslraa0053q11iylb337cy43vb4v"))))
926 (build-system python-build-system)
929 (modify-phases %standard-phases
930 (add-after 'unpack 'locate-libsodium
931 (lambda* (#:key inputs #:allow-other-keys)
932 (substitute* "libnacl/__init__.py"
933 (("(return ctypes.cdll.LoadLibrary\\(')libsodium.so('\\))"
935 (let ((libsodium (string-append (assoc-ref inputs "libsodium")
936 "/lib/libsodium.so")))
937 (string-append pre libsodium post)))))))))
939 `(("python-pyhamcrest" ,python-pyhamcrest)))
941 `(("libsodium" ,libsodium)))
942 (home-page "https://libnacl.readthedocs.org/")
943 (synopsis "Python bindings for libsodium based on ctypes")
944 (description "@code{libnacl} is used to gain direct access to the
945 functions exposed by @code{NaCl} library via @code{libsodium}. It has
946 been constructed to maintain extensive documentation on how to use
947 @code{NaCl} as well as being completely portable.")
948 (license license:asl2.0)))
950 (define-public python-scrypt
952 (name "python-scrypt")
957 (uri (pypi-uri "scrypt" version))
960 "0hjk71k3mgnl8siikm9lii9im8kv0rb7inkjzx78rnancra48xxr"))))
961 (build-system python-build-system)
963 `(("openssl" ,openssl)))
964 (home-page "http://bitbucket.org/mhallin/py-scrypt")
965 (synopsis "Bindings for the scrypt key derivation function library")
966 (description "This is a set of Python bindings for the scrypt key
967 derivation function.")
968 (license license:bsd-2)))
970 (define-public python-service-identity
972 (name "python-service-identity")
977 (uri (pypi-uri "service_identity" version))
980 "0b9f5qiqjy8ralzgwjgkhx82h6h8sa7532psmb8mkd65md5aan08"))))
981 (build-system python-build-system)
983 `(("python-attrs" ,python-attrs)
984 ("python-pyasn1" ,python-pyasn1)
985 ("python-pyasn1-modules" ,python-pyasn1-modules)
986 ("python-pyopenssl" ,python-pyopenssl)))
987 (home-page "https://service-identity.readthedocs.io/")
988 (synopsis "Service identity verification for PyOpenSSL")
990 "@code{service_identity} aspires to give you all the tools you need
991 for verifying whether a certificate is valid for the intended purposes.
992 In the simplest case, this means host name verification. However,
993 service_identity implements RFC 6125 fully and plans to add other
995 (license license:expat)))
997 (define-public python2-service-identity
998 (package-with-python2 python-service-identity))
1000 (define-public python-hkdf
1002 (name "python-hkdf")
1007 (uri (pypi-uri "hkdf" version))
1010 "1jhxk5vhxmxxjp3zj526ry521v9inzzl8jqaaf0ma65w6k332ak2"))))
1011 (build-system python-build-system)
1013 `(("python-nose" ,python-nose)))
1014 (home-page "https://github.com/casebeer/python-hkdf")
1015 (synopsis "HMAC-based Extract-and-Expand Key Derivation Function (HKDF)")
1016 (description "This package provides a Python implementation of the HMAC Key
1017 Derivation function (HKDF) defined in RFC 5869.")
1018 (license license:bsd-2)))
1020 (define-public python-spake2
1022 (name "python-spake2")
1027 (uri (pypi-uri "spake2" version))
1030 "1x16r7lrbklvfzbacb66qv9iiih6liq1y612dqh2chgf555n2yn1"))))
1031 (build-system python-build-system)
1033 `(("python-hkdf" ,python-hkdf)))
1034 (home-page "https://github.com/warner/python-spake2")
1035 (synopsis "SPAKE2 password-authenticated key exchange in Python")
1036 (description "This package provides a Python implementation of the SPAKE2
1037 Password-Authenticated Key Exchange algorithm.")
1038 (license license:expat)))
1040 (define-public python-txtorcon
1042 (name "python-txtorcon")
1047 (uri (pypi-uri "txtorcon" version))
1050 "0fxzhsc62bhmr730vj9pzallmw56gz6iykvl28a5agrycm0bfc9p"))))
1051 (build-system python-build-system)
1053 ;; The tests fail immediately due to a missing file. Reported upstream:
1054 ;; <https://github.com/meejah/txtorcon/issues/330>
1057 `(("python-automat" ,python-automat)
1058 ("python-idna" ,python-idna)
1059 ("python-incremental" ,python-incremental)
1060 ("python-ipaddress" ,python-ipaddress)
1061 ("python-service-identity" ,python-service-identity)
1062 ("python-twisted" ,python-twisted)
1063 ("python-zope-interface" ,python-zope-interface)))
1064 (home-page "https://github.com/meejah/txtorcon")
1065 (synopsis "Twisted-based Tor controller client")
1066 (description "This package provides a Twisted-based Tor controller client,
1067 with state-tracking and configuration abstractions.")
1068 (license license:expat)))