gnu: python-ecdsa: Use PYPI-URI.
[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 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 Tobias Geerinckx-Rice <me@tobias.gr>
12 ;;; Copyright © 2016, 2017 Nils Gillmann <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 ;;;
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)
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))
56
57 (define-public python-base58
58 (package
59 (name "python-base58")
60 (version "1.0.0")
61 (source
62 (origin
63 (method url-fetch)
64 (uri (pypi-uri "base58" version))
65 (sha256
66 (base32
67 "0lgnk7ycdxwhk2bkygl30nsks56bvrdj79ix76iv965pz808pzn5"))))
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
74 with what is used by the Bitcoin network.")
75 (license license:expat)))
76
77 (define-public python-bcrypt
78 (package
79 (name "python-bcrypt")
80 (version "3.1.6")
81 (source
82 (origin
83 (method url-fetch)
84 (uri (pypi-uri "bcrypt" version))
85 (sha256
86 (base32
87 "1sh2xh0iragdq8dhssc1cdd02nppjq7b5kmv0qladfi2s9cnfqs4"))))
88 (build-system python-build-system)
89 (native-inputs
90 `(("python-pycparser" ,python-pycparser)
91 ("python-pytest" ,python-pytest)))
92 (propagated-inputs
93 `(("python-cffi" ,python-cffi)
94 ("python-six" ,python-six)))
95 (home-page "https://github.com/pyca/bcrypt/")
96 (synopsis
97 "Modern password hashing library")
98 (description
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)))
104
105 (define-public python2-bcrypt
106 (package-with-python2 python-bcrypt))
107
108 (define-public python-passlib
109 (package
110 (name "python-passlib")
111 (version "1.7.1")
112 (source
113 (origin
114 (method url-fetch)
115 (uri (pypi-uri "passlib" version))
116 (sha256
117 (base32
118 "1q2khqpj9rlcgdmkypjdq1kswvhjf72bq0zk2cv669cc2dj8z51x"))))
119 (build-system python-build-system)
120 (native-inputs
121 `(("python-nose" ,python-nose)))
122 (propagated-inputs
123 `(("python-py-bcrypt" ,python-py-bcrypt)))
124 (arguments
125 `(#:phases
126 (modify-phases %standard-phases
127 (add-before 'check 'set-PYTHON_EGG_CACHE
128 ;; some tests require access to "$HOME/.cython"
129 (lambda* _ (setenv "PYTHON_EGG_CACHE" "/tmp") #t)))))
130 (home-page "https://bitbucket.org/ecollins/passlib")
131 (synopsis
132 "Comprehensive password hashing framework")
133 (description
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)))
140
141 (define-public python2-passlib
142 (package-with-python2 python-passlib))
143
144 (define-public python-py-bcrypt
145 (package
146 (name "python-py-bcrypt")
147 (version "0.4")
148 (source
149 (origin
150 (method url-fetch)
151 (uri (pypi-uri "py-bcrypt" version))
152 (sha256
153 (base32
154 "0y6smdggwi5s72v6p1nn53dg6w05hna3d264cq6kas0lap73p8az"))))
155 (build-system python-build-system)
156 (home-page "https://code.google.com/p/py-bcrypt")
157 (synopsis
158 "Bcrypt password hashing and key derivation")
159 (description
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
167 John the Ripper).")
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))))
172
173 (define-public python2-py-bcrypt
174 (package-with-python2 python-py-bcrypt))
175
176 (define-public python-pyblake2
177 (package
178 (name "python-pyblake2")
179 (version "1.1.2")
180 (source
181 (origin
182 (method url-fetch)
183 (uri (pypi-uri "pyblake2" version))
184 (sha256
185 (base32
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.
195
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))))
201
202 (define-public python-paramiko
203 (package
204 (name "python-paramiko")
205 (version "2.4.2")
206 (source
207 (origin
208 (method url-fetch)
209 (uri (pypi-uri "paramiko" version))
210 (sha256
211 (base32
212 "1jqgj2gl1pz7bi2aab1r2xq0ml0gskmm9p235cg9y32nydymm5x8"))))
213 (build-system python-build-system)
214 (arguments
215 `(;; FIXME: Tests require many unpackaged libraries, see dev-requirements.txt.
216 #:tests? #f))
217 (propagated-inputs
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+)))
229
230 (define-public python2-paramiko
231 (package-with-python2 python-paramiko))
232
233 (define-public python-ecdsa
234 (package
235 (name "python-ecdsa")
236 (version "0.13")
237 (source
238 (origin
239 (method url-fetch)
240 (uri (pypi-uri "ecdsa" version))
241 (sha256
242 (base32
243 "1yj31j0asmrx4an9xvsaj2icdmzy6pw0glfpqrrkrphwdpi1xkv4"))))
244 (build-system python-build-system)
245 (inputs
246 `(("openssl" ,openssl)))
247 (home-page
248 "https://github.com/warner/python-ecdsa")
249 (synopsis
250 "ECDSA cryptographic signature library (pure python)")
251 (description
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)))
258
259 (define-public python2-ecdsa
260 (package-with-python2 python-ecdsa))
261
262 ;;; Pycrypto is abandoned upstream:
263 ;;;
264 ;;; https://github.com/dlitz/pycrypto/issues/173
265 ;;;
266 ;;; TODO Remove this package from GNU Guix.
267 (define-public python-pycrypto
268 (package
269 (name "python-pycrypto")
270 (version "2.6.1")
271 (source
272 (origin
273 (method url-fetch)
274 (uri (pypi-uri "pycrypto" version))
275 (patches (search-patches "python-pycrypto-CVE-2013-7459.patch"))
276 (sha256
277 (base32
278 "0g0ayql5b9mkjam8hym6zyg6bv77lbh66rv1fyvgqb17kfc1xkpj"))))
279 (build-system python-build-system)
280 (inputs
281 `(("python" ,python)
282 ("gmp" ,gmp)))
283 (arguments
284 `(#:phases
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")
291 (description
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)))
296
297 (define-public python2-pycrypto
298 (let ((pycrypto (package-with-python2 python-pycrypto)))
299 (package (inherit pycrypto)
300 (inputs
301 `(("python" ,python-2)
302 ,@(alist-delete
303 "python"
304 (package-inputs pycrypto)))))))
305
306 (define-public python-keyring
307 (package
308 (name "python-keyring")
309 (version "8.7")
310 (source
311 (origin
312 (method url-fetch)
313 (uri (pypi-uri "keyring" version))
314 (sha256
315 (base32
316 "0482rmi2x6p78wl2kz8qzyq21xz1sbbfwnv5x7dggar4vkwxhzfx"))))
317 (build-system python-build-system)
318 (native-inputs
319 `(("python-pytest" ,python-pytest)
320 ("python-pytest-runner" ,python-pytest-runner)
321 ("python-setuptools-scm" ,python-setuptools-scm)))
322 (propagated-inputs
323 `(("python-pycrypto" ,python-pycrypto)))
324 (home-page "https://github.com/jaraco/keyring")
325 (synopsis "Store and access your passwords safely")
326 (description
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
329 password storage.")
330 ;; "MIT" and PSF dual license
331 (license license:x11)))
332
333 (define-public python2-keyring
334 (package-with-python2 python-keyring))
335
336 (define-public python-certifi
337 (package
338 (name "python-certifi")
339 (version "2018.11.29")
340 (source (origin
341 (method url-fetch)
342 (uri (pypi-uri "certifi" version))
343 (sha256
344 (base32
345 "1dvccavd2fzq4j37w0sznylp92ps14zi6gvlxzm23in0yhzciya7"))))
346 (build-system python-build-system)
347 (home-page "https://certifi.io/")
348 (synopsis "Python CA certificate bundle")
349 (description
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)))
353
354 (define-public python2-certifi
355 (package-with-python2 python-certifi))
356
357 (define-public python-cryptography-vectors
358 (package
359 (name "python-cryptography-vectors")
360 (version "2.5")
361 (source
362 (origin
363 (method url-fetch)
364 (uri (pypi-uri "cryptography_vectors" version))
365 (sha256
366 (base32
367 "15qfl3pnw2f11r0z0zhwl56f6pb60ysav8fxmpnz5p80cfwljdik"))))
368 (build-system python-build-system)
369 (home-page "https://github.com/pyca/cryptography")
370 (synopsis "Test vectors for the cryptography package")
371 (description
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))))
375
376 (define-public python2-cryptography-vectors
377 (package-with-python2 python-cryptography-vectors))
378
379 (define-public python-cryptography
380 (package
381 (name "python-cryptography")
382 (version "2.5")
383 (source
384 (origin
385 (method url-fetch)
386 (uri (pypi-uri "cryptography" version))
387 (sha256
388 (base32
389 "00c4d7gvsymlaw0r13zrm32dcnarmpayjyrh65yymlmr6mrbcij9"))))
390 (build-system python-build-system)
391 (inputs
392 `(("openssl" ,openssl)))
393 (propagated-inputs
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)))
399 (native-inputs
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")
407 (description
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))))))
416
417 (define-public python2-cryptography
418 (let ((crypto (package-with-python2
419 (strip-python2-variant python-cryptography))))
420 (package (inherit crypto)
421 (propagated-inputs
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))))))
427
428 (define-public python-pyopenssl
429 (package
430 (name "python-pyopenssl")
431 (version "19.0.0")
432 (source
433 (origin
434 (method url-fetch)
435 (uri (pypi-uri "pyOpenSSL" version))
436 (sha256
437 (base32
438 "007j40y7x3k8xj54dy2qnij9lldfp71k9mkflhd9vqbdiwrndjmf"))))
439 (build-system python-build-system)
440 (arguments
441 '(#:phases
442 (modify-phases %standard-phases
443 (delete 'check)
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"
448 (string-append
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")))))))
456 (propagated-inputs
457 `(("python-cryptography" ,python-cryptography)
458 ("python-six" ,python-six)))
459 (inputs
460 `(("openssl" ,openssl)))
461 (native-inputs
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")
467 (description
468 "PyOpenSSL is a high-level wrapper around a subset of the OpenSSL
469 library.")
470 (license license:asl2.0)))
471
472 (define-public python2-pyopenssl
473 (package-with-python2 python-pyopenssl))
474
475 (define-public python-ed25519
476 (package
477 (name "python-ed25519")
478 (version "1.4")
479 (source
480 (origin
481 (method url-fetch)
482 (uri (pypi-uri "ed25519" version))
483 (sha256
484 (base32
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)))
491
492 (define-public python2-ed25519
493 (package-with-python2 python-ed25519))
494
495 (define-public python-axolotl-curve25519
496 (package
497 (name "python-axolotl-curve25519")
498 (version "0.1")
499 (source
500 (origin
501 (method git-fetch)
502 (uri (git-reference
503 (url "https://github.com/tgalal/python-axolotl-curve25519")
504 (commit "e4a9c4de0eae27223200579c58d1f8f6d20637e2")))
505 (file-name (string-append name "-" version "-checkout"))
506 (sha256
507 (base32
508 "0agap5q0hmvf6cwzjqc05kw53pjgf6942pcivpazksmg1vk400ra"))))
509 (build-system python-build-system)
510 (arguments
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
519 python-axolotl.")
520 (license (list license:gpl3 ; Most files
521 license:bsd-3)))) ; curve/curve25519-donna.c
522
523 (define-public python2-axolotl-curve25519
524 (package-with-python2 python-axolotl-curve25519))
525
526 (define-public python-axolotl
527 (package
528 (name "python-axolotl")
529 (version "0.1.39")
530 (source
531 (origin
532 (method url-fetch)
533 (uri (string-append
534 "https://github.com/tgalal/python-axolotl/archive/"
535 version ".tar.gz"))
536 (file-name (string-append name "-" version ".tar.gz"))
537 (patches (search-patches "python-axolotl-AES-fix.patch"))
538 (sha256
539 (base32 "0badsgkgz0ir3hqynxzsfjgacppi874syvvmgccc6j164053x6zm"))))
540 (build-system python-build-system)
541 (arguments
542 `(#:phases
543 (modify-phases %standard-phases
544 ;; Don't install tests
545 (add-before 'install 'remove-tests
546 (lambda _
547 (for-each delete-file-recursively
548 '("axolotl/tests" "build/lib/axolotl/tests"))
549 #t)))))
550 (propagated-inputs
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)))
561
562 (define-public python2-axolotl
563 (package-with-python2 python-axolotl))
564
565 ;; SlowAES isn't compatible with Python 3.
566 (define-public python2-slowaes
567 (package
568 (name "python2-slowaes")
569 (version "0.1a1")
570 (source
571 (origin
572 (method url-fetch)
573 (uri (pypi-uri "slowaes" version))
574 (sha256
575 (base32
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)))
585
586 (define-public python-pyaes
587 (package
588 (name "python-pyaes")
589 (version "1.6.1")
590 (source
591 (origin
592 (method url-fetch)
593 (uri (pypi-uri "pyaes" version))
594 (sha256
595 (base32
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,
602 ECB and OFB).")
603 (license license:expat)))
604
605 (define-public python2-pyaes
606 (package-with-python2 python-pyaes))
607
608 (define-public python-asn1crypto
609 (package
610 (name "python-asn1crypto")
611 (version "0.24.0")
612 (source
613 (origin
614 (method git-fetch)
615 (uri (git-reference
616 (url "https://github.com/wbond/asn1crypto.git")
617 (commit version)))
618 (file-name (git-file-name name version))
619 (sha256
620 (base32
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)))
629
630 (define-public python2-asn1crypto
631 (package-with-python2 python-asn1crypto))
632
633 (define-public python-pynacl
634 (package
635 (name "python-pynacl")
636 (version "1.3.0")
637 (source
638 (origin
639 (method url-fetch)
640 (uri (pypi-uri "PyNaCl" version))
641 (modules '((guix build utils)))
642 ;; Remove bundled libsodium.
643 (snippet '(begin (delete-file-recursively "src/libsodium")
644 #t))
645 (sha256
646 (base32
647 "0330wyvggm19xhmwmz9rrr97lzbv3siwfy50gmax3vvgs7nh0q8c"))))
648 (build-system python-build-system)
649 (arguments
650 `(#:phases
651 (modify-phases %standard-phases
652 (add-before 'build 'use-system-sodium
653 (lambda _
654 (setenv "SODIUM_INSTALL" "system")
655 #t)))))
656 (native-inputs
657 `(("python-hypothesis" ,python-hypothesis)
658 ("python-pytest" ,python-pytest)))
659 (propagated-inputs
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")
665 (description
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)))
670
671 (define-public python2-pynacl
672 (package-with-python2 python-pynacl))
673
674 (define-public python2-pgpdump
675 (package
676 (name "python2-pgpdump")
677 (version "1.5")
678 (source
679 (origin
680 (method url-fetch)
681 (uri (pypi-uri "pgpdump" version))
682 (sha256
683 (base32
684 "0s4nh8h7qsdj2yf29bspjs1zvxd4lcd11r6g11dp7fppgf2h0iqw"))))
685 (build-system python-build-system)
686
687 ;; Currently fails to build with Python 3.
688 (arguments `(#:python ,python-2))
689
690 (home-page "https://github.com/toofishes/python-pgpdump")
691 (synopsis "Python library for parsing PGP packets")
692 (description
693 "Python-pgpdump is an OpenPGP packet parser based on
694 @uref{http://www.mew.org/~kazu/proj/pgpdump/, pgpdump}. It notably supports:
695
696 @itemize
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.
702 @end itemize\n")
703 (license license:bsd-3)))
704
705 (define-public python2-roca-detect
706 (package
707 (name "python2-roca-detect")
708 (version "1.0.8")
709 (source
710 (origin
711 (method url-fetch)
712 (uri (pypi-uri "roca-detect" version))
713 (sha256
714 (base32
715 "1di4akyw2lf5r8zfwvyhkilz8jv8g4b66rgaqwfabmjwma6gnw27"))))
716 (build-system python-build-system)
717 (native-inputs
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)))
725 (arguments
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.
730 #:python ,python-2))
731 (home-page "https://github.com/crocs-muni/roca")
732 (synopsis "ROCA detection tool")
733 (description
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
740 file, and more.")
741 (license license:gpl3)))
742
743 (define-public python-ecpy
744 (package
745 (name "python-ecpy")
746 (version "0.8.2")
747 (source
748 (origin
749 (method url-fetch)
750 (uri (pypi-uri "ECPy" version))
751 (sha256
752 (base32
753 "090fqnj8z0xm44jrfpll7j45r68m6kp7mjr7yxzg93j42h3sj285"))))
754 (build-system python-build-system)
755 (propagated-inputs
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
760 Python.")
761 (license license:asl2.0)))
762
763 (define-public python2-ecpy
764 (package-with-python2 python-ecpy))
765
766 (define-public python-josepy
767 (package
768 (name "python-josepy")
769 (version "1.1.0")
770 (source (origin
771 (method url-fetch)
772 (uri (pypi-uri "josepy" version))
773 (sha256
774 (base32
775 "11khz8malzrv375b27jjkv66z6z6khdx1v5mkkr4vq16gp3n4p7v"))))
776 (build-system python-build-system)
777 (arguments
778 ;; The tests require flake8 >= 3.5, which is not yet packaged.
779 '(#:tests? #f))
780 (propagated-inputs
781 `(("python-cryptography" ,python-cryptography)
782 ("python-pyopenssl" ,python-pyopenssl)
783 ("python-six" ,python-six)))
784 ;; TODO Enable when we have flake8 >= 3.5.
785 ; (native-inputs
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)))
799
800 (define-public python2-josepy
801 (package-with-python2 python-josepy))
802
803 (define-public python-pycryptodome
804 (package
805 (name "python-pycryptodome")
806 (version "3.7.2")
807 (source
808 (origin
809 (method url-fetch)
810 (uri (pypi-uri "pycryptodome" version))
811 (sha256
812 (base32
813 "1xxf5cyhlc5ak5skf4zgqz9yk5fj5g70hd06hc1jym995lxpxz7m"))))
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.
818
819 It brings the following enhancements with respect to the last official version
820 of PyCrypto:
821
822 @itemize
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
829 more)
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
837 in userspace)
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
840 @end itemize\n")
841 (license license:bsd-2)))
842
843 (define-public python2-pycryptodome
844 (package-with-python2 python-pycryptodome))
845
846 (define-public python-m2crypto
847 (package
848 (name "python-m2crypto")
849 (version "0.30.1")
850 (source
851 (origin
852 (method url-fetch)
853 (uri (pypi-uri "M2Crypto" version))
854 (sha256
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)))
869
870 (define-public python2-m2crypto
871 (let ((m2crypto (package-with-python2
872 (strip-python2-variant python-m2crypto))))
873 (package (inherit m2crypto)
874 (propagated-inputs
875 `(("python2-typing" ,python2-typing))))))
876
877 (define-public python-pylibscrypt
878 (package
879 (name "python-pylibscrypt")
880 (version "1.7.1")
881 (source
882 (origin
883 (method url-fetch)
884 (uri (pypi-uri "pylibscrypt" version))
885 (sha256
886 (base32
887 "1b3rgzl6dbzs08vhv41b6y4n5189wv7lr27acxn104hs45745abs"))))
888 (build-system python-build-system)
889 (arguments
890 `(#:phases
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'")))
898 #t))))
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.
902 #:tests? #f))
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.
906 (inputs
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
912 @code{libscrypt}.")
913 (license license:isc)))
914
915 (define-public python-libnacl
916 (package
917 (name "python-libnacl")
918 (version "1.6.1")
919 (source
920 (origin
921 (method url-fetch)
922 (uri (pypi-uri "libnacl" version))
923 (sha256
924 (base32
925 "0nv7n8nfswkhl614x5mllrkvaslraa0053q11iylb337cy43vb4v"))))
926 (build-system python-build-system)
927 (arguments
928 `(#:phases
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('\\))"
934 _ pre post)
935 (let ((libsodium (string-append (assoc-ref inputs "libsodium")
936 "/lib/libsodium.so")))
937 (string-append pre libsodium post)))))))))
938 (native-inputs
939 `(("python-pyhamcrest" ,python-pyhamcrest)))
940 (inputs
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)))
949
950 (define-public python-scrypt
951 (package
952 (name "python-scrypt")
953 (version "0.8.6")
954 (source
955 (origin
956 (method url-fetch)
957 (uri (pypi-uri "scrypt" version))
958 (sha256
959 (base32
960 "0b9nw10hfdl0jflm3b62q485ssc3f3f33lpg4yy407gs8wnrn8zq"))))
961 (build-system python-build-system)
962 (inputs
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)))
969
970 (define-public python-service-identity
971 (package
972 (name "python-service-identity")
973 (version "17.0.0")
974 (source
975 (origin
976 (method url-fetch)
977 (uri (pypi-uri "service_identity" version))
978 (sha256
979 (base32
980 "1aq24cn3nnsjr9g797dayhx4g653h6bd41ksqhidzq0rvarzn0a0"))))
981 (build-system python-build-system)
982 (propagated-inputs
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")
989 (description
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
994 relevant RFCs too.")
995 (license license:expat)))
996
997 (define-public python2-service-identity
998 (package-with-python2 python-service-identity))