gnu: brlaser: Update to 6.
[jackhill/guix/guix.git] / gnu / packages / python-crypto.scm
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>
22 ;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
23 ;;; Copyright © 2019 Clément Lassieur <clement@lassieur.org>
24 ;;;
25 ;;; This file is part of GNU Guix.
26 ;;;
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.
31 ;;;
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.
36 ;;;
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/>.
39
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))
58
59 (define-public python-base58
60 (package
61 (name "python-base58")
62 (version "1.0.3")
63 (source
64 (origin
65 (method url-fetch)
66 (uri (pypi-uri "base58" version))
67 (sha256
68 (base32
69 "0q1yr0n5jaf17xq98m7dma6z4rh8p19ch55l1s09gi3rk5ckqycs"))))
70 (build-system python-build-system)
71 (native-inputs
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)))
78
79 (define-public python-bcrypt
80 (package
81 (name "python-bcrypt")
82 (version "3.1.7")
83 (source
84 (origin
85 (method url-fetch)
86 (uri (pypi-uri "bcrypt" version))
87 (sha256
88 (base32 "0hhywhxx301cxivgxrpslrangbfpccc8y83qbwn1f57cab3nj00b"))))
89 (build-system python-build-system)
90 (native-inputs
91 `(("python-pycparser" ,python-pycparser)
92 ("python-pytest" ,python-pytest)))
93 (propagated-inputs
94 `(("python-cffi" ,python-cffi)
95 ("python-six" ,python-six)))
96 (home-page "https://github.com/pyca/bcrypt/")
97 (synopsis
98 "Modern password hashing library")
99 (description
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)))
105
106 (define-public python2-bcrypt
107 (package-with-python2 python-bcrypt))
108
109 (define-public python-passlib
110 (package
111 (name "python-passlib")
112 (version "1.7.1")
113 (source
114 (origin
115 (method url-fetch)
116 (uri (pypi-uri "passlib" version))
117 (sha256
118 (base32
119 "1q2khqpj9rlcgdmkypjdq1kswvhjf72bq0zk2cv669cc2dj8z51x"))))
120 (build-system python-build-system)
121 (native-inputs
122 `(("python-nose" ,python-nose)))
123 (propagated-inputs
124 `(("python-py-bcrypt" ,python-py-bcrypt)))
125 (arguments
126 `(#:phases
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
133 "Comprehensive password hashing framework")
134 (description
135 "Passlib is a password hashing library for Python 2 & 3, which provides
136 cross-platform implementations of over 30 password hashing algorithms, as well
137 as a framework for managing existing password hashes. It's designed to be
138 useful for a wide range of tasks, from verifying a hash found in /etc/shadow,
139 to providing full-strength password hashing for multi-user application.")
140 (license license:bsd-3)))
141
142 (define-public python2-passlib
143 (package-with-python2 python-passlib))
144
145 (define-public python-py-bcrypt
146 (package
147 (name "python-py-bcrypt")
148 (version "0.4")
149 (source
150 (origin
151 (method url-fetch)
152 (uri (pypi-uri "py-bcrypt" version))
153 (sha256
154 (base32
155 "0y6smdggwi5s72v6p1nn53dg6w05hna3d264cq6kas0lap73p8az"))))
156 (build-system python-build-system)
157 (home-page "https://code.google.com/p/py-bcrypt")
158 (synopsis
159 "Bcrypt password hashing and key derivation")
160 (description
161 "A python wrapper of OpenBSD's Blowfish password hashing code. This
162 system hashes passwords using a version of Bruce Schneier's Blowfish block
163 cipher with modifications designed to raise the cost of off-line password
164 cracking and frustrate fast hardware implementation. The computation cost of
165 the algorithm is parametrised, so it can be increased as computers get faster.
166 The intent is to make a compromise of a password database less likely to
167 result in an attacker gaining knowledge of the plaintext passwords (e.g. using
168 John the Ripper).")
169 ;; "sha2.c" is under BSD-3;
170 ;; "blowfish.c" and "bcrypt.c" are under BSD-4;
171 ;; the rest is under ISC.
172 (license (list license:isc license:bsd-3 license:bsd-4))))
173
174 (define-public python2-py-bcrypt
175 (package-with-python2 python-py-bcrypt))
176
177 (define-public python-pyblake2
178 (package
179 (name "python-pyblake2")
180 (version "1.1.2")
181 (source
182 (origin
183 (method url-fetch)
184 (uri (pypi-uri "pyblake2" version))
185 (sha256
186 (base32
187 "0gz9hgznv5zw4qjq43xa56y0yikimx30gffvibxzm0nv5sq7xk2w"))))
188 (build-system python-build-system)
189 (home-page "https://github.com/dchest/pyblake2")
190 (synopsis "BLAKE2 hash function for Python")
191 (description "BLAKE2 is a cryptographic hash function, which offers
192 stronger security while being as fast as MD5 or SHA-1, and comes in two
193 flavors: @code{BLAKE2b}, optimized for 64-bit platforms and produces digests
194 of any size between 1 and 64 bytes, and @code{BLAKE2s}, optimized for 8- to
195 32-bit platforms and produces digests of any size between 1 and 32 bytes.
196
197 This package provides a Python interface for BLAKE2.")
198 ;; The COPYING file declares it as public domain, with the option to
199 ;; alternatively use and redistribute it under a variety of permissive
200 ;; licenses. cc0 is explicitly mentioned in setup.py and pyblake2module.c.
201 (license (list license:public-domain license:cc0))))
202
203 (define-public python-paramiko
204 (package
205 (name "python-paramiko")
206 (version "2.4.2")
207 (source
208 (origin
209 (method url-fetch)
210 (uri (pypi-uri "paramiko" version))
211 (sha256
212 (base32
213 "1jqgj2gl1pz7bi2aab1r2xq0ml0gskmm9p235cg9y32nydymm5x8"))))
214 (build-system python-build-system)
215 (arguments
216 `(;; FIXME: Tests require many unpackaged libraries, see dev-requirements.txt.
217 #:tests? #f))
218 (propagated-inputs
219 `(("python-bcrypt" ,python-bcrypt)
220 ("python-pyasn1" ,python-pyasn1)
221 ("python-pynacl" ,python-pynacl)
222 ("python-cryptography" ,python-cryptography)))
223 (home-page "https://www.paramiko.org/")
224 (synopsis "SSHv2 protocol library")
225 (description "Paramiko is a python implementation of the SSHv2 protocol,
226 providing both client and server functionality. While it leverages a Python C
227 extension for low level cryptography (PyCrypto), Paramiko itself is a pure
228 Python interface around SSH networking concepts.")
229 (license license:lgpl2.1+)))
230
231 (define-public python2-paramiko
232 (package-with-python2 python-paramiko))
233
234 (define-public python-ecdsa
235 (package
236 (name "python-ecdsa")
237 (version "0.13.3")
238 (source
239 (origin
240 (method url-fetch)
241 (uri (pypi-uri "ecdsa" version))
242 (sha256
243 (base32 "0k9xxklf865g6x43gkfarwb25ffrkmpvkzkh71rylqx7cjq80g0n"))))
244 (build-system python-build-system)
245 (inputs
246 `(("openssl" ,openssl)))
247 (home-page "https://github.com/warner/python-ecdsa")
248 (synopsis "ECDSA cryptographic signature library (pure python)")
249 (description
250 "This is an easy-to-use implementation of ECDSA cryptography (Elliptic
251 Curve Digital Signature Algorithm), implemented purely in Python. With this
252 library, you can quickly create keypairs (signing key and verifying key), sign
253 messages, and verify the signatures. The keys and signatures are very short,
254 making them easy to handle and incorporate into other protocols.")
255 (license license:expat)))
256
257 (define-public python2-ecdsa
258 (package-with-python2 python-ecdsa))
259
260 ;;; Pycrypto is abandoned upstream:
261 ;;;
262 ;;; https://github.com/dlitz/pycrypto/issues/173
263 ;;;
264 ;;; TODO Remove this package from GNU Guix.
265 (define-public python-pycrypto
266 (package
267 (name "python-pycrypto")
268 (version "2.6.1")
269 (source
270 (origin
271 (method url-fetch)
272 (uri (pypi-uri "pycrypto" version))
273 (patches (search-patches "python-pycrypto-CVE-2013-7459.patch"))
274 (sha256
275 (base32
276 "0g0ayql5b9mkjam8hym6zyg6bv77lbh66rv1fyvgqb17kfc1xkpj"))))
277 (build-system python-build-system)
278 (inputs
279 `(("python" ,python)
280 ("gmp" ,gmp)))
281 (arguments
282 `(#:phases
283 (modify-phases %standard-phases
284 (add-before 'build 'set-build-env
285 ;; pycrypto runs an autoconf configure script behind the scenes
286 (lambda _ (setenv "CONFIG_SHELL" (which "bash")) #t)))))
287 (home-page "http://www.pycrypto.org/")
288 (synopsis "Cryptographic modules for Python")
289 (description
290 "Pycrypto is a collection of both secure hash functions (such as SHA256
291 and RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal,
292 etc.). The package is structured to make adding new modules easy.")
293 (license license:public-domain)))
294
295 (define-public python2-pycrypto
296 (let ((pycrypto (package-with-python2 python-pycrypto)))
297 (package (inherit pycrypto)
298 (inputs
299 `(("python" ,python-2)
300 ,@(alist-delete
301 "python"
302 (package-inputs pycrypto)))))))
303
304 (define-public python-keyring
305 (package
306 (name "python-keyring")
307 (version "8.7")
308 (source
309 (origin
310 (method url-fetch)
311 (uri (pypi-uri "keyring" version))
312 (sha256
313 (base32
314 "0482rmi2x6p78wl2kz8qzyq21xz1sbbfwnv5x7dggar4vkwxhzfx"))))
315 (build-system python-build-system)
316 (native-inputs
317 `(("python-pytest" ,python-pytest)
318 ("python-pytest-runner" ,python-pytest-runner)
319 ("python-setuptools-scm" ,python-setuptools-scm)))
320 (propagated-inputs
321 `(("python-pycrypto" ,python-pycrypto)))
322 (home-page "https://github.com/jaraco/keyring")
323 (synopsis "Store and access your passwords safely")
324 (description
325 "The Python keyring lib provides a easy way to access the system keyring
326 service from python. It can be used in any application that needs safe
327 password storage.")
328 ;; "MIT" and PSF dual license
329 (license license:x11)))
330
331 (define-public python2-keyring
332 (package-with-python2 python-keyring))
333
334 (define-public python-certifi
335 (package
336 (name "python-certifi")
337 (version "2019.3.9")
338 (source (origin
339 (method url-fetch)
340 (uri (pypi-uri "certifi" version))
341 (sha256
342 (base32
343 "1bnpw7hrf9i1l9gfxjnzi45hkrvzz0pyn9ia8m4mw7sxhgb08qdj"))))
344 (build-system python-build-system)
345 (home-page "https://certifi.io/")
346 (synopsis "Python CA certificate bundle")
347 (description
348 "Certifi is a Python library that contains a CA certificate bundle, which
349 is used by the Requests library to verify HTTPS requests.")
350 (license license:asl2.0)))
351
352 (define-public python2-certifi
353 (package-with-python2 python-certifi))
354
355 (define-public python-cryptography-vectors
356 (package
357 (name "python-cryptography-vectors")
358 (version "2.7")
359 (source
360 (origin
361 (method url-fetch)
362 (uri (pypi-uri "cryptography_vectors" version))
363 (sha256
364 (base32
365 "1g38zw90510azyfrj6mxbslx2gp9yrnv5dac0w2819k9ssdznbgi"))))
366 (build-system python-build-system)
367 (home-page "https://github.com/pyca/cryptography")
368 (synopsis "Test vectors for the cryptography package")
369 (description
370 "This package contains test vectors for the cryptography package.")
371 ;; Distributed under either BSD-3 or ASL2.0
372 (license (list license:bsd-3 license:asl2.0))))
373
374 (define-public python2-cryptography-vectors
375 (package-with-python2 python-cryptography-vectors))
376
377 (define-public python-cryptography
378 (package
379 (name "python-cryptography")
380 (version "2.7")
381 (source
382 (origin
383 (method url-fetch)
384 (uri (pypi-uri "cryptography" version))
385 (sha256
386 (base32
387 "1inlnr36kl36551c9rcad99jmhk81v33by3glkadwdcgmi17fd76"))))
388 (build-system python-build-system)
389 (inputs
390 `(("openssl" ,openssl)))
391 (propagated-inputs
392 `(("python-asn1crypto" ,python-asn1crypto)
393 ("python-cffi" ,python-cffi)
394 ("python-six" ,python-six)
395 ("python-idna" ,python-idna)
396 ("python-iso8601" ,python-iso8601)))
397 (native-inputs
398 `(("python-cryptography-vectors" ,python-cryptography-vectors)
399 ("python-hypothesis" ,python-hypothesis)
400 ("python-pretend" ,python-pretend)
401 ("python-pytz" ,python-pytz)
402 ("python-pytest" ,python-pytest)))
403 (home-page "https://github.com/pyca/cryptography")
404 (synopsis "Cryptographic recipes and primitives for Python")
405 (description
406 "cryptography is a package which provides cryptographic recipes and
407 primitives to Python developers. It aims to be the “cryptographic standard
408 library” for Python. The package includes both high level recipes, and low
409 level interfaces to common cryptographic algorithms such as symmetric ciphers,
410 message digests and key derivation functions.")
411 ;; Distributed under either BSD-3 or ASL2.0
412 (license (list license:bsd-3 license:asl2.0))
413 (properties `((python2-variant . ,(delay python2-cryptography))))))
414
415 (define-public python2-cryptography
416 (let ((crypto (package-with-python2
417 (strip-python2-variant python-cryptography))))
418 (package (inherit crypto)
419 (propagated-inputs
420 `(("python2-ipaddress" ,python2-ipaddress)
421 ("python2-backport-ssl-match-hostname"
422 ,python2-backport-ssl-match-hostname)
423 ("python2-enum34" ,python2-enum34)
424 ,@(package-propagated-inputs crypto))))))
425
426 (define-public python-pyopenssl
427 (package
428 (name "python-pyopenssl")
429 (version "19.0.0")
430 (source
431 (origin
432 (method url-fetch)
433 (uri (pypi-uri "pyOpenSSL" version))
434 (sha256
435 (base32
436 "007j40y7x3k8xj54dy2qnij9lldfp71k9mkflhd9vqbdiwrndjmf"))))
437 (build-system python-build-system)
438 (arguments
439 '(#:phases
440 (modify-phases %standard-phases
441 (delete 'check)
442 (add-after 'install 'check
443 (lambda* (#:key inputs outputs #:allow-other-keys)
444 (add-installed-pythonpath inputs outputs)
445 (invoke "py.test" "-v" "-k"
446 (string-append
447 ;; This test tries to look up certificates from
448 ;; the compiled-in default path in OpenSSL, which
449 ;; does not exist in the build environment.
450 "not test_fallback_default_verify_paths "
451 ;; This test attempts to make a connection to
452 ;; an external web service.
453 "and not test_set_default_verify_paths")))))))
454 (propagated-inputs
455 `(("python-cryptography" ,python-cryptography)
456 ("python-six" ,python-six)))
457 (inputs
458 `(("openssl" ,openssl)))
459 (native-inputs
460 `(("python-flaky" ,python-flaky)
461 ("python-pretend" ,python-pretend)
462 ("python-pytest" ,python-pytest)))
463 (home-page "https://github.com/pyca/pyopenssl")
464 (synopsis "Python wrapper module around the OpenSSL library")
465 (description
466 "PyOpenSSL is a high-level wrapper around a subset of the OpenSSL
467 library.")
468 (license license:asl2.0)))
469
470 (define-public python2-pyopenssl
471 (package-with-python2 python-pyopenssl))
472
473 (define-public python-ed25519
474 (package
475 (name "python-ed25519")
476 (version "1.4")
477 (source
478 (origin
479 (method url-fetch)
480 (uri (pypi-uri "ed25519" version))
481 (sha256
482 (base32
483 "0ahx1nkxa0xis3cw0h5c4fpgv8mq4znkq7kajly33lc3317bk499"))))
484 (build-system python-build-system)
485 (home-page "https://github.com/warner/python-ed25519")
486 (synopsis "Ed25519 public-key signatures")
487 (description "Ed25519 public-key signatures")
488 (license license:expat)))
489
490 (define-public python2-ed25519
491 (package-with-python2 python-ed25519))
492
493 (define-public python-axolotl-curve25519
494 (package
495 (name "python-axolotl-curve25519")
496 (version "0.1")
497 (source
498 (origin
499 (method git-fetch)
500 (uri (git-reference
501 (url "https://github.com/tgalal/python-axolotl-curve25519")
502 (commit "e4a9c4de0eae27223200579c58d1f8f6d20637e2")))
503 (file-name (string-append name "-" version "-checkout"))
504 (sha256
505 (base32
506 "0agap5q0hmvf6cwzjqc05kw53pjgf6942pcivpazksmg1vk400ra"))))
507 (build-system python-build-system)
508 (arguments
509 `(;; Prevent creation of the egg. This works around
510 ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20765
511 #:configure-flags '("--root=/")))
512 (home-page "https://github.com/tgalal/python-axolotl-curve25519")
513 (synopsis "Python wrapper for curve25519 library")
514 (description "This is a python wrapper for the curve25519 library
515 with ed25519 signatures. The C code was pulled from
516 libaxolotl-android. At the moment this wrapper is meant for use by
517 python-axolotl.")
518 (license (list license:gpl3 ; Most files
519 license:bsd-3)))) ; curve/curve25519-donna.c
520
521 (define-public python2-axolotl-curve25519
522 (package-with-python2 python-axolotl-curve25519))
523
524 (define-public python-axolotl
525 (package
526 (name "python-axolotl")
527 (version "0.1.39")
528 (source
529 (origin
530 (method url-fetch)
531 (uri (string-append
532 "https://github.com/tgalal/python-axolotl/archive/"
533 version ".tar.gz"))
534 (file-name (string-append name "-" version ".tar.gz"))
535 (patches (search-patches "python-axolotl-AES-fix.patch"))
536 (sha256
537 (base32 "0badsgkgz0ir3hqynxzsfjgacppi874syvvmgccc6j164053x6zm"))))
538 (build-system python-build-system)
539 (arguments
540 `(#:phases
541 (modify-phases %standard-phases
542 ;; Don't install tests
543 (add-before 'install 'remove-tests
544 (lambda _
545 (for-each delete-file-recursively
546 '("axolotl/tests" "build/lib/axolotl/tests"))
547 #t)))))
548 (propagated-inputs
549 `(("python-axolotl-curve25519" ,python-axolotl-curve25519)
550 ("python-dateutil" ,python-dateutil)
551 ("python-protobuf" ,python-protobuf)
552 ("python-pycrypto" ,python-pycrypto)))
553 (home-page "https://github.com/tgalal/python-axolotl")
554 (synopsis "Python port of libaxolotl-android")
555 (description "This is a python port of libaxolotl-android. This
556 is a ratcheting forward secrecy protocol that works in synchronous and
557 asynchronous messaging environments.")
558 (license license:gpl3)))
559
560 (define-public python2-axolotl
561 (package-with-python2 python-axolotl))
562
563 ;; SlowAES isn't compatible with Python 3.
564 (define-public python2-slowaes
565 (package
566 (name "python2-slowaes")
567 (version "0.1a1")
568 (source
569 (origin
570 (method url-fetch)
571 (uri (pypi-uri "slowaes" version))
572 (sha256
573 (base32
574 "02dzajm83a7lqgxf6r3hgj64wfmcxz8gs4nvgxpvj5n19kjqlrc3"))))
575 (build-system python-build-system)
576 (arguments `(#:python ,python-2))
577 (home-page "http://code.google.com/p/slowaes/")
578 (synopsis "Implementation of AES in Python")
579 (description "This package contains an implementation of AES in Python.
580 This implementation is slow (hence the project name) but still useful when
581 faster ones are not available.")
582 (license license:asl2.0)))
583
584 (define-public python-pyaes
585 (package
586 (name "python-pyaes")
587 (version "1.6.1")
588 (source
589 (origin
590 (method url-fetch)
591 (uri (pypi-uri "pyaes" version))
592 (sha256
593 (base32
594 "13vdaff15k0jyfcss4b4xvfgm8xyv0nrbyw5n1qc7lrqbi0b3h82"))))
595 (build-system python-build-system)
596 (home-page "https://github.com/ricmoo/pyaes")
597 (synopsis "Implementation of AES in Python")
598 (description "This package contains a pure-Python implementation of the
599 AES block cipher algorithm and the common modes of operation (CBC, CFB, CTR,
600 ECB and OFB).")
601 (license license:expat)))
602
603 (define-public python2-pyaes
604 (package-with-python2 python-pyaes))
605
606 (define-public python-asn1crypto
607 (package
608 (name "python-asn1crypto")
609 (version "0.24.0")
610 (source
611 (origin
612 (method git-fetch)
613 (uri (git-reference
614 (url "https://github.com/wbond/asn1crypto.git")
615 (commit version)))
616 (file-name (git-file-name name version))
617 (sha256
618 (base32
619 "10lai2cs5mnz3gpaffbw1m7b885ls8328q5wxm35vfmcip1f0xmb"))))
620 (build-system python-build-system)
621 (home-page "https://github.com/wbond/asn1crypto")
622 (synopsis "ASN.1 parser and serializer in Python")
623 (description "asn1crypto is an ASN.1 parser and serializer with definitions
624 for private keys, public keys, certificates, CRL, OCSP, CMS, PKCS#3, PKCS#7,
625 PKCS#8, PKCS#12, PKCS#5, X.509 and TSP.")
626 (license license:expat)))
627
628 (define-public python2-asn1crypto
629 (package-with-python2 python-asn1crypto))
630
631 (define-public python-pynacl
632 (package
633 (name "python-pynacl")
634 (version "1.3.0")
635 (source
636 (origin
637 (method url-fetch)
638 (uri (pypi-uri "PyNaCl" version))
639 (modules '((guix build utils)))
640 ;; Remove bundled libsodium.
641 (snippet '(begin (delete-file-recursively "src/libsodium")
642 #t))
643 (sha256
644 (base32
645 "0330wyvggm19xhmwmz9rrr97lzbv3siwfy50gmax3vvgs7nh0q8c"))))
646 (build-system python-build-system)
647 (arguments
648 `(#:phases
649 (modify-phases %standard-phases
650 (add-before 'build 'use-system-sodium
651 (lambda _
652 (setenv "SODIUM_INSTALL" "system")
653 #t)))))
654 (native-inputs
655 `(("python-hypothesis" ,python-hypothesis)
656 ("python-pytest" ,python-pytest)))
657 (propagated-inputs
658 `(("python-cffi" ,python-cffi)
659 ("python-six" ,python-six)
660 ("libsodium" ,libsodium)))
661 (home-page "https://github.com/pyca/pynacl/")
662 (synopsis "Python bindings to libsodium")
663 (description
664 "PyNaCl is a Python binding to libsodium, which is a fork of the
665 Networking and Cryptography library. These libraries have a stated goal
666 of improving usability, security and speed.")
667 (license license:asl2.0)))
668
669 (define-public python2-pynacl
670 (package-with-python2 python-pynacl))
671
672 (define-public python2-pgpdump
673 (package
674 (name "python2-pgpdump")
675 (version "1.5")
676 (source
677 (origin
678 (method url-fetch)
679 (uri (pypi-uri "pgpdump" version))
680 (sha256
681 (base32
682 "0s4nh8h7qsdj2yf29bspjs1zvxd4lcd11r6g11dp7fppgf2h0iqw"))))
683 (build-system python-build-system)
684
685 ;; Currently fails to build with Python 3.
686 (arguments `(#:python ,python-2))
687
688 (home-page "https://github.com/toofishes/python-pgpdump")
689 (synopsis "Python library for parsing PGP packets")
690 (description
691 "Python-pgpdump is an OpenPGP packet parser based on
692 @uref{http://www.mew.org/~kazu/proj/pgpdump/, pgpdump}. It notably supports:
693
694 @itemize
695 @item signature packets;
696 @item public key packets;
697 @item secret key packets;
698 @item trust, user ID, and user attribute packets;
699 @item ASCII-armor decoding and CRC check.
700 @end itemize\n")
701 (license license:bsd-3)))
702
703 (define-public python2-roca-detect
704 (package
705 (name "python2-roca-detect")
706 (version "1.0.8")
707 (source
708 (origin
709 (method url-fetch)
710 (uri (pypi-uri "roca-detect" version))
711 (sha256
712 (base32
713 "1di4akyw2lf5r8zfwvyhkilz8jv8g4b66rgaqwfabmjwma6gnw27"))))
714 (build-system python-build-system)
715 (native-inputs
716 ;; TODO: apk_parse_ph4, pyjks
717 `(("python2-dateutil" ,python2-dateutil)
718 ("python2-six" ,python2-six)
719 ("python2-cryptography" ,python2-cryptography)
720 ("python2-future" ,python2-future)
721 ("python2-coloredlogs" ,python2-coloredlogs)
722 ("python2-pgpdump" ,python2-pgpdump)))
723 (arguments
724 `(;; Basic testing routine is quite simple and works with Py3
725 ;; but the rest of the code that processes the different
726 ;; key formats and extracts the modulus for inspection is
727 ;; not yet fully py3 ready.
728 #:python ,python-2))
729 (home-page "https://github.com/crocs-muni/roca")
730 (synopsis "ROCA detection tool")
731 (description
732 "This tool is related to the paper entitled @i{Return of the
733 Coppersmith’s Attack: Practical Factorization of Widely Used RSA Moduli}. It
734 enables you to test public RSA keys for a presence of the described
735 vulnerability. Currently the tool supports the following key formats: X.509
736 Certificate (DER encoded, PEM encoded), RSA PEM (encoded private key, public
737 key), SSH public key, ASC-encoded OpenPGP key, APK Android application, LDIFF
738 file, and more.")
739 (license license:gpl3)))
740
741 (define-public python-ecpy
742 (package
743 (name "python-ecpy")
744 (version "0.10.0")
745 (source
746 (origin
747 (method url-fetch)
748 (uri (pypi-uri "ECPy" version))
749 (sha256
750 (base32
751 "1gc3i5s93zq6x1nkaxkq1dvmsc12vmrw0hns9f5s1hcb78ni52c8"))))
752 (build-system python-build-system)
753 (propagated-inputs
754 `(("python-future" ,python-future)))
755 (home-page "https://github.com/ubinity/ECPy")
756 (synopsis "Pure Python Elliptic Curve Library")
757 (description "This package provides a Elliptic Curve Library in pure
758 Python.")
759 (license license:asl2.0)))
760
761 (define-public python2-ecpy
762 (package-with-python2 python-ecpy))
763
764 (define-public python-josepy
765 (package
766 (name "python-josepy")
767 (version "1.1.0")
768 (source (origin
769 (method url-fetch)
770 (uri (pypi-uri "josepy" version))
771 (sha256
772 (base32
773 "11khz8malzrv375b27jjkv66z6z6khdx1v5mkkr4vq16gp3n4p7v"))))
774 (build-system python-build-system)
775 (arguments
776 ;; The tests require flake8 >= 3.5, which is not yet packaged.
777 '(#:tests? #f))
778 (propagated-inputs
779 `(("python-cryptography" ,python-cryptography)
780 ("python-pyopenssl" ,python-pyopenssl)
781 ("python-six" ,python-six)))
782 ;; TODO Enable when we have flake8 >= 3.5.
783 ; (native-inputs
784 ; `(("python-coverage" ,python-coverage)
785 ; ("python-flake8" ,python-flake8)
786 ; ("python-isort" ,python-isort)
787 ; ("python-mock" ,python-mock)
788 ; ("python-pytest" ,python-pytest)
789 ; ("python-pytest-cov" ,python-pytest-cov)
790 ; ("python-pytest-cache" ,python-pytest-cache)
791 ; ("python-pytest-flake8" ,python-pytest-flake8)))
792 (home-page "https://github.com/certbot/josepy")
793 (synopsis "JOSE protocol implementation in Python")
794 (description "This package provides a Python implementation of the JOSE
795 protocol (Javascript Object Signing and Encryption).")
796 (license license:asl2.0)))
797
798 (define-public python2-josepy
799 (package-with-python2 python-josepy))
800
801 (define-public python-pycryptodome
802 (package
803 (name "python-pycryptodome")
804 (version "3.7.3")
805 (source
806 (origin
807 (method url-fetch)
808 (uri (pypi-uri "pycryptodome" version))
809 (sha256
810 (base32
811 "0dh6ky5ngxayyn5f6n7gdamjl49g3khz6pdx9sdnag1zwi8248hs"))))
812 (build-system python-build-system)
813 (home-page "https://www.pycryptodome.org")
814 (synopsis "Cryptographic library for Python")
815 (description "This package provides a cryptographic library for Python.
816
817 It brings the following enhancements with respect to the last official version
818 of PyCrypto:
819
820 @itemize
821 @item Authenticated encryption modes (GCM, CCM, EAX, SIV, OCB)
822 @item Accelerated AES on Intel platforms via AES-NI
823 @item First class support for PyPy
824 @item Elliptic curves cryptography (NIST P-256 curve only)
825 @item Better and more compact API (nonce and iv attributes for ciphers,
826 automatic generation of random nonces and IVs, simplified CTR cipher mode, and
827 more)
828 @item SHA-3 (including SHAKE XOFs) and BLAKE2 hash algorithms
829 @item Salsa20 and ChaCha20 stream ciphers
830 @item scrypt and HKDF
831 @item Deterministic (EC)DSA
832 @item Password-protected PKCS#8 key containers
833 @item Shamir’s Secret Sharing scheme
834 @item Random numbers get sourced directly from the OS (and not from a CSPRNG
835 in userspace)
836 @item Cleaner RSA and DSA key generation (largely based on FIPS 186-4)
837 @item Major clean ups and simplification of the code base
838 @end itemize\n")
839 (license license:bsd-2)))
840
841 (define-public python2-pycryptodome
842 (package-with-python2 python-pycryptodome))
843
844 (define-public python-m2crypto
845 (package
846 (name "python-m2crypto")
847 (version "0.35.2")
848 (source
849 (origin
850 (method url-fetch)
851 (uri (pypi-uri "M2Crypto" version))
852 (sha256
853 (base32 "09yirf3w77w6f49q6nxhrjm9c3a4y9s30s1k09chqrw8zdgx8sjc"))))
854 (build-system python-build-system)
855 (inputs `(("openssl" ,openssl)))
856 (home-page "https://gitlab.com/m2crypto/m2crypto")
857 (synopsis "Python crypto and TLS toolkit")
858 (description "@code{M2Crypto} is a complete Python wrapper for OpenSSL
859 featuring RSA, DSA, DH, EC, HMACs, message digests, symmetric ciphers
860 (including AES); TLS functionality to implement clients and servers; HTTPS
861 extensions to Python's httplib, urllib, and xmlrpclib; unforgeable HMAC'ing
862 AuthCookies for web session management; FTP/TLS client and server; S/MIME;
863 M2Crypto can also be used to provide TLS for Twisted. Smartcards supported
864 through the Engine interface.")
865 (properties `((python2-variant . ,(delay python2-m2crypto))))
866 (license license:expat)))
867
868 (define-public python2-m2crypto
869 (let ((m2crypto (package-with-python2
870 (strip-python2-variant python-m2crypto))))
871 (package (inherit m2crypto)
872 (propagated-inputs
873 `(("python2-typing" ,python2-typing))))))
874
875 (define-public python-pylibscrypt
876 (package
877 (name "python-pylibscrypt")
878 (version "1.7.1")
879 (source
880 (origin
881 (method url-fetch)
882 (uri (pypi-uri "pylibscrypt" version))
883 (sha256
884 (base32
885 "1b3rgzl6dbzs08vhv41b6y4n5189wv7lr27acxn104hs45745abs"))))
886 (build-system python-build-system)
887 (arguments
888 `(#:phases
889 (modify-phases %standard-phases
890 (add-before 'build 'hard-code-path-to-libscrypt
891 (lambda* (#:key inputs #:allow-other-keys)
892 (let ((libscrypt (assoc-ref inputs "libscrypt")))
893 (substitute* "pylibscrypt/pylibscrypt.py"
894 (("find_library\\('scrypt'\\)")
895 (string-append "'" libscrypt "/lib/libscrypt.so'")))
896 #t))))
897 ;; The library can use various scrypt implementations and tests all of
898 ;; them. Since we only provide a single implementation, most tests
899 ;; fail. Simply skip them.
900 #:tests? #f))
901 ;; FIXME: Using "libscrypt" is the second best choice. The best one
902 ;; requires "hashlib.scrypt", provided by Python 3.6+ built with OpenSSL
903 ;; 1.1+. Use that as soon as Guix provides it.
904 (inputs
905 `(("libscrypt" ,libscrypt)))
906 (home-page "https://github.com/jvarho/pylibscrypt")
907 (synopsis "Scrypt for Python")
908 (description "There are a lot of different scrypt modules for Python, but
909 none of them have everything that I'd like, so here's one more. It uses
910 @code{libscrypt}.")
911 (license license:isc)))
912
913 (define-public python-libnacl
914 (package
915 (name "python-libnacl")
916 (version "1.6.1")
917 (source
918 (origin
919 (method url-fetch)
920 (uri (pypi-uri "libnacl" version))
921 (sha256
922 (base32
923 "0nv7n8nfswkhl614x5mllrkvaslraa0053q11iylb337cy43vb4v"))))
924 (build-system python-build-system)
925 (arguments
926 `(#:phases
927 (modify-phases %standard-phases
928 (add-after 'unpack 'locate-libsodium
929 (lambda* (#:key inputs #:allow-other-keys)
930 (substitute* "libnacl/__init__.py"
931 (("(return ctypes.cdll.LoadLibrary\\(')libsodium.so('\\))"
932 _ pre post)
933 (let ((libsodium (string-append (assoc-ref inputs "libsodium")
934 "/lib/libsodium.so")))
935 (string-append pre libsodium post)))))))))
936 (native-inputs
937 `(("python-pyhamcrest" ,python-pyhamcrest)))
938 (inputs
939 `(("libsodium" ,libsodium)))
940 (home-page "https://libnacl.readthedocs.org/")
941 (synopsis "Python bindings for libsodium based on ctypes")
942 (description "@code{libnacl} is used to gain direct access to the
943 functions exposed by @code{NaCl} library via @code{libsodium}. It has
944 been constructed to maintain extensive documentation on how to use
945 @code{NaCl} as well as being completely portable.")
946 (license license:asl2.0)))
947
948 (define-public python-scrypt
949 (package
950 (name "python-scrypt")
951 (version "0.8.7")
952 (source
953 (origin
954 (method url-fetch)
955 (uri (pypi-uri "scrypt" version))
956 (sha256
957 (base32
958 "0hjk71k3mgnl8siikm9lii9im8kv0rb7inkjzx78rnancra48xxr"))))
959 (build-system python-build-system)
960 (inputs
961 `(("openssl" ,openssl)))
962 (home-page "http://bitbucket.org/mhallin/py-scrypt")
963 (synopsis "Bindings for the scrypt key derivation function library")
964 (description "This is a set of Python bindings for the scrypt key
965 derivation function.")
966 (license license:bsd-2)))
967
968 (define-public python-service-identity
969 (package
970 (name "python-service-identity")
971 (version "18.1.0")
972 (source
973 (origin
974 (method url-fetch)
975 (uri (pypi-uri "service_identity" version))
976 (sha256
977 (base32
978 "0b9f5qiqjy8ralzgwjgkhx82h6h8sa7532psmb8mkd65md5aan08"))))
979 (build-system python-build-system)
980 (propagated-inputs
981 `(("python-attrs" ,python-attrs)
982 ("python-pyasn1" ,python-pyasn1)
983 ("python-pyasn1-modules" ,python-pyasn1-modules)
984 ("python-pyopenssl" ,python-pyopenssl)))
985 (home-page "https://service-identity.readthedocs.io/")
986 (synopsis "Service identity verification for PyOpenSSL")
987 (description
988 "@code{service_identity} aspires to give you all the tools you need
989 for verifying whether a certificate is valid for the intended purposes.
990 In the simplest case, this means host name verification. However,
991 service_identity implements RFC 6125 fully and plans to add other
992 relevant RFCs too.")
993 (license license:expat)))
994
995 (define-public python2-service-identity
996 (package-with-python2 python-service-identity))
997
998 (define-public python-hkdf
999 (package
1000 (name "python-hkdf")
1001 (version "0.0.3")
1002 (source
1003 (origin
1004 (method url-fetch)
1005 (uri (pypi-uri "hkdf" version))
1006 (sha256
1007 (base32
1008 "1jhxk5vhxmxxjp3zj526ry521v9inzzl8jqaaf0ma65w6k332ak2"))))
1009 (build-system python-build-system)
1010 (native-inputs
1011 `(("python-nose" ,python-nose)))
1012 (home-page "https://github.com/casebeer/python-hkdf")
1013 (synopsis "HMAC-based Extract-and-Expand Key Derivation Function (HKDF)")
1014 (description "This package provides a Python implementation of the HMAC Key
1015 Derivation function (HKDF) defined in RFC 5869.")
1016 (license license:bsd-2)))
1017
1018 (define-public python-spake2
1019 (package
1020 (name "python-spake2")
1021 (version "0.8")
1022 (source
1023 (origin
1024 (method url-fetch)
1025 (uri (pypi-uri "spake2" version))
1026 (sha256
1027 (base32
1028 "1x16r7lrbklvfzbacb66qv9iiih6liq1y612dqh2chgf555n2yn1"))))
1029 (build-system python-build-system)
1030 (propagated-inputs
1031 `(("python-hkdf" ,python-hkdf)))
1032 (home-page "https://github.com/warner/python-spake2")
1033 (synopsis "SPAKE2 password-authenticated key exchange in Python")
1034 (description "This package provides a Python implementation of the SPAKE2
1035 Password-Authenticated Key Exchange algorithm.")
1036 (license license:expat)))
1037
1038 (define-public python-txtorcon
1039 (package
1040 (name "python-txtorcon")
1041 (version "19.0.0")
1042 (source
1043 (origin
1044 (method url-fetch)
1045 (uri (pypi-uri "txtorcon" version))
1046 (sha256
1047 (base32
1048 "0fxzhsc62bhmr730vj9pzallmw56gz6iykvl28a5agrycm0bfc9p"))))
1049 (build-system python-build-system)
1050 (arguments
1051 ;; The tests fail immediately due to a missing file. Reported upstream:
1052 ;; <https://github.com/meejah/txtorcon/issues/330>
1053 `(#:tests? #f))
1054 (propagated-inputs
1055 `(("python-automat" ,python-automat)
1056 ("python-idna" ,python-idna)
1057 ("python-incremental" ,python-incremental)
1058 ("python-ipaddress" ,python-ipaddress)
1059 ("python-service-identity" ,python-service-identity)
1060 ("python-twisted" ,python-twisted)
1061 ("python-zope-interface" ,python-zope-interface)))
1062 (home-page "https://github.com/meejah/txtorcon")
1063 (synopsis "Twisted-based Tor controller client")
1064 (description "This package provides a Twisted-based Tor controller client,
1065 with state-tracking and configuration abstractions.")
1066 (license license:expat)))
1067
1068 (define-public python-keyutils
1069 (package
1070 (name "python-keyutils")
1071 (version "0.6")
1072 (source
1073 (origin
1074 (method url-fetch)
1075 (uri (pypi-uri "keyutils" version))
1076 (sha256
1077 (base32
1078 "0lipygpzhwzzsq2k5imb1jgkmj8y4khxdwhzadjs3bd56g6bmkx9"))))
1079 (build-system python-build-system)
1080 (native-inputs
1081 `(("python-pytest" ,python-pytest)
1082 ("python-pytest-runner" ,python-pytest-runner)))
1083 (inputs
1084 `(("keyutils" ,keyutils)))
1085 (arguments
1086 '(#:tests? #f))
1087 (home-page "https://github.com/sassoftware/python-keyutils")
1088 (synopsis "Python bindings for keyutils")
1089 (description
1090 "This is a set of python bindings for keyutils, a key management suite
1091 that leverages the infrastructure provided by the Linux kernel for safely
1092 storing and retrieving sensitive information in your programs.")
1093 (license license:asl2.0)))
1094
1095 (define-public python-mcuboot-imgtool
1096 (package
1097 (name "python-mcuboot-imgtool")
1098 (version "1.4.0")
1099 (source
1100 (origin
1101 (method git-fetch)
1102 (uri (git-reference
1103 (url "https://github.com/JuulLabs-OSS/mcuboot")
1104 (commit (string-append "v" version))))
1105 (file-name (git-file-name name version))
1106 (sha256
1107 (base32
1108 "1m1csyvzq4jx81zg635ssy1n7sc0z539z0myh872ll3nwqx7wa0q"))))
1109 (build-system python-build-system)
1110 (arguments
1111 `(#:phases
1112 (modify-phases %standard-phases
1113 (add-after 'unpack 'fix-broken-test
1114 (lambda _
1115 (substitute* "scripts/imgtool/keys/ed25519_test.py"
1116 (("raw_sign") "sign_digest"))
1117 #t))
1118 (add-before 'build 'change-directory
1119 (lambda _
1120 (chdir "scripts")
1121 #t)))))
1122 (propagated-inputs
1123 `(("python-click" ,python-click)
1124 ("python-intelhex" ,python-intelhex)
1125 ("python-cryptography" ,python-cryptography)))
1126 (home-page "https://mcuboot.com")
1127 (synopsis "Tool to securely sign firmware images for booting by MCUboot")
1128 (description "MCUboot is a secure bootloader for 32-bit MCUs. This
1129 package provides a tool to securely sign firmware images for booting by
1130 MCUboot.")
1131 (license license:expat)))