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