9613cf3af27b18c1dae29aca3b9e3f2a6876ed2a
[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, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2015, 2016, 2017, 2019 Leo Famulari <leo@famulari.name>
5 ;;; Copyright © 2016, 2017, 2020 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, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
12 ;;; Copyright © 2016, 2017 Nikita <nikita@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, 2020 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, 2021 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 ;;; Copyright © 2020 Alexandros Theodotou <alex@zrythm.org>
25 ;;; Copyright © 2020 Justus Winter <justus@sequoia-pgp.org>
26 ;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
27 ;;;
28 ;;; This file is part of GNU Guix.
29 ;;;
30 ;;; GNU Guix is free software; you can redistribute it and/or modify it
31 ;;; under the terms of the GNU General Public License as published by
32 ;;; the Free Software Foundation; either version 3 of the License, or (at
33 ;;; your option) any later version.
34 ;;;
35 ;;; GNU Guix is distributed in the hope that it will be useful, but
36 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
37 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 ;;; GNU General Public License for more details.
39 ;;;
40 ;;; You should have received a copy of the GNU General Public License
41 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
42
43 (define-module (gnu packages python-crypto)
44 #:use-module (guix packages)
45 #:use-module (guix download)
46 #:use-module (guix git-download)
47 #:use-module (guix build-system python)
48 #:use-module (gnu packages)
49 #:use-module (gnu packages check)
50 #:use-module (gnu packages crypto)
51 #:use-module (gnu packages kerberos)
52 #:use-module (gnu packages libffi)
53 #:use-module (gnu packages multiprecision)
54 #:use-module (gnu packages password-utils)
55 #:use-module (gnu packages protobuf)
56 #:use-module (gnu packages python)
57 #:use-module (gnu packages python-build)
58 #:use-module (gnu packages python-check)
59 #:use-module (gnu packages python-compression)
60 #:use-module (gnu packages python-web)
61 #:use-module (gnu packages python-xyz)
62 #:use-module (gnu packages swig)
63 #:use-module (gnu packages time)
64 #:use-module (gnu packages tls)
65 #:use-module (gnu packages xml)
66 #:use-module ((guix licenses) #:prefix license:)
67 #:use-module (srfi srfi-1))
68
69 (define-public python-potr
70 (package
71 (name "python-potr")
72 (version "1.0.2")
73 (source
74 (origin
75 (method git-fetch)
76 (uri
77 (git-reference
78 (url "https://github.com/python-otr/pure-python-otr")
79 (commit version)))
80 (file-name
81 (git-file-name name version))
82 (sha256
83 (base32 "1hzw6h01fm216nmipyylgz0zybd80w1xsk12m7djycnhqrnrvvv1"))))
84 (build-system python-build-system)
85 (propagated-inputs
86 `(("python-pycrypto" ,python-pycrypto)))
87 (synopsis "Python OTR Implementation")
88 (description "Python OTR is an Off-The-Record Protocol Implementation in
89 Python. It does not bind to libotr.")
90 (home-page "https://github.com/python-otr/pure-python-otr")
91 (license license:lgpl3+)))
92
93 (define-public python-base58
94 (package
95 (name "python-base58")
96 (version "2.0.1")
97 (source
98 (origin
99 (method url-fetch)
100 (uri (pypi-uri "base58" version))
101 (sha256
102 (base32
103 "0yfaqp76kbdb62hikr5n4jkkfjfmii89grwfy6sw3fmsv5hrap1n"))))
104 (build-system python-build-system)
105 (native-inputs
106 `(("python-pyhamcrest" ,python-pyhamcrest)))
107 (home-page "https://github.com/keis/base58")
108 (synopsis "Base58 and Base58Check implementation")
109 (description "Base58 and Base58Check implementation compatible
110 with what is used by the Bitcoin network.")
111 (license license:expat)))
112
113 (define-public python-bcrypt
114 (package
115 (name "python-bcrypt")
116 (version "3.1.7")
117 (source
118 (origin
119 (method url-fetch)
120 (uri (pypi-uri "bcrypt" version))
121 (sha256
122 (base32 "0hhywhxx301cxivgxrpslrangbfpccc8y83qbwn1f57cab3nj00b"))))
123 (build-system python-build-system)
124 (native-inputs
125 `(("python-pycparser" ,python-pycparser)
126 ("python-pytest" ,python-pytest)))
127 (propagated-inputs
128 `(("python-cffi" ,python-cffi)
129 ("python-six" ,python-six)))
130 (home-page "https://github.com/pyca/bcrypt/")
131 (synopsis
132 "Modern password hashing library")
133 (description
134 "Bcrypt is a Python module which provides a password hashing method based
135 on the Blowfish password hashing algorithm, as described in
136 @url{http://static.usenix.org/events/usenix99/provos.html,\"A Future-Adaptable
137 Password Scheme\"} by Niels Provos and David Mazieres.")
138 (license license:asl2.0)))
139
140 (define-public python2-bcrypt
141 (package-with-python2 python-bcrypt))
142
143 (define-public python-passlib
144 (package
145 (name "python-passlib")
146 (version "1.7.4")
147 (source
148 (origin
149 (method url-fetch)
150 (uri (pypi-uri "passlib" version))
151 (sha256
152 (base32 "015y5qaw9qnxr29lg60dml1g5rbqd4586wy5n8m41ib55gvm1zfy"))))
153 (build-system python-build-system)
154 (native-inputs
155 `(("python-nose" ,python-nose)))
156 (propagated-inputs
157 `(("python-py-bcrypt" ,python-py-bcrypt)))
158 (arguments
159 `(#:phases
160 (modify-phases %standard-phases
161 (add-before 'check 'set-PYTHON_EGG_CACHE
162 ;; Some tests require access to "$HOME/.cython".
163 (lambda _ (setenv "PYTHON_EGG_CACHE" "/tmp") #t)))))
164 (home-page "https://bitbucket.org/ecollins/passlib")
165 (synopsis "Comprehensive password hashing framework")
166 (description
167 "Passlib is a password hashing library for Python 2 & 3, which provides
168 cross-platform implementations of over 30 password hashing algorithms, as well
169 as a framework for managing existing password hashes. It's designed to be
170 useful for a wide range of tasks, from verifying a hash found in /etc/shadow,
171 to providing full-strength password hashing for multi-user application.")
172 (license license:bsd-3)))
173
174 (define-public python2-passlib
175 (package-with-python2 python-passlib))
176
177 (define-public python-py-bcrypt
178 (package
179 (name "python-py-bcrypt")
180 (version "0.4")
181 (source
182 (origin
183 (method url-fetch)
184 (uri (pypi-uri "py-bcrypt" version))
185 (sha256
186 (base32
187 "0y6smdggwi5s72v6p1nn53dg6w05hna3d264cq6kas0lap73p8az"))))
188 (build-system python-build-system)
189 (home-page "https://code.google.com/p/py-bcrypt")
190 (synopsis
191 "Bcrypt password hashing and key derivation")
192 (description
193 "A python wrapper of OpenBSD's Blowfish password hashing code. This
194 system hashes passwords using a version of Bruce Schneier's Blowfish block
195 cipher with modifications designed to raise the cost of off-line password
196 cracking and frustrate fast hardware implementation. The computation cost of
197 the algorithm is parametrised, so it can be increased as computers get faster.
198 The intent is to make a compromise of a password database less likely to
199 result in an attacker gaining knowledge of the plaintext passwords (e.g. using
200 John the Ripper).")
201 ;; "sha2.c" is under BSD-3;
202 ;; "blowfish.c" and "bcrypt.c" are under BSD-4;
203 ;; the rest is under ISC.
204 (license (list license:isc license:bsd-3 license:bsd-4))))
205
206 (define-public python2-py-bcrypt
207 (package-with-python2 python-py-bcrypt))
208
209 (define-public python-pyblake2
210 (package
211 (name "python-pyblake2")
212 (version "1.1.2")
213 (source
214 (origin
215 (method url-fetch)
216 (uri (pypi-uri "pyblake2" version))
217 (sha256
218 (base32
219 "0gz9hgznv5zw4qjq43xa56y0yikimx30gffvibxzm0nv5sq7xk2w"))))
220 (build-system python-build-system)
221 (home-page "https://github.com/dchest/pyblake2")
222 (synopsis "BLAKE2 hash function for Python")
223 (description "BLAKE2 is a cryptographic hash function, which offers
224 stronger security while being as fast as MD5 or SHA-1, and comes in two
225 flavors: @code{BLAKE2b}, optimized for 64-bit platforms and produces digests
226 of any size between 1 and 64 bytes, and @code{BLAKE2s}, optimized for 8- to
227 32-bit platforms and produces digests of any size between 1 and 32 bytes.
228
229 This package provides a Python interface for BLAKE2.")
230 ;; The COPYING file declares it as public domain, with the option to
231 ;; alternatively use and redistribute it under a variety of permissive
232 ;; licenses. cc0 is explicitly mentioned in setup.py and pyblake2module.c.
233 (license (list license:public-domain license:cc0))))
234
235 (define-public python-paramiko
236 (package
237 (name "python-paramiko")
238 (version "2.7.2")
239 (source
240 (origin
241 (method url-fetch)
242 (uri (pypi-uri "paramiko" version))
243 (sha256
244 (base32 "0dahwq623jnna7gsr9j0mkwr9k2n1pvkapjryhcx508d5jxg8dkz"))))
245 (build-system python-build-system)
246 (arguments
247 `(;; FIXME: Tests require many unpackaged libraries, see dev-requirements.txt.
248 #:tests? #f))
249 (propagated-inputs
250 `(("python-bcrypt" ,python-bcrypt)
251 ("python-pyasn1" ,python-pyasn1)
252 ("python-pynacl" ,python-pynacl)
253 ("python-cryptography" ,python-cryptography)))
254 (home-page "https://www.paramiko.org/")
255 (synopsis "SSHv2 protocol library")
256 (description "Paramiko is a python implementation of the SSHv2 protocol,
257 providing both client and server functionality. While it leverages a Python C
258 extension for low level cryptography (PyCrypto), Paramiko itself is a pure
259 Python interface around SSH networking concepts.")
260 (license license:lgpl2.1+)))
261
262 (define-public python2-paramiko
263 (package-with-python2 python-paramiko))
264
265 (define-public python-ecdsa
266 (package
267 (name "python-ecdsa")
268 (version "0.14.1")
269 (source
270 (origin
271 (method url-fetch)
272 (uri (pypi-uri "ecdsa" version))
273 (sha256
274 (base32 "13nx5cbfxc0gnax5zwdmp9xc40qd1llk62mv85jyrvqkbw017ik4"))))
275 (build-system python-build-system)
276 (arguments
277 '(#:phases
278 (modify-phases %standard-phases
279 (replace 'check
280 (lambda _ (invoke "pytest"))))))
281 (propagated-inputs
282 `(("python-six" ,python-six)))
283 (native-inputs
284 `(("openssl" ,openssl)
285 ("python-pytest" ,python-pytest)))
286 (home-page "https://github.com/warner/python-ecdsa")
287 (synopsis "ECDSA cryptographic signature library (pure python)")
288 (description
289 "This is an easy-to-use implementation of ECDSA cryptography (Elliptic
290 Curve Digital Signature Algorithm), implemented purely in Python. With this
291 library, you can quickly create key pairs (signing key and verifying key), sign
292 messages, and verify the signatures. The keys and signatures are very short,
293 making them easy to handle and incorporate into other protocols.")
294 (license license:expat)))
295
296 (define-public python2-ecdsa
297 (package-with-python2 python-ecdsa))
298
299 ;;; Pycrypto is abandoned upstream:
300 ;;;
301 ;;; https://github.com/dlitz/pycrypto/issues/173
302 ;;;
303 ;;; TODO Remove this package from GNU Guix.
304 (define-public python-pycrypto
305 (package
306 (name "python-pycrypto")
307 (version "2.6.1")
308 (source
309 (origin
310 (method url-fetch)
311 (uri (pypi-uri "pycrypto" version))
312 (patches (search-patches "python-pycrypto-CVE-2013-7459.patch"
313 "python-pycrypto-time-clock.patch"))
314 (sha256
315 (base32
316 "0g0ayql5b9mkjam8hym6zyg6bv77lbh66rv1fyvgqb17kfc1xkpj"))))
317 (build-system python-build-system)
318 (inputs
319 `(("python" ,python)
320 ("gmp" ,gmp)))
321 (arguments
322 `(#:phases
323 (modify-phases %standard-phases
324 (add-before 'build 'set-build-env
325 ;; pycrypto runs an autoconf configure script behind the scenes
326 (lambda _ (setenv "CONFIG_SHELL" (which "bash")) #t)))))
327 (home-page "https://www.dlitz.net/software/pycrypto/")
328 (synopsis "Cryptographic modules for Python")
329 (description
330 "Pycrypto is a collection of both secure hash functions (such as SHA256
331 and RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal,
332 etc.). The package is structured to make adding new modules easy.")
333 (license license:public-domain)))
334
335 (define-public python2-pycrypto
336 (let ((pycrypto (package-with-python2 python-pycrypto)))
337 (package (inherit pycrypto)
338 (inputs
339 `(("python" ,python-2)
340 ,@(alist-delete
341 "python"
342 (package-inputs pycrypto)))))))
343
344 (define-public python-kerberos
345 (package
346 (name "python-kerberos")
347 (version "1.3.0")
348 (source
349 (origin
350 (method url-fetch)
351 (uri (pypi-uri "kerberos" version))
352 (sha256
353 (base32
354 "19663qxmma0i8bfbjc2iwy5hgq0g4pfb75r023v5dps68zfvffgh"))))
355 (build-system python-build-system)
356 (inputs
357 `(("mit-krb5" ,mit-krb5)))
358 (home-page "https://github.com/apple/ccs-pykerberos")
359 (synopsis
360 "Python Kerberos library used by CalendarServer")
361 (description
362 "This Python package is a high-level wrapper for Kerberos (GSSAPI)
363 operations. The goal is to avoid having to build a module that wraps the
364 entire Kerberos.framework, and instead offer a limited set of functions that
365 do what is needed for client/server Kerberos authentication based on
366 <http://www.ietf.org/rfc/rfc4559.txt>.")
367 (license license:asl2.0)))
368
369 (define-public python-keyring
370 (package
371 (name "python-keyring")
372 (version "21.0.0")
373 (source
374 (origin
375 (method url-fetch)
376 (uri (pypi-uri "keyring" version))
377 (sha256
378 (base32
379 "1k0w3yh3fz0qp0cvkxdiinq9jzbrnc6bd88qpjz34x3cgcr94psz"))
380 (modules '((guix build utils)))
381 (snippet
382 ;; https://github.com/jaraco/keyring/issues/414
383 '(begin (substitute* "tests/test_packaging.py"
384 (("ep, =") "(ep,) =")) #t))))
385 (build-system python-build-system)
386 (arguments
387 `(#:phases
388 (modify-phases %standard-phases
389 (replace 'check
390 (lambda _
391 ;; Not clear why this test fails.
392 (delete-file "tests/test_packaging.py")
393 (substitute* "pytest.ini"
394 (("--black ") ""))
395 (invoke "pytest"))))))
396 (native-inputs
397 `(("python-pytest" ,python-pytest)
398 ("python-pytest-checkdocs" ,python-pytest-checkdocs)
399 ("python-pytest-cov" ,python-pytest-cov)
400 ("python-pytest-flake8" ,python-pytest-flake8)
401 ("python-setuptools-scm" ,python-setuptools-scm)))
402 (propagated-inputs
403 `(("python-importlib-metadata" ,python-importlib-metadata)
404 ("python-secretstorage" ,python-secretstorage)))
405 (home-page "https://github.com/jaraco/keyring")
406 (synopsis "Store and access your passwords safely")
407 (description
408 "The Python keyring lib provides a easy way to access the system keyring
409 service from python. It can be used in any application that needs safe
410 password storage.")
411 ;; "MIT" and PSF dual license
412 (properties `((python2-variant . ,(delay python2-keyring))))
413 (license license:x11)))
414
415 (define-public python2-keyring
416 (let ((keyring (package-with-python2
417 (strip-python2-variant python-keyring))))
418 (package
419 (inherit keyring)
420 (name "python2-keyring")
421 (version "8.7")
422 (source
423 (origin
424 (method url-fetch)
425 (uri (pypi-uri "keyring" version))
426 (sha256
427 (base32
428 "0482rmi2x6p78wl2kz8qzyq21xz1sbbfwnv5x7dggar4vkwxhzfx"))))
429 (arguments
430 `(#:python ,python-2))
431 (native-inputs
432 `(("python2-pytest" ,python2-pytest)
433 ("python2-pytest-runner" ,python2-pytest-runner)
434 ("python2-setuptools-scm" ,python2-setuptools-scm)))
435 (propagated-inputs
436 `(("python2-pycrypto" ,python2-pycrypto))))))
437
438 (define-public python-keyrings.alt
439 (package
440 (name "python-keyrings.alt")
441 (version "3.4.0")
442 (source
443 (origin
444 (method url-fetch)
445 (uri (pypi-uri "keyrings.alt" version))
446 (sha256
447 (base32
448 "0gdjdqpq2hf770p6iwi891mil0vbsdhvy88x0v8b2w4y4b28lcli"))
449 (modules '((guix build utils)))
450 (snippet
451 '(begin
452 (delete-file "keyrings/alt/_win_crypto.py")
453 ;; Rely on python-keyring>20:
454 ;; https://github.com/jaraco/keyrings.alt/issues/33
455 (substitute* '("keyrings/alt/tests/test_Gnome.py"
456 "keyrings/alt/tests/test_Google.py"
457 "keyrings/alt/tests/test_Windows.py"
458 "keyrings/alt/tests/test_file.py"
459 "keyrings/alt/tests/test_pyfs.py")
460 (("keyring.tests.test_backend") "keyring.testing.backend")
461 (("keyring.tests.util") "keyring.testing.util"))
462 #t))))
463 (build-system python-build-system)
464 (native-inputs
465 `(("python-keyring" ,python-keyring)
466 ("python-pytest" ,python-pytest)
467 ("python-setuptools-scm" ,python-setuptools-scm)))
468 (home-page "https://github.com/jaraco/keyrings.alt")
469 (synopsis "Alternate keyring implementations")
470 (description "Keyrings in this package may have security risks or other
471 implications. These backends were extracted from the main keyring project to
472 make them available for those who wish to employ them, but are discouraged for
473 general production use. Include this module and use its backends at your own
474 risk.")
475 (license license:expat)))
476
477 (define-public python-certifi
478 (package
479 (name "python-certifi")
480 (version "2020.12.5")
481 (source (origin
482 (method url-fetch)
483 (uri (pypi-uri "certifi" version))
484 (sha256
485 (base32
486 "177mdbw0livdjvp17sz6wsfrc32838m9y59v871gpgv2888raj8s"))))
487 (build-system python-build-system)
488 (arguments '(#:tests? #f)) ;no tests
489 (home-page "https://certifi.io/")
490 (synopsis "Python CA certificate bundle")
491 (description
492 "Certifi is a Python library that contains a CA certificate bundle, which
493 is used by the Requests library to verify HTTPS requests.")
494 (license license:asl2.0)))
495
496 (define-public python2-certifi
497 (package-with-python2 python-certifi))
498
499 (define-public python-cryptography-vectors
500 (package
501 (name "python-cryptography-vectors")
502 (version "3.3.1")
503 (source
504 (origin
505 (method url-fetch)
506 (uri (pypi-uri "cryptography_vectors" version))
507 (sha256
508 (base32
509 "192wix3sr678x21brav5hgc6j93l7ab1kh69p2scr3fsblq9qy03"))))
510 (build-system python-build-system)
511 (home-page "https://github.com/pyca/cryptography")
512 (synopsis "Test vectors for the cryptography package")
513 (description
514 "This package contains test vectors for the cryptography package.")
515 ;; Distributed under either BSD-3 or ASL2.0
516 (license (list license:bsd-3 license:asl2.0))))
517
518 (define-public python2-cryptography-vectors
519 (package-with-python2 python-cryptography-vectors))
520
521 (define-public python-cryptography
522 (package
523 (name "python-cryptography")
524 (version "3.3.1")
525 (source
526 (origin
527 (method url-fetch)
528 (uri (pypi-uri "cryptography" version))
529 (sha256
530 (base32
531 "1ribd1vxq9wwz564mg60dzcy699gng54admihjjkgs9dx95pw5vy"))))
532 (build-system python-build-system)
533 (inputs
534 `(("openssl" ,openssl)))
535 (propagated-inputs
536 `(("python-asn1crypto" ,python-asn1crypto)
537 ("python-cffi" ,python-cffi)
538 ("python-six" ,python-six)
539 ("python-idna" ,python-idna)
540 ("python-iso8601" ,python-iso8601)))
541 (native-inputs
542 `(("python-cryptography-vectors" ,python-cryptography-vectors)
543 ("python-hypothesis" ,python-hypothesis)
544 ("python-pretend" ,python-pretend)
545 ("python-pytz" ,python-pytz)
546 ("python-pytest" ,python-pytest)))
547 (home-page "https://github.com/pyca/cryptography")
548 (synopsis "Cryptographic recipes and primitives for Python")
549 (description
550 "cryptography is a package which provides cryptographic recipes and
551 primitives to Python developers. It aims to be the “cryptographic standard
552 library” for Python. The package includes both high level recipes, and low
553 level interfaces to common cryptographic algorithms such as symmetric ciphers,
554 message digests and key derivation functions.")
555 ;; Distributed under either BSD-3 or ASL2.0
556 (license (list license:bsd-3 license:asl2.0))
557 (properties `((python2-variant . ,(delay python2-cryptography))))))
558
559 (define-public python2-cryptography
560 (let ((crypto (package-with-python2
561 (strip-python2-variant python-cryptography))))
562 (package (inherit crypto)
563 (propagated-inputs
564 `(("python2-ipaddress" ,python2-ipaddress)
565 ("python2-backport-ssl-match-hostname"
566 ,python2-backport-ssl-match-hostname)
567 ("python2-enum34" ,python2-enum34)
568 ,@(package-propagated-inputs crypto))))))
569
570 (define-public python-pyopenssl
571 (package
572 (name "python-pyopenssl")
573 (version "20.0.0")
574 (source
575 (origin
576 (method url-fetch)
577 (uri (pypi-uri "pyOpenSSL" version))
578 (sha256
579 (base32
580 "1i8ab5zn9i9iq2ksizp3rd42v157kacddzz88kviqw3kpp68xw4j"))))
581 (build-system python-build-system)
582 (arguments
583 '(#:phases
584 (modify-phases %standard-phases
585 (delete 'check)
586 (add-after 'install 'check
587 (lambda* (#:key inputs outputs #:allow-other-keys)
588 (add-installed-pythonpath inputs outputs)
589 ;; PyOpenSSL runs tests against a certificate with a fixed
590 ;; expiry time. To ensure successful builds in the future,
591 ;; set the time to roughly the release date.
592 (invoke "faketime" "2020-12-01" "py.test" "-v" "-k"
593 (string-append
594 ;; This test tries to look up certificates from
595 ;; the compiled-in default path in OpenSSL, which
596 ;; does not exist in the build environment.
597 "not test_fallback_default_verify_paths "
598 ;; This test attempts to make a connection to
599 ;; an external web service.
600 "and not test_set_default_verify_paths "
601 ;; Fails on i686-linux and possibly other 32-bit platforms
602 ;; https://github.com/pyca/pyopenssl/issues/974
603 "and not test_verify_with_time")))))))
604 (propagated-inputs
605 `(("python-cryptography" ,python-cryptography)
606 ("python-six" ,python-six)))
607 (inputs
608 `(("openssl" ,openssl)))
609 (native-inputs
610 `(("libfaketime" ,libfaketime)
611 ("python-flaky" ,python-flaky)
612 ("python-pretend" ,python-pretend)
613 ("python-pytest" ,python-pytest)))
614 (home-page "https://github.com/pyca/pyopenssl")
615 (synopsis "Python wrapper module around the OpenSSL library")
616 (description
617 "PyOpenSSL is a high-level wrapper around a subset of the OpenSSL
618 library.")
619 (license license:asl2.0)))
620
621 (define-public python2-pyopenssl
622 (package-with-python2 python-pyopenssl))
623
624 (define-public python-ed25519
625 (package
626 (name "python-ed25519")
627 (version "1.4")
628 (source
629 (origin
630 (method url-fetch)
631 (uri (pypi-uri "ed25519" version))
632 (sha256
633 (base32
634 "0ahx1nkxa0xis3cw0h5c4fpgv8mq4znkq7kajly33lc3317bk499"))))
635 (build-system python-build-system)
636 (home-page "https://github.com/warner/python-ed25519")
637 (synopsis "Ed25519 public-key signatures")
638 (description "Ed25519 public-key signatures")
639 (license license:expat)))
640
641 (define-public python2-ed25519
642 (package-with-python2 python-ed25519))
643
644 (define-public python-axolotl-curve25519
645 (package
646 (name "python-axolotl-curve25519")
647 (version "0.4.1.post2")
648 (source
649 (origin
650 (method url-fetch)
651 (uri (pypi-uri "python-axolotl-curve25519" version))
652 (sha256
653 (base32
654 "18v3rfyv7xi26fb97nw1xc0l6x8wi0i4xj8dlq4gblpbjxiac187"))))
655 (build-system python-build-system)
656 (home-page "https://github.com/tgalal/python-axolotl-curve25519")
657 (synopsis "Python wrapper for curve25519 library")
658 (description "This is a python wrapper for the curve25519 library
659 with ed25519 signatures. The C code was pulled from
660 libaxolotl-android. At the moment this wrapper is meant for use by
661 python-axolotl.")
662 (license (list license:gpl3 ; Most files
663 license:bsd-3)))) ; curve/curve25519-donna.c
664
665 (define-public python2-axolotl-curve25519
666 (package-with-python2 python-axolotl-curve25519))
667
668 (define-public python-axolotl
669 (package
670 (name "python-axolotl")
671 (version "0.2.3")
672 (source
673 (origin
674 (method url-fetch)
675 (uri (pypi-uri "python-axolotl" version))
676 (sha256
677 (base32
678 "1bwdp24fmriffwx91aigs9k162albb51iskp23nc939z893q23py"))))
679 (build-system python-build-system)
680 (arguments
681 `(#:phases
682 (modify-phases %standard-phases
683 ;; Don't install tests
684 (add-before 'install 'remove-tests
685 (lambda _
686 (for-each delete-file-recursively
687 '("axolotl/tests" "build/lib/axolotl/tests"))
688 #t)))))
689 (propagated-inputs
690 `(("python-axolotl-curve25519" ,python-axolotl-curve25519)
691 ("python-cryptography" ,python-cryptography)
692 ("python-protobuf" ,python-protobuf)))
693 (home-page "https://github.com/tgalal/python-axolotl")
694 (synopsis "Python port of libaxolotl-android")
695 (description "This is a python port of libaxolotl-android. This
696 is a ratcheting forward secrecy protocol that works in synchronous and
697 asynchronous messaging environments.")
698 (license license:gpl3)))
699
700 (define-public python2-axolotl
701 (package-with-python2 python-axolotl))
702
703 ;; SlowAES isn't compatible with Python 3.
704 (define-public python2-slowaes
705 (package
706 (name "python2-slowaes")
707 (version "0.1a1")
708 (source
709 (origin
710 (method url-fetch)
711 (uri (pypi-uri "slowaes" version))
712 (sha256
713 (base32
714 "02dzajm83a7lqgxf6r3hgj64wfmcxz8gs4nvgxpvj5n19kjqlrc3"))))
715 (build-system python-build-system)
716 (arguments `(#:python ,python-2))
717 (home-page "http://code.google.com/p/slowaes/")
718 (synopsis "Implementation of AES in Python")
719 (description "This package contains an implementation of AES in Python.
720 This implementation is slow (hence the project name) but still useful when
721 faster ones are not available.")
722 (license license:asl2.0)))
723
724 (define-public python-pyaes
725 (package
726 (name "python-pyaes")
727 (version "1.6.1")
728 (source
729 (origin
730 (method url-fetch)
731 (uri (pypi-uri "pyaes" version))
732 (sha256
733 (base32
734 "13vdaff15k0jyfcss4b4xvfgm8xyv0nrbyw5n1qc7lrqbi0b3h82"))))
735 (build-system python-build-system)
736 (home-page "https://github.com/ricmoo/pyaes")
737 (synopsis "Implementation of AES in Python")
738 (description "This package contains a pure-Python implementation of the
739 AES block cipher algorithm and the common modes of operation (CBC, CFB, CTR,
740 ECB and OFB).")
741 (license license:expat)))
742
743 (define-public python2-pyaes
744 (package-with-python2 python-pyaes))
745
746 (define-public python-asn1crypto
747 (package
748 (name "python-asn1crypto")
749 (version "1.4.0")
750 (source
751 (origin
752 (method git-fetch)
753 (uri (git-reference
754 (url "https://github.com/wbond/asn1crypto")
755 (commit version)))
756 (file-name (git-file-name name version))
757 (sha256
758 (base32
759 "19abibn6jw20mzi1ln4n9jjvpdka8ygm4m439hplyrdfqbvgm01r"))))
760 (build-system python-build-system)
761 (arguments
762 '(#:phases (modify-phases %standard-phases
763 (replace 'check
764 (lambda _
765 (invoke "python" "run.py" "tests"))))))
766 (home-page "https://github.com/wbond/asn1crypto")
767 (synopsis "ASN.1 parser and serializer in Python")
768 (description "asn1crypto is an ASN.1 parser and serializer with definitions
769 for private keys, public keys, certificates, CRL, OCSP, CMS, PKCS#3, PKCS#7,
770 PKCS#8, PKCS#12, PKCS#5, X.509 and TSP.")
771 (license license:expat)))
772
773 (define-public python2-asn1crypto
774 (package-with-python2 python-asn1crypto))
775
776 (define-public python-pynacl
777 (package
778 (name "python-pynacl")
779 (version "1.4.0")
780 (source
781 (origin
782 (method url-fetch)
783 (uri (pypi-uri "PyNaCl" version))
784 (modules '((guix build utils)))
785 (snippet
786 '(begin
787 ;; Remove spurious dependency on python-wheel, can be removed
788 ;; for 1.5.
789 (substitute* "setup.py"
790 (("\"wheel\"") ""))
791 ;; Remove bundled libsodium.
792 (delete-file-recursively "src/libsodium")
793 #t))
794 (sha256
795 (base32
796 "01b56hxrbif3hx8l6rwz5kljrgvlbj7shmmd2rjh0hn7974a5sal"))))
797 (build-system python-build-system)
798 (arguments
799 `(#:modules (,@%python-build-system-modules
800 (guix build utils)
801 (ice-9 ftw)
802 (srfi srfi-26))
803 #:phases
804 (modify-phases (@ (guix build python-build-system) %standard-phases)
805 (add-before 'build 'use-system-sodium
806 (lambda _
807 (setenv "SODIUM_INSTALL" "system")
808 #t))
809 (replace 'check
810 (lambda _
811 (let ((build-directory
812 (car (scandir "build" (cut string-prefix? "lib" <>)))))
813 (setenv "PYTHONPATH"
814 (string-append "./build/" build-directory ":"
815 (getenv "PYTHONPATH")))
816 (invoke "pytest" "-vv")))))))
817 (native-inputs
818 `(("python-hypothesis" ,python-hypothesis)
819 ("python-pytest" ,python-pytest)))
820 (propagated-inputs
821 `(("python-cffi" ,python-cffi)
822 ("python-six" ,python-six)
823 ("libsodium" ,libsodium)))
824 (home-page "https://github.com/pyca/pynacl/")
825 (synopsis "Python bindings to libsodium")
826 (description
827 "PyNaCl is a Python binding to libsodium, which is a fork of the
828 Networking and Cryptography library. These libraries have a stated goal
829 of improving usability, security and speed.")
830 (license license:asl2.0)))
831
832 (define-public python2-pynacl
833 (package-with-python2 python-pynacl))
834
835 (define-public python2-pgpdump
836 (package
837 (name "python2-pgpdump")
838 (version "1.5")
839 (source
840 (origin
841 (method url-fetch)
842 (uri (pypi-uri "pgpdump" version))
843 (sha256
844 (base32
845 "0s4nh8h7qsdj2yf29bspjs1zvxd4lcd11r6g11dp7fppgf2h0iqw"))))
846 (build-system python-build-system)
847
848 ;; Currently fails to build with Python 3.
849 (arguments `(#:python ,python-2))
850
851 (home-page "https://github.com/toofishes/python-pgpdump")
852 (synopsis "Python library for parsing PGP packets")
853 (description
854 "Python-pgpdump is an OpenPGP packet parser based on
855 @uref{http://www.mew.org/~kazu/proj/pgpdump/, pgpdump}. It notably supports:
856
857 @itemize
858 @item signature packets;
859 @item public key packets;
860 @item secret key packets;
861 @item trust, user ID, and user attribute packets;
862 @item ASCII-armor decoding and CRC check.
863 @end itemize\n")
864 (license license:bsd-3)))
865
866 (define-public python2-roca-detect
867 (package
868 (name "python2-roca-detect")
869 (version "1.0.8")
870 (source
871 (origin
872 (method url-fetch)
873 (uri (pypi-uri "roca-detect" version))
874 (sha256
875 (base32
876 "1di4akyw2lf5r8zfwvyhkilz8jv8g4b66rgaqwfabmjwma6gnw27"))))
877 (build-system python-build-system)
878 (native-inputs
879 ;; TODO: apk_parse_ph4, pyjks
880 `(("python2-dateutil" ,python2-dateutil)
881 ("python2-six" ,python2-six)
882 ("python2-cryptography" ,python2-cryptography)
883 ("python2-future" ,python2-future)
884 ("python2-coloredlogs" ,python2-coloredlogs)
885 ("python2-pgpdump" ,python2-pgpdump)))
886 (arguments
887 `(;; Basic testing routine is quite simple and works with Py3
888 ;; but the rest of the code that processes the different
889 ;; key formats and extracts the modulus for inspection is
890 ;; not yet fully py3 ready.
891 #:python ,python-2))
892 (home-page "https://github.com/crocs-muni/roca")
893 (synopsis "ROCA detection tool")
894 (description
895 "This tool is related to the paper entitled @i{Return of the
896 Coppersmith’s Attack: Practical Factorization of Widely Used RSA Moduli}. It
897 enables you to test public RSA keys for a presence of the described
898 vulnerability. Currently the tool supports the following key formats: X.509
899 Certificate (DER encoded, PEM encoded), RSA PEM (encoded private key, public
900 key), SSH public key, ASC-encoded OpenPGP key, APK Android application, LDIFF
901 file, and more.")
902 (license license:gpl3)))
903
904 (define-public python-blurhash
905 (package
906 (name "python-blurhash")
907 (version "1.1.4")
908 (source
909 (origin
910 ;; Tests not included in pypi release and releases not tagged in git repo.
911 (method git-fetch)
912 (uri (git-reference
913 (url "https://github.com/halcy/blurhash-python")
914 (commit "22e081ef1c24da1bb5c5eaa2c1d6649724deaef8")))
915 (file-name (git-file-name name version))
916 (sha256
917 (base32
918 "1qq6mhydlp7q3na4kmaq3871h43wh3pyfyxr4b79bia73wjdylxf"))))
919 (build-system python-build-system)
920 (arguments
921 '(#:phases
922 (modify-phases %standard-phases
923 (replace 'check
924 (lambda _
925 (delete-file "setup.cfg")
926 (invoke "pytest"))))))
927 (native-inputs
928 `(("python-numpy" ,python-numpy)
929 ("python-pillow" ,python-pillow)
930 ("python-pytest" ,python-pytest)))
931 (home-page "https://github.com/halcy/blurhash-python")
932 (synopsis
933 "Pure-Python implementation of the blurhash algorithm")
934 (description
935 "Pure-Python implementation of the blurhash algorithm.")
936 (license license:expat)))
937
938 (define-public python-ecpy
939 (package
940 (name "python-ecpy")
941 (version "0.10.0")
942 (source
943 (origin
944 (method url-fetch)
945 (uri (pypi-uri "ECPy" version))
946 (sha256
947 (base32
948 "1gc3i5s93zq6x1nkaxkq1dvmsc12vmrw0hns9f5s1hcb78ni52c8"))))
949 (build-system python-build-system)
950 (propagated-inputs
951 `(("python-future" ,python-future)))
952 (home-page "https://github.com/ubinity/ECPy")
953 (synopsis "Pure Python Elliptic Curve Library")
954 (description "This package provides a Elliptic Curve Library in pure
955 Python.")
956 (license license:asl2.0)))
957
958 (define-public python2-ecpy
959 (package-with-python2 python-ecpy))
960
961 (define-public python-josepy
962 (package
963 (name "python-josepy")
964 (version "1.1.0")
965 (source (origin
966 (method url-fetch)
967 (uri (pypi-uri "josepy" version))
968 (sha256
969 (base32
970 "11khz8malzrv375b27jjkv66z6z6khdx1v5mkkr4vq16gp3n4p7v"))))
971 (build-system python-build-system)
972 (arguments
973 ;; The tests require flake8 >= 3.5, which is not yet packaged.
974 '(#:tests? #f))
975 (propagated-inputs
976 `(("python-cryptography" ,python-cryptography)
977 ("python-pyopenssl" ,python-pyopenssl)
978 ("python-six" ,python-six)))
979 ;; TODO Enable when we have flake8 >= 3.5.
980 ; (native-inputs
981 ; `(("python-coverage" ,python-coverage)
982 ; ("python-flake8" ,python-flake8)
983 ; ("python-isort" ,python-isort)
984 ; ("python-mock" ,python-mock)
985 ; ("python-pytest" ,python-pytest)
986 ; ("python-pytest-cov" ,python-pytest-cov)
987 ; ("python-pytest-cache" ,python-pytest-cache)
988 ; ("python-pytest-flake8" ,python-pytest-flake8)))
989 (home-page "https://github.com/certbot/josepy")
990 (synopsis "JOSE protocol implementation in Python")
991 (description "This package provides a Python implementation of the JOSE
992 protocol (Javascript Object Signing and Encryption).")
993 (license license:asl2.0)))
994
995 (define-public python2-josepy
996 (package-with-python2 python-josepy))
997
998 (define-public python-pycryptodome
999 (package
1000 (name "python-pycryptodome")
1001 (version "3.9.9")
1002 (source
1003 (origin
1004 (method url-fetch)
1005 (uri (pypi-uri "pycryptodome" version))
1006 (sha256
1007 (base32
1008 "1i4m74f88qj9ci8rpyzrbk2slmsdj5ipmwdkq6qk24byalm203li"))))
1009 (build-system python-build-system)
1010 (home-page "https://www.pycryptodome.org")
1011 (synopsis "Low-level cryptographic Python library")
1012 (description
1013 "PyCryptodome is a self-contained Python package of low-level
1014 cryptographic primitives. It's not a wrapper to a separate C library like
1015 OpenSSL. To the largest possible extent, algorithms are implemented in pure
1016 Python. Only the pieces that are extremely critical to performance (e.g.,
1017 block ciphers) are implemented as C extensions.
1018
1019 You are expected to have a solid understanding of cryptography and security
1020 engineering to successfully use these primitives. You must also be able to
1021 recognize that some are obsolete (e.g., TDES) or even insecure (RC4).
1022
1023 It provides many enhancements over the last release of PyCrypto (2.6.1):
1024
1025 @itemize
1026 @item Authenticated encryption modes (GCM, CCM, EAX, SIV, OCB)
1027 @item Accelerated AES on Intel platforms via AES-NI
1028 @item First-class support for PyPy
1029 @item Elliptic curves cryptography (NIST P-256 curve only)
1030 @item Better and more compact API (nonce and iv attributes for ciphers,
1031 automatic generation of random nonces and IVs, simplified CTR cipher mode, and
1032 more)
1033 @item SHA-3 (including SHAKE XOFs) and BLAKE2 hash algorithms
1034 @item Salsa20 and ChaCha20 stream ciphers
1035 @item scrypt and HKDF
1036 @item Deterministic (EC)DSA
1037 @item Password-protected PKCS#8 key containers
1038 @item Shamir’s Secret Sharing scheme
1039 @item Random numbers get sourced directly from the OS (and not from a CSPRNG
1040 in userspace)
1041 @item Cleaner RSA and DSA key generation (largely based on FIPS 186-4)
1042 @item Major clean-ups and simplification of the code base
1043 @end itemize
1044
1045 This package provides drop-in compatibility with PyCrypto. It is one of two
1046 PyCryptodome variants, the other being python-pycryptodomex.")
1047 (license (list license:bsd-2
1048 license:public-domain)))) ; code inherited from PyCrypto
1049
1050 (define-public python2-pycryptodome
1051 (package-with-python2 python-pycryptodome))
1052
1053 (define-public python-pycryptodomex
1054 (package (inherit python-pycryptodome)
1055 (name "python-pycryptodomex")
1056 (version (package-version python-pycryptodome))
1057 (source
1058 (origin
1059 (method url-fetch)
1060 (uri (pypi-uri "pycryptodomex" version))
1061 (sha256
1062 (base32 "0lbx4qk3xmwqiidhmkj8qa7bh2lf8bwzg0xjpsh2w5zqjrc7qnvv"))))
1063 (description
1064 "PyCryptodome is a self-contained Python package of low-level
1065 cryptographic primitives. It's not a wrapper to a separate C library like
1066 OpenSSL. To the largest possible extent, algorithms are implemented in pure
1067 Python. Only the pieces that are extremely critical to performance (e.g.,
1068 block ciphers) are implemented as C extensions.
1069
1070 You are expected to have a solid understanding of cryptography and security
1071 engineering to successfully use these primitives. You must also be able to
1072 recognize that some are obsolete (e.g., TDES) or even insecure (RC4).
1073
1074 It provides many enhancements over the last release of PyCrypto (2.6.1):
1075
1076 @itemize
1077 @item Authenticated encryption modes (GCM, CCM, EAX, SIV, OCB)
1078 @item Accelerated AES on Intel platforms via AES-NI
1079 @item First-class support for PyPy
1080 @item Elliptic curves cryptography (NIST P-256 curve only)
1081 @item Better and more compact API (nonce and iv attributes for ciphers,
1082 automatic generation of random nonces and IVs, simplified CTR cipher mode, and
1083 more)
1084 @item SHA-3 (including SHAKE XOFs) and BLAKE2 hash algorithms
1085 @item Salsa20 and ChaCha20 stream ciphers
1086 @item scrypt and HKDF
1087 @item Deterministic (EC)DSA
1088 @item Password-protected PKCS#8 key containers
1089 @item Shamir’s Secret Sharing scheme
1090 @item Random numbers get sourced directly from the OS (and not from a CSPRNG
1091 in userspace)
1092 @item Cleaner RSA and DSA key generation (largely based on FIPS 186-4)
1093 @item Major clean-ups and simplification of the code base
1094 @end itemize
1095
1096 PyCryptodomex is the stand-alone version of PyCryptodome that no longer
1097 provides drop-in compatibility with PyCrypto.")))
1098
1099 (define-public python-m2crypto
1100 (package
1101 (name "python-m2crypto")
1102 (version "0.35.2")
1103 (source
1104 (origin
1105 (method url-fetch)
1106 (uri (pypi-uri "M2Crypto" version))
1107 (sha256
1108 (base32 "09yirf3w77w6f49q6nxhrjm9c3a4y9s30s1k09chqrw8zdgx8sjc"))))
1109 (build-system python-build-system)
1110 (inputs `(("openssl" ,openssl)))
1111 (native-inputs `(("swig" ,swig)))
1112 (home-page "https://gitlab.com/m2crypto/m2crypto")
1113 (synopsis "Python crypto and TLS toolkit")
1114 (description "@code{M2Crypto} is a complete Python wrapper for OpenSSL
1115 featuring RSA, DSA, DH, EC, HMACs, message digests, symmetric ciphers
1116 (including AES); TLS functionality to implement clients and servers; HTTPS
1117 extensions to Python's httplib, urllib, and xmlrpclib; unforgeable HMAC'ing
1118 AuthCookies for web session management; FTP/TLS client and server; S/MIME;
1119 M2Crypto can also be used to provide TLS for Twisted. Smartcards supported
1120 through the Engine interface.")
1121 (properties `((python2-variant . ,(delay python2-m2crypto))))
1122 (license license:expat)))
1123
1124 (define-public python2-m2crypto
1125 (let ((m2crypto (package-with-python2
1126 (strip-python2-variant python-m2crypto))))
1127 (package (inherit m2crypto)
1128 (propagated-inputs
1129 `(("python2-typing" ,python2-typing))))))
1130
1131 (define-public python-pykeepass
1132 (package
1133 (name "python-pykeepass")
1134 (version "3.2.1")
1135 (source
1136 (origin
1137 (method git-fetch)
1138 ;; Source tarball on PyPI doesn't include tests.
1139 (uri (git-reference
1140 (url "https://github.com/libkeepass/pykeepass")
1141 (commit version)))
1142 (file-name (git-file-name name version))
1143 (sha256
1144 (base32 "1symxf4ahylynihnp9z4z3lh2vy65ipvg8s4hjrnn936hcaaxghk"))))
1145 (build-system python-build-system)
1146 (arguments
1147 `(#:phases
1148 (modify-phases %standard-phases
1149 (add-after 'unpack 'make-kdbx-writable
1150 ;; Tests have to write to the .kdbx files in the test directory.
1151 (lambda _
1152 (with-directory-excursion "tests"
1153 (for-each make-file-writable (find-files "."))
1154 #t)))
1155 (add-before 'build 'patch-requirements
1156 (lambda _
1157 ;; Update requirements from dependency==version
1158 ;; to dependency>=version.
1159 (substitute* "setup.py"
1160 (("==") ">="))
1161 #t)))))
1162 (propagated-inputs
1163 `(("python-argon2-cffi" ,python-argon2-cffi)
1164 ("python-construct" ,python-construct)
1165 ("python-dateutil" ,python-dateutil)
1166 ("python-future" ,python-future)
1167 ("python-lxml" ,python-lxml)
1168 ("python-pycryptodomex" ,python-pycryptodomex)))
1169 (home-page "https://github.com/libkeepass/pykeepass")
1170 (synopsis "Python library to interact with keepass databases")
1171 (description
1172 "This library allows you to write entries to a KeePass database. It
1173 supports KDBX3 and KDBX4.")
1174 ;; There are no copyright headers in the source code. The LICENSE file
1175 ;; indicates GPL3.
1176 (license license:gpl3+)))
1177
1178 (define-public python-pylibscrypt
1179 (package
1180 (name "python-pylibscrypt")
1181 (version "1.7.1")
1182 (source
1183 (origin
1184 (method url-fetch)
1185 (uri (pypi-uri "pylibscrypt" version))
1186 (sha256
1187 (base32
1188 "1b3rgzl6dbzs08vhv41b6y4n5189wv7lr27acxn104hs45745abs"))))
1189 (build-system python-build-system)
1190 (arguments
1191 `(#:phases
1192 (modify-phases %standard-phases
1193 (add-before 'build 'hard-code-path-to-libscrypt
1194 (lambda* (#:key inputs #:allow-other-keys)
1195 (let ((libscrypt (assoc-ref inputs "libscrypt")))
1196 (substitute* "pylibscrypt/pylibscrypt.py"
1197 (("find_library\\('scrypt'\\)")
1198 (string-append "'" libscrypt "/lib/libscrypt.so'")))
1199 #t))))
1200 ;; The library can use various scrypt implementations and tests all of
1201 ;; them. Since we only provide a single implementation, most tests
1202 ;; fail. Simply skip them.
1203 #:tests? #f))
1204 ;; FIXME: Using "libscrypt" is the second best choice. The best one
1205 ;; requires "hashlib.scrypt", provided by Python 3.6+ built with OpenSSL
1206 ;; 1.1+. Use that as soon as Guix provides it.
1207 (inputs
1208 `(("libscrypt" ,libscrypt)))
1209 (home-page "https://github.com/jvarho/pylibscrypt")
1210 (synopsis "Scrypt for Python")
1211 (description "There are a lot of different scrypt modules for Python, but
1212 none of them have everything that I'd like, so here's one more. It uses
1213 @code{libscrypt}.")
1214 (license license:isc)))
1215
1216 (define-public python-libnacl
1217 (package
1218 (name "python-libnacl")
1219 (version "1.7.2")
1220 (source
1221 (origin
1222 (method url-fetch)
1223 (uri (pypi-uri "libnacl" version))
1224 (sha256
1225 (base32
1226 "0srx7i264v4dq9and8y6gpzzhrg8jpxs5iy9ggw4plimfj0rjfdm"))))
1227 (build-system python-build-system)
1228 (arguments
1229 `(#:phases
1230 (modify-phases %standard-phases
1231 (add-after 'unpack 'locate-libsodium
1232 (lambda* (#:key inputs #:allow-other-keys)
1233 (substitute* "libnacl/__init__.py"
1234 (("/usr/local/lib/libsodium.so")
1235 (string-append (assoc-ref inputs "libsodium")
1236 "/lib/libsodium.so")))
1237 #t)))))
1238 (native-inputs
1239 `(("python-pyhamcrest" ,python-pyhamcrest)))
1240 (inputs
1241 `(("libsodium" ,libsodium)))
1242 (home-page "https://libnacl.readthedocs.org/")
1243 (synopsis "Python bindings for libsodium based on ctypes")
1244 (description "@code{libnacl} is used to gain direct access to the
1245 functions exposed by @code{NaCl} library via @code{libsodium}. It has
1246 been constructed to maintain extensive documentation on how to use
1247 @code{NaCl} as well as being completely portable.")
1248 (license license:asl2.0)))
1249
1250 (define-public python-pyotp
1251 (package
1252 (name "python-pyotp")
1253 (version "2.4.1")
1254 (source
1255 (origin
1256 (method url-fetch)
1257 (uri (pypi-uri "pyotp" version))
1258 (sha256
1259 (base32 "0jsqfmx9i7j8z81r4zazv76xzy1fcq8v9s2r4kvx7ajfndq3z2h3"))))
1260 (build-system python-build-system)
1261 (home-page "https://github.com/pyauth/pyotp")
1262 (synopsis "Python One Time Password Library")
1263 (description
1264 "PyOTP is a Python library for generating and verifying one-time
1265 passwords. It can be used to implement two-factor (2FA) or multi-factor
1266 (MFA) authentication methods in web applications and in other systems that
1267 require users to log in.")
1268 (license license:expat)))
1269
1270 (define-public python-scrypt
1271 (package
1272 (name "python-scrypt")
1273 (version "0.8.7")
1274 (source
1275 (origin
1276 (method url-fetch)
1277 (uri (pypi-uri "scrypt" version))
1278 (sha256
1279 (base32
1280 "0hjk71k3mgnl8siikm9lii9im8kv0rb7inkjzx78rnancra48xxr"))))
1281 (build-system python-build-system)
1282 (inputs
1283 `(("openssl" ,openssl)))
1284 (home-page "https://bitbucket.org/mhallin/py-scrypt")
1285 (synopsis "Bindings for the scrypt key derivation function library")
1286 (description "This is a set of Python bindings for the scrypt key
1287 derivation function.")
1288 (license license:bsd-2)))
1289
1290 (define-public python-service-identity
1291 (package
1292 (name "python-service-identity")
1293 (version "18.1.0")
1294 (source
1295 (origin
1296 (method url-fetch)
1297 (uri (pypi-uri "service_identity" version))
1298 (sha256
1299 (base32
1300 "0b9f5qiqjy8ralzgwjgkhx82h6h8sa7532psmb8mkd65md5aan08"))))
1301 (build-system python-build-system)
1302 (propagated-inputs
1303 `(("python-attrs" ,python-attrs)
1304 ("python-pyasn1" ,python-pyasn1)
1305 ("python-pyasn1-modules" ,python-pyasn1-modules)
1306 ("python-pyopenssl" ,python-pyopenssl)))
1307 (home-page "https://service-identity.readthedocs.io/")
1308 (synopsis "Service identity verification for PyOpenSSL")
1309 (description
1310 "@code{service_identity} aspires to give you all the tools you need
1311 for verifying whether a certificate is valid for the intended purposes.
1312 In the simplest case, this means host name verification. However,
1313 service_identity implements RFC 6125 fully and plans to add other
1314 relevant RFCs too.")
1315 (license license:expat)))
1316
1317 (define-public python2-service-identity
1318 (package-with-python2 python-service-identity))
1319
1320 (define-public python-hkdf
1321 (package
1322 (name "python-hkdf")
1323 (version "0.0.3")
1324 (source
1325 (origin
1326 (method url-fetch)
1327 (uri (pypi-uri "hkdf" version))
1328 (sha256
1329 (base32
1330 "1jhxk5vhxmxxjp3zj526ry521v9inzzl8jqaaf0ma65w6k332ak2"))))
1331 (build-system python-build-system)
1332 (native-inputs
1333 `(("python-nose" ,python-nose)))
1334 (home-page "https://github.com/casebeer/python-hkdf")
1335 (synopsis "HMAC-based Extract-and-Expand Key Derivation Function (HKDF)")
1336 (description "This package provides a Python implementation of the HMAC Key
1337 Derivation function (HKDF) defined in RFC 5869.")
1338 (license license:bsd-2)))
1339
1340 (define-public python-spake2
1341 (package
1342 (name "python-spake2")
1343 (version "0.8")
1344 (source
1345 (origin
1346 (method url-fetch)
1347 (uri (pypi-uri "spake2" version))
1348 (sha256
1349 (base32
1350 "1x16r7lrbklvfzbacb66qv9iiih6liq1y612dqh2chgf555n2yn1"))))
1351 (build-system python-build-system)
1352 (propagated-inputs
1353 `(("python-hkdf" ,python-hkdf)))
1354 (home-page "https://github.com/warner/python-spake2")
1355 (synopsis "SPAKE2 password-authenticated key exchange in Python")
1356 (description "This package provides a Python implementation of the SPAKE2
1357 Password-Authenticated Key Exchange algorithm.")
1358 (license license:expat)))
1359
1360 (define-public python-txtorcon
1361 (package
1362 (name "python-txtorcon")
1363 (version "19.0.0")
1364 (source
1365 (origin
1366 (method url-fetch)
1367 (uri (pypi-uri "txtorcon" version))
1368 (sha256
1369 (base32
1370 "0fxzhsc62bhmr730vj9pzallmw56gz6iykvl28a5agrycm0bfc9p"))))
1371 (build-system python-build-system)
1372 (arguments
1373 ;; The tests fail immediately due to a missing file. Reported upstream:
1374 ;; <https://github.com/meejah/txtorcon/issues/330>
1375 `(#:tests? #f))
1376 (propagated-inputs
1377 `(("python-automat" ,python-automat)
1378 ("python-idna" ,python-idna)
1379 ("python-incremental" ,python-incremental)
1380 ("python-service-identity" ,python-service-identity)
1381 ("python-twisted" ,python-twisted)
1382 ("python-zope-interface" ,python-zope-interface)))
1383 (home-page "https://github.com/meejah/txtorcon")
1384 (synopsis "Twisted-based Tor controller client")
1385 (description "This package provides a Twisted-based Tor controller client,
1386 with state-tracking and configuration abstractions.")
1387 (license license:expat)))
1388
1389 (define-public python-keyutils
1390 (package
1391 (name "python-keyutils")
1392 (version "0.6")
1393 (source
1394 (origin
1395 (method url-fetch)
1396 (uri (pypi-uri "keyutils" version))
1397 (sha256
1398 (base32
1399 "0lipygpzhwzzsq2k5imb1jgkmj8y4khxdwhzadjs3bd56g6bmkx9"))))
1400 (build-system python-build-system)
1401 (native-inputs
1402 `(("python-pytest" ,python-pytest)
1403 ("python-pytest-runner" ,python-pytest-runner)))
1404 (inputs
1405 `(("keyutils" ,keyutils)))
1406 (arguments
1407 '(#:tests? #f))
1408 (home-page "https://github.com/sassoftware/python-keyutils")
1409 (synopsis "Python bindings for keyutils")
1410 (description
1411 "This is a set of python bindings for keyutils, a key management suite
1412 that leverages the infrastructure provided by the Linux kernel for safely
1413 storing and retrieving sensitive information in your programs.")
1414 (license license:asl2.0)))
1415
1416 (define-public python-mcuboot-imgtool
1417 (package
1418 (name "python-mcuboot-imgtool")
1419 (version "1.4.0")
1420 (source
1421 (origin
1422 (method git-fetch)
1423 (uri (git-reference
1424 (url "https://github.com/JuulLabs-OSS/mcuboot")
1425 (commit (string-append "v" version))))
1426 (file-name (git-file-name name version))
1427 (sha256
1428 (base32
1429 "1m1csyvzq4jx81zg635ssy1n7sc0z539z0myh872ll3nwqx7wa0q"))))
1430 (build-system python-build-system)
1431 (arguments
1432 `(#:phases
1433 (modify-phases %standard-phases
1434 (add-after 'unpack 'fix-broken-test
1435 (lambda _
1436 (substitute* "scripts/imgtool/keys/ed25519_test.py"
1437 (("raw_sign") "sign_digest"))
1438 #t))
1439 (add-before 'build 'change-directory
1440 (lambda _
1441 (chdir "scripts")
1442 #t)))))
1443 (propagated-inputs
1444 `(("python-click" ,python-click)
1445 ("python-intelhex" ,python-intelhex)
1446 ("python-cryptography" ,python-cryptography)))
1447 (home-page "https://mcuboot.com")
1448 (synopsis "Tool to securely sign firmware images for booting by MCUboot")
1449 (description "MCUboot is a secure bootloader for 32-bit MCUs. This
1450 package provides a tool to securely sign firmware images for booting by
1451 MCUboot.")
1452 (license license:expat)))
1453
1454 (define-public python-ntlm-auth
1455 (package
1456 (name "python-ntlm-auth")
1457 (version "1.4.0")
1458 (source
1459 (origin
1460 (method url-fetch)
1461 (uri (pypi-uri "ntlm-auth" version))
1462 (sha256
1463 (base32
1464 "16mavidki4ma5ip8srqalr19gz4f5yn3cnmmgps1fmgfr24j63rm"))))
1465 (build-system python-build-system)
1466 (propagated-inputs
1467 `(("python-cryptography" ,python-cryptography)))
1468 (home-page "https://github.com/jborean93/ntlm-auth")
1469 (synopsis
1470 "Calculates NTLM Authentication codes")
1471 (description
1472 "This library handles the low-level details of NTLM authentication for
1473 use in authenticating with a service that uses NTLM. It will create and parse
1474 the 3 different message types in the order required and produce a base64
1475 encoded value that can be attached to the HTTP header.
1476
1477 The goal of this library is to offer full NTLM support including signing and
1478 sealing of messages as well as supporting MIC for message integrity and the
1479 ability to customise and set limits on the messages sent. Please see Features
1480 and Backlog for a list of what is and is not currently supported.")
1481 (license license:expat)))
1482
1483 (define-public python-secretstorage
1484 (package
1485 (name "python-secretstorage")
1486 (version "3.1.2")
1487 (source
1488 (origin
1489 (method url-fetch)
1490 (uri (pypi-uri "SecretStorage" version))
1491 (sha256
1492 (base32
1493 "1xmzr0j3066s220bss4nkgqbiwb5k4kkp2rkpqlqwjb5kfc8mnhm"))))
1494 (build-system python-build-system)
1495 (arguments
1496 '(#:tests? #f)) ; Tests require a running dbus service.
1497 (propagated-inputs
1498 `(("python-cryptography" ,python-cryptography)
1499 ("python-jeepney" ,python-jeepney)))
1500 (home-page "https://github.com/mitya57/secretstorage")
1501 (synopsis "Python bindings to FreeDesktop.org Secret Service API")
1502 (description
1503 "@code{python-secretstorage} provides a way for securely storing passwords
1504 and other secrets. It uses D-Bus Secret Service API that is supported by GNOME
1505 Keyring (since version 2.30) and KSecretsService. SecretStorage supports most
1506 of the functions provided by Secret Service, including creating and deleting
1507 items and collections, editing items, locking and unlocking collections
1508 (asynchronous unlocking is also supported).")
1509 (license license:bsd-3)))
1510
1511 (define-public python-trustme
1512 (package
1513 (name "python-trustme")
1514 (version "0.6.0")
1515 (source
1516 (origin
1517 (method url-fetch)
1518 (uri (pypi-uri "trustme" version))
1519 (sha256
1520 (base32 "0v3vr5z6apnfmklf07m45kv5kaqvm6hxrkaqywch57bjd2siiywx"))))
1521 (build-system python-build-system)
1522 (arguments
1523 `(#:phases
1524 (modify-phases %standard-phases
1525 (replace 'check
1526 (lambda* (#:key inputs outputs #:allow-other-keys)
1527 (add-installed-pythonpath inputs outputs)
1528 (invoke "pytest" "-vv"))))))
1529 (native-inputs
1530 `(("python-more-itertools" ,python-more-itertools)
1531 ("python-pyopenssl" ,python-pyopenssl)
1532 ("python-pytest" ,python-pytest)
1533 ("python-pytest-cov" ,python-pytest-cov)
1534 ("python-service-identity" ,python-service-identity)
1535 ("python-zipp" ,python-zipp)))
1536 (propagated-inputs
1537 `(("python-cryptography" ,python-cryptography)))
1538 (home-page "https://github.com/python-trio/trustme")
1539 (synopsis "Fake a certificate authority for tests")
1540 (description
1541 "@code{trustme} is a tiny Python package that does one thing: it gives you
1542 a fake certificate authority (CA) that you can use to generate fake TLS certs to
1543 use in your tests.")
1544 ;; Either license applies.
1545 (license (list license:expat license:asl2.0))))
1546
1547 (define-public python-certipy
1548 (package
1549 (name "python-certipy")
1550 (version "0.1.3")
1551 (source
1552 (origin
1553 (method url-fetch)
1554 (uri (pypi-uri "certipy" version))
1555 (sha256
1556 (base32
1557 "0n980gqpzh0fm58h3i4mi2i10wgj606lscm1r5sk60vbf6vh8mv9"))))
1558 (build-system python-build-system)
1559 (propagated-inputs
1560 `(("python-pyopenssl" ,python-pyopenssl)))
1561 (native-inputs
1562 `(("python-pytest" ,python-pytest)))
1563 (home-page "https://github.com/LLNL/certipy")
1564 (synopsis "Utility to create and sign CAs and certificates")
1565 (description
1566 "Certipy was made to simplify the certificate creation process. To that
1567 end, certipy exposes methods for creating and managing certificate authorities,
1568 certificates, signing and building trust bundles.")
1569 (license license:bsd-3)))
1570
1571 (define-public python-jeepney
1572 (package
1573 (name "python-jeepney")
1574 (version "0.6.0")
1575 (source
1576 (origin
1577 (method url-fetch)
1578 (uri (pypi-uri "jeepney" version))
1579 (sha256
1580 (base32 "0mw6ch5s4czpmsiwqwhcidgk27858pl8vlvb7acrxjkm4ribcnbx"))))
1581 (build-system python-build-system)
1582 (native-inputs
1583 `(("python-testpath" ,python-testpath)
1584 ("python-tornado" ,python-tornado)
1585 ("python-trio" ,python-trio)
1586 ("python-pytest" ,python-pytest)
1587 ("python-pytest-trio" ,python-pytest-trio)))
1588 (home-page "https://gitlab.com/takluyver/jeepney")
1589 (synopsis "Low-level, pure Python DBus protocol wrapper")
1590 (description
1591 "This is a low-level, pure Python DBus protocol client. It has an
1592 I/O-free core, and integration modules for different event loops.")
1593 (license license:expat)))
1594
1595 (define-public python-argon2-cffi
1596 (package
1597 (name "python-argon2-cffi")
1598 (version "20.1.0")
1599 (source
1600 (origin
1601 (method url-fetch)
1602 (uri (pypi-uri "argon2-cffi" version))
1603 (sha256
1604 (base32
1605 "0zgr4mnnm0p4i99023safb0qb8cgvl202nly1rvylk2b7qnrn0nq"))
1606 (modules '((guix build utils)))
1607 (snippet '(begin (delete-file-recursively "extras") #t))))
1608 (build-system python-build-system)
1609 (arguments
1610 '(#:phases
1611 (modify-phases %standard-phases
1612 (replace 'build
1613 (lambda _
1614 (setenv "ARGON2_CFFI_USE_SYSTEM" "1")
1615 (invoke "python" "setup.py" "build")))
1616 (replace 'check
1617 (lambda* (#:key inputs outputs #:allow-other-keys)
1618 (add-installed-pythonpath inputs outputs)
1619 (invoke "pytest")
1620 (invoke "python" "-m" "argon2" "--help")
1621 ;; see tox.ini
1622 (invoke "python" "-m" "argon2" "-n" "1" "-t" "1" "-m" "8" "-p" "1"))))))
1623 (propagated-inputs
1624 `(("python-cffi" ,python-cffi)
1625 ("python-six" ,python-six)))
1626 (inputs `(("argon2" ,argon2)))
1627 (native-inputs
1628 `(("python-hypothesis" ,python-hypothesis)
1629 ("python-pytest" ,python-pytest)))
1630 (home-page "https://argon2-cffi.readthedocs.io/")
1631 (synopsis "Secure Password Hashes for Python")
1632 (description
1633 "Argon2 is a secure password hashing algorithm. It is designed to have
1634 both a configurable runtime as well as memory consumption. This means that you
1635 can decide how long it takes to hash a password and how much memory is required.")
1636 (license license:expat)))
1637
1638 (define-public python-privy
1639 (package
1640 (name "python-privy")
1641 (version "6.0.0")
1642 (source
1643 (origin
1644 (method git-fetch)
1645 (uri (git-reference
1646 ;; Releases are untagged
1647 (url "https://github.com/ofek/privy")
1648 (commit "2838db3df239797c71bddacc48a4c49a83f35747")))
1649 (file-name (git-file-name name version))
1650 (sha256
1651 (base32
1652 "1m32dh5fqc8cy7jyf1z5fs6zvmdkbq5fi98hr609gbl7s0l0y0i9"))))
1653 (build-system python-build-system)
1654 (arguments
1655 '(#:phases
1656 (modify-phases %standard-phases
1657 (replace 'check
1658 (lambda _
1659 (invoke "python" "-m" "pytest"))))))
1660 (native-inputs
1661 `(("python-pytest" ,python-pytest)))
1662 (propagated-inputs
1663 `(("python-argon2-cffi" ,python-argon2-cffi)
1664 ("python-cryptography" ,python-cryptography)))
1665 (home-page "https://www.dropbox.com/developers")
1666 (synopsis "Library to password-protect your data")
1667 (description
1668 "Privy is a small and fast utility for password-protecting secret
1669 data such as API keys, cryptocurrency wallets, or seeds for digital
1670 signatures.")
1671 (license (list license:expat license:asl2.0)))) ; dual licensed
1672
1673 (define-public python-pgpy
1674 (package
1675 (name "python-pgpy")
1676 (version "0.5.3")
1677 (source
1678 (origin
1679 (method url-fetch)
1680 (uri (pypi-uri "PGPy" version))
1681 (sha256
1682 (base32 "11rrq15gmn6qbahli7czflfcngjl7zyybjlvk732my6axnf2d754"))))
1683 (build-system python-build-system)
1684 (arguments
1685 `(#:phases
1686 (modify-phases %standard-phases
1687 (replace 'check
1688 (lambda* (#:key tests? #:allow-other-keys)
1689 (when tests?
1690 (invoke "pytest")))))))
1691 (native-inputs
1692 `(("python-cryptography" ,python-cryptography)
1693 ("python-pyasn1" ,python-pyasn1)
1694 ("python-pytest" ,python-pytest)
1695 ("python-singledispatch" ,python-singledispatch)
1696 ("python-six" ,python-six)
1697 ("python-wheel" ,python-wheel)))
1698 (home-page "https://github.com/SecurityInnovation/PGPy")
1699 (synopsis "Python implementation of OpenPGP")
1700 (description
1701 "Currently, PGPy can load keys and signatures of all kinds in both ASCII
1702 armored and binary formats.
1703
1704 It can create and verify RSA, DSA, and ECDSA signatures, at the moment. It
1705 can also encrypt and decrypt messages using RSA and ECDH.")
1706 (license license:bsd-3)))
1707
1708 (define-public python-sop
1709 (package
1710 (name "python-sop")
1711 (version "0.2.0")
1712 (source
1713 (origin
1714 (method url-fetch)
1715 (uri (pypi-uri "sop" version))
1716 (sha256
1717 (base32
1718 "0gljyjsdn6hdmwlwwb5g5s0c031p6izamvfxp0d39x60af8k5jyf"))))
1719 (build-system python-build-system)
1720 (arguments
1721 '(#:tests? #f)) ; There are no tests, and unittest throws an error trying
1722 ; to find some:
1723 ; TypeError: don't know how to make test from: 0.2.0
1724 (home-page "https://gitlab.com/dkg/python-sop")
1725 (synopsis "Stateless OpenPGP Command-Line Interface")
1726 (description
1727 "The Stateless OpenPGP Command-Line Interface (or sop) is a
1728 specification that encourages OpenPGP implementors to provide a common,
1729 relatively simple command-line API for purposes of object security.
1730
1731 This Python module helps implementers build such a CLI from any implementation
1732 accessible to the Python interpreter.
1733
1734 It does not provide such an implementation itself -- this is just the
1735 scaffolding for the command line, which should make it relatively easy to
1736 supply a handful of python functions as methods to a class.")
1737 (license license:expat))) ; MIT license