projects/guix·blob wip-postfix · refs

1731 lines · 64.8 KiB

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