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