projects/guix·blob version-1.4.0 · refs

1797 lines · 65.6 KiB

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