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