projects/guix·blob hurd-team · refs

1994 lines · 72.9 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Eric Dvorsak <[email protected]>
3;;; Copyright © 2015-2021, 2023, 2024 Efraim Flashner <[email protected]>
4;;; Copyright © 2015, 2016, 2017, 2019 Leo Famulari <[email protected]>
5;;; Copyright © 2016, 2017, 2020, 2022, 2023 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, 2024, 2025 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, 2025 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 Artyom V. Poptsov <[email protected]>
30;;; Copyright © 2022 Antero Mejr <[email protected]>
31;;; Copyright © 2023 Juliana Sims <[email protected]>
32;;; Copyright © 2023, 2025 Zheng Junjie <[email protected]>
33;;; Copyright © 2024 jgart <[email protected]>
34;;; Copyright © 2025 Sharlatan Hellseher <[email protected]>
35;;; Copyright © 2025 Nguyễn Gia Phong <[email protected]>
36;;; Copyright © 2025 Adrien 'neox' Bourmault <[email protected]>
37;;;
38;;; This file is part of GNU Guix.
39;;;
40;;; GNU Guix is free software; you can redistribute it and/or modify it
41;;; under the terms of the GNU General Public License as published by
42;;; the Free Software Foundation; either version 3 of the License, or (at
43;;; your option) any later version.
44;;;
45;;; GNU Guix is distributed in the hope that it will be useful, but
46;;; WITHOUT ANY WARRANTY; without even the implied warranty of
47;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48;;; GNU General Public License for more details.
49;;;
50;;; You should have received a copy of the GNU General Public License
51;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
52
53(define-module (gnu packages python-crypto)
54 #:use-module (guix packages)
55 #:use-module (guix download)
56 #:use-module (guix gexp)
57 #:use-module (guix hg-download)
58 #:use-module (guix git-download)
59 #:use-module (guix build-system cargo)
60 #:use-module (guix build-system pyproject)
61 #:use-module (guix build-system python)
62 #:use-module (guix utils)
63 #:use-module (gnu packages)
64 #:use-module (gnu packages nss)
65 #:use-module (gnu packages bash)
66 #:use-module (gnu packages check)
67 #:use-module (gnu packages crypto)
68 #:use-module (gnu packages kerberos)
69 #:use-module (gnu packages libffi)
70 #:use-module (gnu packages lsof)
71 #:use-module (gnu packages multiprecision)
72 #:use-module (gnu packages password-utils)
73 #:use-module (gnu packages pkg-config)
74 #:use-module (gnu packages protobuf)
75 #:use-module (gnu packages python)
76 #:use-module (gnu packages python-build)
77 #:use-module (gnu packages python-check)
78 #:use-module (gnu packages python-compression)
79 #:use-module (gnu packages python-web)
80 #:use-module (gnu packages python-xyz)
81 #:use-module (gnu packages rust)
82 #:use-module (gnu packages rust-apps)
83 #:use-module (gnu packages security-token)
84 #:use-module (gnu packages swig)
85 #:use-module (gnu packages time)
86 #:use-module (gnu packages tls)
87 #:use-module (gnu packages xml)
88 #:use-module ((guix licenses) #:prefix license:)
89 #:use-module (srfi srfi-1))
90
91(define-public python-base58
92 (package
93 (name "python-base58")
94 (version "2.1.1")
95 (source
96 (origin
97 (method url-fetch)
98 (uri (pypi-uri "base58" version))
99 (sha256
100 (base32 "1317ly0db7nnjg5k58f6nqa0svfcvn446xd5bpiyi0bfbczwpl65"))))
101 (build-system pyproject-build-system)
102 (native-inputs
103 (list python-pyhamcrest
104 python-pytest
105 python-pytest-benchmark
106 python-setuptools
107 python-wheel))
108 (home-page "https://github.com/keis/base58")
109 (synopsis "Base58 and Base58Check implementation")
110 (description
111 "Base58 and Base58Check implementation compatible with what is used by
112the Bitcoin network.")
113 (license license:expat)))
114
115(define-public python-bcrypt
116 (package
117 (name "python-bcrypt")
118 (version "3.2.2") ;the latest not Rust version
119 (source
120 (origin
121 (method url-fetch)
122 (uri (pypi-uri "bcrypt" version))
123 (sha256
124 (base32 "1yvbdfmkssx1jf2lrhbs58xljmyi3p82r7rav82pf1bp44642g23"))))
125 (build-system pyproject-build-system)
126 (native-inputs
127 (list python-pytest
128 python-setuptools))
129 (propagated-inputs
130 (list python-cffi))
131 (home-page "https://github.com/pyca/bcrypt/")
132 (synopsis "Modern password hashing library")
133 (description
134 "Bcrypt is a Python module which provides a password hashing method based
135on the Blowfish password hashing algorithm, as described in
136@url{http://static.usenix.org/events/usenix99/provos.html,\"A Future-Adaptable
137Password Scheme\"} by Niels Provos and David Mazieres.")
138 (license license:asl2.0)))
139
140(define-public python-murmurhash
141 (package
142 (name "python-murmurhash")
143 (version "1.0.10")
144 (source
145 (origin
146 (method git-fetch)
147 (uri (git-reference
148 (url "https://github.com/explosion/murmurhash")
149 (commit (string-append "v" version))))
150 (file-name (git-file-name name version))
151 (sha256
152 (base32 "02ny4391kbrssq9bf7kq75615ragvbjhsqi9hgv7wiaiz6yai1k8"))))
153 (build-system pyproject-build-system)
154 (arguments
155 (list
156 #:phases
157 #~(modify-phases %standard-phases
158 (add-after 'install 'fix-installation
159 (lambda* (#:key inputs outputs #:allow-other-keys)
160 (with-directory-excursion
161 (string-append (site-packages inputs outputs) "/murmurhash")
162 (delete-file-recursively "tests")
163 (delete-file "mrmr.pyx")
164 (for-each
165 (lambda (file)
166 (chmod file #o555))
167 (find-files "." "\\.so$")))))
168 ;; XXX: Otherwise ModuleNotFoundError, and --pyargs doesn't seem
169 ;; to fix the issue.
170 (replace 'check
171 (lambda args
172 (copy-recursively "murmurhash/tests" "tests")
173 (delete-file-recursively "murmurhash")
174 (with-directory-excursion "tests"
175 (apply (assoc-ref %standard-phases 'check) args)))))))
176 (native-inputs
177 (list python-cython
178 python-murmurhash3
179 python-pytest
180 python-setuptools))
181 (home-page "https://github.com/explosion/murmurhash")
182 (synopsis "Cython bindings for MurmurHash2")
183 (description
184 "This package provides Cython bindings for MurmurHash2.")
185 (license license:expat)))
186
187(define-public python-passlib
188 (package
189 (name "python-passlib")
190 (version "1.7.4")
191 (source
192 (origin
193 (method hg-fetch)
194 (uri (hg-reference
195 (url "https://foss.heptapod.net/python-libs/passlib")
196 (changeset version)))
197 (file-name (hg-file-name name version))
198 (sha256
199 (base32 "1knbafs3ckcc6prd1ln2r0sdkawpzx7naf749cj3ljlms8v0bsca"))))
200 (build-system pyproject-build-system)
201 (arguments
202 (list
203 #:phases
204 #~(modify-phases %standard-phases
205 (add-before 'check 'set-PYTHON_EGG_CACHE
206 ;; Some tests require access to "$HOME/.cython".
207 (lambda _
208 (setenv "PYTHON_EGG_CACHE" "/tmp"))))))
209 (native-inputs
210 (list python-pytest python-setuptools python-wheel))
211 (propagated-inputs
212 (list python-argon2-cffi python-bcrypt python-cryptography))
213 (home-page "https://foss.heptapod.net/python-libs/passlib")
214 (synopsis "Comprehensive password hashing framework")
215 (description
216 "Passlib is a password hashing library for Python 2 & 3, which provides
217cross-platform implementations of over 30 password hashing algorithms, as well
218as a framework for managing existing password hashes. It's designed to be
219useful for a wide range of tasks, from verifying a hash found in /etc/shadow,
220to providing full-strength password hashing for multi-user application.")
221 (license license:bsd-3)))
222
223(define-public python-paramiko
224 (package
225 (name "python-paramiko")
226 (version "4.0.0")
227 (source
228 (origin
229 (method url-fetch)
230 (uri (pypi-uri "paramiko" version))
231 (sha256
232 (base32 "17ynnmagd44gpp76r26rz1kldb37f79hm4ibinlckj8c71xz09ba"))))
233 (build-system pyproject-build-system)
234 (native-inputs
235 (list python-icecream
236 python-pytest
237 python-pytest-relaxed
238 python-setuptools))
239 (propagated-inputs
240 (list python-bcrypt
241 python-cryptography
242 python-invoke
243 python-pyasn1
244 python-pynacl))
245 (home-page "https://www.paramiko.org/")
246 (synopsis "SSHv2 protocol library")
247 (description "Paramiko is a python implementation of the SSHv2 protocol,
248providing both client and server functionality. While it leverages a Python C
249extension for low level cryptography (PyCrypto), Paramiko itself is a pure
250Python interface around SSH networking concepts.")
251 (license license:lgpl2.1+)))
252
253(define-public python-ecdsa
254 (package
255 (name "python-ecdsa")
256 (version "0.19.0")
257 (source
258 (origin
259 (method url-fetch)
260 (uri (pypi-uri "ecdsa" version))
261 (sha256
262 (base32 "1y3bmx6aw5klx143jas3czwbsfvr5d3fs8gm1bfh16b5k48svsk0"))))
263 (build-system pyproject-build-system)
264 (arguments
265 (list
266 ;; Test fails with error: AssertionError: KeyboardInterrupt not raised.
267 #:test-flags #~(list "-k" "not test_multithreading_with_interrupts")))
268 (native-inputs
269 (list openssl
270 python-pytest
271 python-setuptools
272 python-wheel))
273 (propagated-inputs
274 (list python-six))
275 (home-page "https://github.com/warner/python-ecdsa")
276 (synopsis "ECDSA cryptographic signature library (pure python)")
277 (description
278 "This is an easy-to-use implementation of ECDSA cryptography (Elliptic
279Curve Digital Signature Algorithm), implemented purely in Python. With this
280library, you can quickly create key pairs (signing key and verifying key), sign
281messages, and verify the signatures. The keys and signatures are very short,
282making them easy to handle and incorporate into other protocols.")
283 (license license:expat)))
284
285(define-public python-kerberos
286 (package
287 (name "python-kerberos")
288 (version "1.3.1")
289 (source
290 (origin
291 (method url-fetch)
292 (uri (pypi-uri "kerberos" version))
293 (sha256
294 (base32 "0b0a8rrwgfjrslz3jd3r5l7vr7jx5bc17sq0dbwn002f58a4dl6d"))))
295 (build-system pyproject-build-system)
296 (arguments
297 ;; No tests in PyPI, provided in Git but all of them require networking.
298 (list #:tests? #f))
299 (native-inputs
300 (list python-setuptools
301 python-wheel))
302 (inputs
303 (list mit-krb5))
304 (home-page "https://github.com/apple/ccs-pykerberos")
305 (synopsis "Python Kerberos library used by CalendarServer")
306 (description
307 "This Python package is a high-level wrapper for Kerberos (GSSAPI)
308operations. The goal is to avoid having to build a module that wraps the
309entire Kerberos.framework, and instead offer a limited set of functions that
310do what is needed for client/server Kerberos authentication based on
311<http://www.ietf.org/rfc/rfc4559.txt>.")
312 (license license:asl2.0)))
313
314(define-public python-keyring
315 (package
316 (name "python-keyring")
317 (version "23.9.3")
318 (source
319 (origin
320 (method url-fetch)
321 (uri (pypi-uri "keyring" version))
322 (sha256
323 (base32
324 "19f4jpsxng9sjfqi8ww5hgg196r2zh1zb8g71wjr1xa27kc1vc39"))))
325 (build-system pyproject-build-system)
326 (arguments
327 (list
328 #:test-flags '(list "-c" "/dev/null") ;avoid extra test dependencies
329 #:phases
330 #~(modify-phases %standard-phases
331 (add-before 'check 'workaround-test-failure
332 (lambda _
333 ;; Workaround a failure in the test_entry_point test (see:
334 ;; https://github.com/jaraco/keyring/issues/526).
335 (delete-file-recursively "keyring.egg-info"))))))
336 (native-inputs
337 (list python-toml
338 python-pytest
339 python-setuptools
340 python-setuptools-scm
341 python-wheel))
342 (propagated-inputs
343 (list python-jaraco-classes
344 python-secretstorage))
345 (home-page "https://github.com/jaraco/keyring")
346 (synopsis "Store and access your passwords safely")
347 (description
348 "The Python keyring lib provides a easy way to access the system keyring
349service from python. It can be used in any application that needs safe
350password storage.")
351 ;; "MIT" and PSF dual license
352 (license license:x11)))
353
354(define-public python-keyrings-alt
355 (package
356 (name "python-keyrings-alt")
357 (version "5.0.2")
358 (source
359 (origin
360 (method url-fetch)
361 (uri (pypi-uri "keyrings_alt" version))
362 (sha256
363 (base32 "1yv9gnmkw6kpsjgnid0k1qcd49n9csqcvf02cl88bcf8knz7w2cg"))))
364 (build-system pyproject-build-system)
365 (native-inputs
366 (list python-keyring
367 python-pytest
368 python-setuptools
369 python-setuptools-scm
370 python-wheel))
371 (propagated-inputs
372 (list python-jaraco-classes
373 python-jaraco-context))
374 (home-page "https://github.com/jaraco/keyrings.alt")
375 (synopsis "Alternate keyring implementations")
376 (description
377 "Keyrings in this package may have security risks or other implications.
378These backends were extracted from the main keyring project to make them
379available for those who wish to employ them, but are discouraged for general
380production use. Include this module and use its backends at your own risk.")
381 (license license:expat)))
382
383(define-public python-blake3
384 (package
385 (name "python-blake3")
386 (version "1.0.8")
387 (source
388 (origin
389 (method url-fetch)
390 (uri (pypi-uri "blake3" version))
391 (sha256
392 (base32 "1fk5n55cl2iigrjdwwsm6h8q6in1l19cihh44s0kbh57ypqcfg2i"))))
393 (build-system cargo-build-system)
394 (arguments
395 (list
396 #:install-source? #f
397 #:imported-modules `(,@%pyproject-build-system-modules
398 ,@%cargo-build-system-modules)
399 #:modules `((guix build cargo-build-system)
400 ((guix build pyproject-build-system) #:prefix py:)
401 (guix build utils))
402 #:phases
403 #~(modify-phases %standard-phases
404 (add-after 'build 'build-python-module
405 (assoc-ref py:%standard-phases 'build))
406 (add-after 'build-python-module 'install-python-module
407 (assoc-ref py:%standard-phases 'install)))))
408 (native-inputs
409 (list python-wrapper
410 maturin))
411 (inputs (cargo-inputs 'python-blake3))
412 (propagated-inputs (list python-typing-extensions))
413 (home-page "https://github.com/oconnor663/blake3-py")
414 (synopsis "Python bindings for the Rust blake3 crate")
415 (description "This package provides Python bindings for the Rust crate of
416blake3, a cryptographic hash function.")
417 ;; This work is released into the public domain with CC0
418 ;; 1.0. Alternatively, it is licensed under the Apache License 2.0.
419 (license (list license:asl2.0 license:cc0))))
420
421(define-public python-certauth
422 (package
423 (name "python-certauth")
424 (version "1.3.0")
425 (source
426 (origin
427 (method url-fetch)
428 (uri (pypi-uri "certauth" version))
429 (sha256
430 (base32
431 "1yxqfb5131wahjyw9pxz03bq476rcfx62s6k53xx4cqbzzgdaqkq"))))
432 (build-system pyproject-build-system)
433 (arguments
434 (list
435 #:test-flags
436 #~(list "-k" (string-join
437 (list
438 ;; Those tests uses PKCS12, which has been removed in
439 ;; pyopenssl 23.3.0:
440 "not test_custom_not_before_not_after"
441 "test_ca_cert_in_mem")
442 " and not "))
443 #:phases
444 #~(modify-phases %standard-phases
445 (add-after 'unpack 'adjust-test
446 (lambda _
447 ;; Newer PyOpenSSL no longer separates extensions with
448 ;; newline (this can be removed for >1.3.0).
449 (substitute* "test/test_certauth.py"
450 (("7334\\\\n, DNS") "7334, DNS")))))))
451 (propagated-inputs
452 (list python-pyopenssl python-tldextract))
453 (native-inputs
454 (list nss-certs-for-test python-pytest python-setuptools))
455 (home-page "https://github.com/ikreymer/certauth")
456 (synopsis "Certificate authority creation tool")
457 (description "This package provides a small library, built on top of
458pyOpenSSL, which allows for creating a custom certificate authority (CA)
459certificate, and generating on-demand dynamic host certs using that CA
460certificate. It is most useful for use with a man-in-the-middle HTTPS proxy,
461for example, for recording or replaying web content.")
462 (license license:expat)))
463
464(define-public python-certifi
465 (package
466 (name "python-certifi")
467 (version "2025.06.15")
468 (source
469 (origin
470 (method git-fetch) ; no tests in PyPI package
471 (uri (git-reference
472 (url "https://github.com/certifi/python-certifi")
473 (commit version)))
474 (file-name (git-file-name name version))
475 (sha256
476 (base32 "1yyy3c64xbwfg2b8hi1fd6vwh56fzc90jfy3czimv5i91gwrl7ba"))
477 (snippet #~(begin
478 (delete-file "certifi/cacert.pem")
479 (delete-file "certifi/core.py")
480 (with-output-to-file "certifi/core.py"
481 (lambda _
482 (display
483 "\"\"\"
484certifi.py
485~~~~~~~~~~
486This file is a Guix-specific version of core.py.
487
488This module returns the installation location of SSL_CERT_FILE or
489/etc/ssl/certs/ca-certificates.crt, or its contents.
490\"\"\"
491import os
492
493_CA_CERTS = None
494
495try:
496 _CA_CERTS = os.environ [\"SSL_CERT_FILE\"]
497except:
498 _CA_CERTS = os.path.join(\"/etc\", \"ssl\", \"certs\", \"ca-certificates.crt\")
499
500def where() -> str:
501 return _CA_CERTS
502
503def contents() -> str:
504 with open(where(), \"r\", encoding=\"ascii\") as data:
505 return data.read()")))))))
506 (build-system pyproject-build-system)
507 (native-inputs
508 (list nss-certs-for-test
509 python-pytest
510 python-setuptools
511 python-wheel))
512 (home-page "https://certifi.io/")
513 (synopsis "Python CA certificate bundle")
514 (description
515 "Certifi is a Python library that contains a CA certificate bundle, which
516is used by the Requests library to verify HTTPS requests.")
517 (license license:asl2.0)))
518
519(define-public python-cryptography-vectors
520 (package
521 (name "python-cryptography-vectors")
522 (version "44.0.0")
523 (source
524 (origin
525 (method url-fetch)
526 (uri (pypi-uri "cryptography_vectors" version))
527 (sha256
528 (base32
529 "1aw06msy65rs27yxfp4xlwfq432ny1af5cx8s7zsbfa5div2hqhh"))))
530 (build-system pyproject-build-system)
531 (arguments (list #:tests? #f)) ; No tests included.
532 (native-inputs
533 (list python-flit-core))
534 (home-page "https://github.com/pyca/cryptography")
535 (synopsis "Test vectors for the cryptography package")
536 (description
537 "This package contains test vectors for the cryptography package.")
538 ;; Distributed under either BSD-3 or ASL2.0
539 (license (list license:bsd-3 license:asl2.0))))
540
541(define-public python-cryptography
542 (package
543 (name "python-cryptography")
544 (version "44.0.0")
545 (source
546 (origin
547 (method url-fetch)
548 (uri (pypi-uri "cryptography" version))
549 (sha256
550 (base32
551 "00is2nzcl2pyhr90llga5mnbw3rvakn75rq10x1r6hhb6i7q6knd"))
552 (snippet
553 #~(begin (use-modules (guix build utils))
554 (for-each delete-file
555 (find-files "." "Cargo\\.lock$"))
556 (substitute* "pyproject.toml"
557 (("locked = true") "offline = true"))))))
558 (build-system pyproject-build-system)
559 (arguments
560 (list
561 #:imported-modules `(,@%cargo-build-system-modules
562 ,@%pyproject-build-system-modules)
563 #:modules '(((guix build cargo-build-system) #:prefix cargo:)
564 (guix build pyproject-build-system)
565 (guix build utils))
566 #:phases
567 #~(modify-phases %standard-phases
568 (add-after 'unpack 'prepare-cargo-build-system
569 (lambda args
570 (for-each
571 (lambda (phase)
572 (format #t "Running cargo phase: ~a~%" phase)
573 (apply (assoc-ref cargo:%standard-phases phase)
574 #:cargo-target #$(cargo-triplet)
575 args))
576 '(unpack-rust-crates
577 configure
578 check-for-pregenerated-files
579 patch-cargo-checksums)))))))
580 (native-inputs
581 (append
582 (list python-certifi
583 python-cffi
584 python-click
585 python-cryptography-vectors
586 python-pretend
587 python-pytest
588 python-pytest-benchmark
589 python-pytest-randomly
590 python-pytest-xdist
591 python-setuptools
592 rust
593 `(,rust "cargo"))
594 (or (and=> (%current-target-system)
595 (compose list make-rust-sysroot))
596 '())))
597 (inputs
598 (cons* maturin openssl (cargo-inputs 'python-cryptography)))
599 (propagated-inputs (list python-cffi))
600 (home-page "https://github.com/pyca/cryptography")
601 (synopsis "Cryptographic recipes and primitives for Python")
602 (description
603 "@code{cryptography} is a package which provides cryptographic recipes
604and primitives to Python developers. It aims to be the “cryptographic
605standard library” for Python. The package includes both high level recipes,
606and low level interfaces to common cryptographic algorithms such as symmetric
607ciphers, message digests and key derivation functions.")
608 ;; Distributed under either BSD-3 or ASL2.0
609 (license (list license:bsd-3 license:asl2.0))))
610
611(define-public python-pyopenssl
612 (package
613 (name "python-pyopenssl")
614 (version "24.3.0")
615 (source
616 (origin
617 (method url-fetch)
618 (uri (pypi-uri "pyopenssl" version))
619 (sha256
620 (base32
621 "0dmv720kn5ws7bs1rkn59qmhzv5wxkkgriampi34g0vxawcs1xs9"))))
622 (build-system pyproject-build-system)
623 (arguments
624 (list
625 #:phases
626 #~(modify-phases %standard-phases
627 (replace 'check
628 (lambda* (#:key tests? #:allow-other-keys)
629 (when tests?
630 ;; PyOpenSSL runs tests against a certificate with a fixed
631 ;; expiry time. To ensure successful builds in the future,
632 ;; set the time to roughly the release date.
633 (invoke "faketime" "2024-07-20" "pytest" "-vv"
634 "--deselect"
635 ;; This test seems to fail when using faketime, at
636 ;; least on aarch64-linux with OSError: [Errno 22]
637 ;; Invalid argument
638 "tests/test_ssl.py::TestDTLS::test_timeout"
639 "-k"
640 ;; This test tries to look up certificates from
641 ;; the compiled-in default path in OpenSSL, which
642 ;; does not exist in the build environment.
643 "not test_fallback_default_verify_paths ")))))))
644 (propagated-inputs (list python-cryptography))
645 (inputs (list openssl))
646 (native-inputs
647 (list libfaketime
648 python-pretend
649 python-pytest
650 python-pytest-rerunfailures
651 python-setuptools))
652 (home-page "https://github.com/pyca/pyopenssl")
653 (synopsis "Python wrapper module around the OpenSSL library")
654 (description "PyOpenSSL is a high-level wrapper around a subset of the
655OpenSSL library.")
656 (properties `((updater-extra-inputs . ("openssl"))
657 (updater-extra-native-inputs . ("libfaketime"))))
658 (license license:asl2.0)))
659
660(define-public python-ed25519
661 (package
662 (name "python-ed25519")
663 (version "1.5")
664 (source
665 (origin
666 (method git-fetch)
667 (uri (git-reference
668 (url "https://github.com/warner/python-ed25519")
669 (commit version)))
670 (file-name (git-file-name name version))
671 (sha256
672 (base32 "0adxfm12wygh2gdsn83xmp1sw7w96ni7mr7v3z3y6q0mvh9n5x0p"))))
673 (build-system pyproject-build-system)
674 (arguments
675 (list
676 #:phases
677 #~(modify-phases %standard-phases
678 ;; XXX: Use custom test back-end on python-team branch.
679 (replace 'check
680 (lambda* (#:key tests? #:allow-other-keys)
681 (when tests? (invoke "python" "test_ed25519_kat.py")))))))
682 (native-inputs (list python-setuptools))
683 (home-page "https://github.com/warner/python-ed25519")
684 (synopsis "Ed25519 public-key signatures")
685 (description
686 "This package provides Ed25519 public-key signatures in Python.")
687 (license license:expat)))
688
689(define-public python-axolotl-curve25519
690 (package
691 (name "python-axolotl-curve25519")
692 (version "0.4.1.post2")
693 (source
694 (origin
695 (method url-fetch)
696 (uri (pypi-uri "python-axolotl-curve25519" version))
697 (sha256
698 (base32
699 "18v3rfyv7xi26fb97nw1xc0l6x8wi0i4xj8dlq4gblpbjxiac187"))))
700 (build-system pyproject-build-system)
701 (arguments
702 (list
703 #:tests? #f ; No tests.
704 #:phases
705 #~(modify-phases %standard-phases
706 (add-after 'unpack 'relax-gcc-14-strictness
707 (lambda _
708 (setenv "CFLAGS"
709 (string-append "-g -O2 -Wno-error=int-conversion")))))))
710 (native-inputs (list python-setuptools))
711 (home-page "https://github.com/tgalal/python-axolotl-curve25519")
712 (synopsis "Python wrapper for curve25519 library")
713 (description "This is a python wrapper for the curve25519 library
714with ed25519 signatures. The C code was pulled from
715libaxolotl-android. At the moment this wrapper is meant for use by
716python-axolotl.")
717 (license (list license:gpl3 ; Most files
718 license:bsd-3)))) ; curve/curve25519-donna.c
719
720(define-public python-omemo-dr
721 (package
722 (name "python-omemo-dr")
723 (version "1.2.0")
724 (source
725 (origin
726 (method git-fetch)
727 (uri (git-reference
728 (url "https://dev.gajim.org/gajim/omemo-dr")
729 (commit (string-append "v" version))))
730 (file-name (git-file-name name version))
731 (sha256
732 (base32 "18snryk95wyiz5jh5wa5x58yych9d8l9hmnqq828gsb5ncxq3szk"))))
733 (build-system pyproject-build-system)
734 (arguments (list #:test-backend #~'unittest))
735 (propagated-inputs
736 (list python-cryptography python-protobuf-5 python-setuptools))
737 (home-page "https://dev.gajim.org/gajim/omemo-dr")
738 (synopsis "OMEMO cryptography library")
739 (description "OMEMO cryptography library that was forked from python-axolotl.")
740 (license license:gpl3)))
741
742(define-public python-oscrypto
743 (package
744 (name "python-oscrypto")
745 (version "1.3.0")
746 (source
747 (origin
748 (method git-fetch)
749 (uri (git-reference
750 (url "https://github.com/wbond/oscrypto/")
751 (commit version)))
752 (file-name (git-file-name name version))
753 (sha256
754 (base32 "1v5wkmzcyiqy39db8j2dvkdrv2nlsc48556h73x4dzjwd6kg4q0a"))
755 (patches
756 (list
757 (origin
758 (method url-fetch)
759 (uri
760 (string-append "https://github.com/wbond/oscrypto/commit/"
761 "3865f5d528740aa1205d16ddbee84c5b48aeb078.patch"))
762 (sha256
763 (base32
764 "1lnvh5w4x5g4vnl8l078znd040zc6k4y18dzksbj7ydad3hrq73p")))))))
765 (build-system pyproject-build-system)
766 (arguments
767 (list
768 #:test-backend #~'custom
769 #:test-flags
770 #~(list "run.py"
771 (format #f "use_openssl=~a,~a"
772 (search-input-file %build-inputs "/lib/libcrypto.so")
773 (search-input-file %build-inputs "/lib/libssl.so"))
774 "skip_internet=true"
775 "tests")
776 #:phases
777 #~(modify-phases %standard-phases
778 (add-before 'check 'set-envs
779 (lambda* (#:key inputs #:allow-other-keys)
780 (setenv
781 "SSL_CERT_FILE"
782 (search-input-file
783 inputs "/etc/ssl/certs/ca-certificates.crt")))))))
784 (propagated-inputs (list python-asn1crypto))
785 (native-inputs (list nss-certs-for-test openssl python-setuptools))
786 (home-page "https://github.com/wbond/oscrypto/")
787 (synopsis "Compiler-free Python encryption library")
788 (description
789 "@code{Python-oscrypto} is a compilation-free encryption library which
790integrates with the encryption library that is part of the operating system.
791It supports TLS (SSL) sockets, key generation, encryption, decryption,
792signing, verification and KDFs using the OS crypto libraries.")
793 (license license:expat)))
794
795(define-public python-pyaes
796 ;; XXX: Last updated in 2017.
797 (package
798 (name "python-pyaes")
799 (version "1.6.1")
800 (source
801 (origin
802 (method url-fetch)
803 (uri (pypi-uri "pyaes" version))
804 (sha256
805 (base32 "13vdaff15k0jyfcss4b4xvfgm8xyv0nrbyw5n1qc7lrqbi0b3h82"))))
806 (build-system pyproject-build-system)
807 (arguments
808 (list #:tests? #f)) ;no tests in PyPI
809 (native-inputs (list python-setuptools))
810 (home-page "https://github.com/ricmoo/pyaes")
811 (synopsis "Implementation of AES in Python")
812 (description "This package contains a pure-Python implementation of the
813AES block cipher algorithm and the common modes of operation (CBC, CFB, CTR,
814ECB and OFB).")
815 (license license:expat)))
816
817(define-public python-asn1crypto
818 (let ((commit "b763a757bb2bef2ab63620611ddd8006d5e9e4a2")
819 (revision "0"))
820 (package
821 (name "python-asn1crypto")
822 (version (git-version "1.5.1" revision commit))
823 (source
824 (origin
825 (method git-fetch)
826 (uri (git-reference
827 (url "https://github.com/wbond/asn1crypto")
828 (commit commit)))
829 (file-name (git-file-name name version))
830 (sha256
831 (base32 "0xmrms7lj87pskgirf7ff21yih76kp2688x4n24wi2pd8269lmfp"))))
832 (build-system pyproject-build-system)
833 (arguments (list #:test-backend #~'unittest))
834 (native-inputs (list python-setuptools))
835 (home-page "https://github.com/wbond/asn1crypto")
836 (synopsis "ASN.1 parser and serializer in Python")
837 (description
838 "@code{asn1crypto} is an ASN.1 parser and serializer with definitions for
839private keys, public keys, certificates, CRL, OCSP, CMS, PKCS#3, PKCS#7, PKCS#8,
840PKCS#12, PKCS#5, X.509 and TSP.")
841 (license license:expat))))
842
843(define-public python-pynacl
844 (package
845 (name "python-pynacl")
846 (version "1.5.0")
847 (source
848 (origin
849 (method url-fetch)
850 (uri (pypi-uri "PyNaCl" version))
851 (modules '((guix build utils)))
852 (snippet
853 '(begin
854 ;; Remove bundled libsodium.
855 (delete-file-recursively "src/libsodium")))
856 (sha256
857 (base32
858 "1fi0jbxhh3svajzldlb6gj5sr5a48v11xlmx0wb831db167l9iwa"))))
859 (build-system pyproject-build-system)
860 (arguments
861 (list
862 #:phases
863 '(modify-phases %standard-phases
864 (add-before 'build 'use-system-sodium
865 (lambda _
866 (setenv "SODIUM_INSTALL" "system"))))))
867 (native-inputs
868 (list python-hypothesis python-pytest python-setuptools python-wheel))
869 (propagated-inputs
870 (list python-cffi python-six libsodium))
871 (home-page "https://github.com/pyca/pynacl/")
872 (synopsis "Python bindings to libsodium")
873 (description
874 "PyNaCl is a Python binding to libsodium, which is a fork of the
875Networking and Cryptography library. These libraries have a stated goal
876of improving usability, security and speed.")
877 (license license:asl2.0)))
878
879(define-public python-crcmod
880 (package
881 (name "python-crcmod")
882 (version "1.7")
883 (source (origin
884 (method url-fetch)
885 (uri (pypi-uri "crcmod" version))
886 (sha256
887 (base32
888 "07k0hgr42vw2j92cln3klxka81f33knd7459cn3d8aszvfh52w6w"))))
889 (build-system pyproject-build-system)
890 (arguments
891 (list
892 #:test-backend #~'custom
893 #:test-flags #~(list "-m" "crcmod.test")))
894 (native-inputs (list python-setuptools))
895 (synopsis "CRC generator for Python")
896 (description "Python module for generating objects that compute the
897Cyclic Redundancy Check.")
898 (home-page "https://crcmod.sourceforge.net/")
899 (license license:expat)))
900
901(define-public python-blurhash
902 (package
903 (name "python-blurhash")
904 (version "1.1.5")
905 (source
906 (origin
907 (method git-fetch)
908 (uri (git-reference
909 (url "https://github.com/halcy/blurhash-python")
910 (commit (string-append "v" version))))
911 (file-name (git-file-name name version))
912 (sha256
913 (base32 "16xcjxiya773fp7bxs9i6y1wsjx88pdvlwj6bqyy9vf3ckcffcwm"))))
914 (build-system pyproject-build-system)
915 (arguments
916 (list #:test-flags #~(list "-c" "/dev/null")))
917 (native-inputs
918 (list python-numpy python-pillow python-pytest python-setuptools))
919 (home-page "https://github.com/halcy/blurhash-python")
920 (synopsis "Pure-Python implementation of the blurhash algorithm")
921 (description
922 "This package provides a pure Python implementation of the blurhash
923algorithm.")
924 (license license:expat)))
925
926(define-public python-ecpy
927 (package
928 (name "python-ecpy")
929 (version "1.2.5")
930 (source
931 (origin
932 (method git-fetch)
933 (uri (git-reference
934 (url "https://github.com/cslashm/ECPy")
935 (commit version)))
936 (file-name (git-file-name name version))
937 (sha256
938 (base32
939 "0p642bpqicxjkwqk4q46wqkbxhad1qiir6xz4w7xx0d4cdq7yps8"))))
940 (build-system pyproject-build-system)
941 (arguments (list #:tests? #f)) ;no tests
942 (native-inputs
943 (list python-setuptools))
944 (home-page "https://github.com/cslashm/ECPy")
945 (synopsis "Pure Python Elliptic Curve Library")
946 (description "This package provides a Elliptic Curve Library in pure
947Python.")
948 (license license:asl2.0)))
949
950(define-public python-josepy
951 (package
952 (name "python-josepy")
953 (version "2.1.0")
954 (source
955 (origin
956 (method git-fetch)
957 (uri (git-reference
958 (url "https://github.com/certbot/josepy")
959 (commit (string-append "v" version))))
960 (file-name (git-file-name name version))
961 (sha256
962 (base32 "1zplnfrmc4nps9lgl3fz434ja7lmi9v8waydflzvpi75kf5fqxc1"))))
963 (build-system pyproject-build-system)
964 (native-inputs (list python-poetry-core python-pytest))
965 (propagated-inputs (list python-cryptography))
966 (home-page "https://github.com/certbot/josepy")
967 (synopsis "JOSE protocol implementation in Python")
968 (description
969 "This package provides a Python implementation of the JOSE protocol
970(Javascript Object Signing and Encryption).")
971 (license license:asl2.0)))
972
973(define pycryptodome-unbundle-tomcrypt-snippet
974 #~(begin
975 ;; Unbundle libtomcrypt.
976 (delete-file-recursively "src/libtom")
977 (substitute* "src/DES.c"
978 (("#include \"libtom/tomcrypt_des.c\"")
979 "#include <tomcrypt.h>"))
980 (substitute* "setup.py"
981 (("include_dirs=\\['src/', 'src/libtom/'\\]")
982 ;; FIXME: why does '-ltomcrypt' need to be added
983 ;; manually, even when 'tomcrypt' is added to 'libraries'?
984 ;; This behaviour is not documented at
985 ;; <https://docs.python.org/3/extending/building.html>.
986 "include_dirs=['src/'], libraries=['tomcrypt', 'tommath'],
987 extra_link_args=['-ltomcrypt', '-ltommath']"))))
988
989(define-public python-pycryptodome
990 (package
991 (name "python-pycryptodome")
992 (version "3.23.0")
993 (source
994 (origin
995 (method git-fetch)
996 (uri (git-reference
997 (url "https://github.com/Legrandin/pycryptodome")
998 (commit (string-append "v" version))))
999 (file-name (git-file-name name version))
1000 (sha256
1001 (base32 "0j1dk55y0q7gqmig1l5b8774w63w2i7qrii1xzkpzz0c3i229i67"))
1002 (modules '((guix build utils)))
1003 (snippet pycryptodome-unbundle-tomcrypt-snippet)))
1004 (build-system pyproject-build-system)
1005 (arguments
1006 (list
1007 ;; tests: 42912 passed
1008 #:test-backend #~'custom
1009 ;; As seen in
1010 ;; <https://github.com/Legrandin/pycryptodome/blob/v3.23.0/INSTALL.rst>.
1011 #:test-flags
1012 #~(list "-m" "Crypto.SelfTest")
1013 #:phases
1014 #~(modify-phases %standard-phases
1015 (add-after 'unpack 'patch-gmp-path
1016 (lambda* (#:key inputs #:allow-other-keys)
1017 (substitute* "lib/Crypto/Math/_IntegerGMP.py"
1018 (("load_lib\\(\"gmp\"")
1019 (format #f "load_lib(~s"
1020 (search-input-file inputs "/lib/libgmp.so.10")))))))))
1021 (native-inputs
1022 (list python-pycryptodome-test-vectors
1023 python-setuptools))
1024 (inputs
1025 (list gmp
1026 libtomcrypt
1027 libtommath))
1028 (home-page "https://www.pycryptodome.org")
1029 (synopsis "Low-level cryptographic Python library")
1030 (description
1031 "PyCryptodome is a self-contained Python package of low-level
1032cryptographic primitives. It's not a wrapper to a separate C library like
1033OpenSSL. To the largest possible extent, algorithms are implemented in pure
1034Python. Only the pieces that are extremely critical to performance (e.g.,
1035block ciphers) are implemented as C extensions.
1036
1037You are expected to have a solid understanding of cryptography and security
1038engineering to successfully use these primitives. You must also be able to
1039recognize that some are obsolete (e.g., TDES) or even insecure (RC4).
1040
1041It provides many enhancements over the last release of PyCrypto (2.6.1):
1042
1043@itemize
1044@item Authenticated encryption modes (GCM, CCM, EAX, SIV, OCB)
1045@item Accelerated AES on Intel platforms via AES-NI
1046@item First-class support for PyPy
1047@item Elliptic curves cryptography (NIST P-256 curve only)
1048@item Better and more compact API (nonce and iv attributes for ciphers,
1049automatic generation of random nonces and IVs, simplified CTR cipher mode, and
1050more)
1051@item SHA-3 (including SHAKE XOFs) and BLAKE2 hash algorithms
1052@item Salsa20 and ChaCha20 stream ciphers
1053@item scrypt and HKDF
1054@item Deterministic (EC)DSA
1055@item Password-protected PKCS#8 key containers
1056@item Shamir’s Secret Sharing scheme
1057@item Random numbers get sourced directly from the OS (and not from a CSPRNG
1058in userspace)
1059@item Cleaner RSA and DSA key generation (largely based on FIPS 186-4)
1060@item Major clean-ups and simplification of the code base
1061@end itemize
1062
1063This package provides drop-in compatibility with PyCrypto. It is one of two
1064PyCryptodome variants, the other being python-pycryptodomex.")
1065 (license (list license:bsd-2
1066 license:public-domain)))) ; code inherited from PyCrypto
1067
1068(define-public python-pycryptodome-test-vectors
1069 (package
1070 (name "python-pycryptodome-test-vectors")
1071 (version "1.0.22")
1072 (source
1073 (origin
1074 (method url-fetch)
1075 (uri (pypi-uri "pycryptodome_test_vectors" version))
1076 (sha256
1077 (base32 "19bn19fpnkj39nki2dp8k26is5fpqa3q7agkhk9rvfqfvzvgx3nn"))))
1078 (build-system pyproject-build-system)
1079 (arguments
1080 (list #:tests? #f)) ;no tests
1081 (native-inputs
1082 (list python-setuptools))
1083 (home-page "https://www.pycryptodome.org")
1084 (synopsis "Test vectors for PyCryptodome")
1085 (description
1086 "This package provides test vectors for @code{PyCryptodome}.")
1087 (license (list license:bsd-2
1088 license:asl2.0))))
1089
1090(define-public python-pycryptodomex
1091 (package/inherit python-pycryptodome
1092 (name "python-pycryptodomex")
1093 (arguments
1094 (substitute-keyword-arguments arguments
1095 ((#:test-flags _)
1096 #~(list "-m" "Cryptodome.SelfTest"))
1097 ((#:phases phases #~%standard-phases)
1098 #~(modify-phases #$phases
1099 (add-before 'build 'set-separate-namespace
1100 (lambda _
1101 ;; This changes the build logic, see setup.py.
1102 (with-output-to-file ".separate_namespace"
1103 (lambda _ (display "")))))))))
1104 (synopsis
1105 "Low-level cryptographic Python library independent of the old PyCrypto")
1106 (description
1107 "PyCryptodome is a self-contained Python package of low-level
1108cryptographic primitives. It's not a wrapper to a separate C library like
1109OpenSSL. To the largest possible extent, algorithms are implemented in pure
1110Python. Only the pieces that are extremely critical to performance (e.g.,
1111block ciphers) are implemented as C extensions.
1112
1113You are expected to have a solid understanding of cryptography and security
1114engineering to successfully use these primitives. You must also be able to
1115recognize that some are obsolete (e.g., TDES) or even insecure (RC4).
1116
1117It provides many enhancements over the last release of PyCrypto (2.6.1):
1118
1119@itemize
1120@item Authenticated encryption modes (GCM, CCM, EAX, SIV, OCB)
1121@item Accelerated AES on Intel platforms via AES-NI
1122@item First-class support for PyPy
1123@item Elliptic curves cryptography (NIST P-256 curve only)
1124@item Better and more compact API (nonce and iv attributes for ciphers,
1125automatic generation of random nonces and IVs, simplified CTR cipher mode, and
1126more)
1127@item SHA-3 (including SHAKE XOFs) and BLAKE2 hash algorithms
1128@item Salsa20 and ChaCha20 stream ciphers
1129@item scrypt and HKDF
1130@item Deterministic (EC)DSA
1131@item Password-protected PKCS#8 key containers
1132@item Shamir’s Secret Sharing scheme
1133@item Random numbers get sourced directly from the OS (and not from a CSPRNG
1134in userspace)
1135@item Cleaner RSA and DSA key generation (largely based on FIPS 186-4)
1136@item Major clean-ups and simplification of the code base
1137@end itemize
1138
1139PyCryptodomex is the stand-alone version of PyCryptodome that no longer
1140provides drop-in compatibility with PyCrypto.")))
1141
1142(define-public python-m2crypto
1143 (package
1144 (name "python-m2crypto")
1145 (version "0.47.0")
1146 (source
1147 (origin
1148 (method git-fetch)
1149 (uri (git-reference
1150 (url "https://gitlab.com/m2crypto/m2crypto")
1151 (commit version)))
1152 (file-name (git-file-name name version))
1153 (sha256
1154 (base32 "090dvgnjmqidh0c318kipysiy24cn1rwbmxl4vybnqd57n65xsn8"))))
1155 (build-system pyproject-build-system)
1156 (arguments
1157 `(;; FIXME: Tests start failing with time due to date checks in TLS
1158 ;; certificates.
1159 #:tests? #f))
1160 (inputs (list openssl))
1161 (native-inputs (list swig python-setuptools))
1162 (home-page "https://gitlab.com/m2crypto/m2crypto")
1163 (synopsis "Python crypto and TLS toolkit")
1164 (description "@code{M2Crypto} is a complete Python wrapper for OpenSSL
1165featuring RSA, DSA, DH, EC, HMACs, message digests, symmetric ciphers
1166(including AES); TLS functionality to implement clients and servers; HTTPS
1167extensions to Python's httplib, urllib, and xmlrpclib; unforgeable HMAC'ing
1168AuthCookies for web session management; FTP/TLS client and server; S/MIME;
1169M2Crypto can also be used to provide TLS for Twisted. Smartcards supported
1170through the Engine interface.")
1171 (license license:expat)))
1172
1173(define-public python-pykeepass
1174 (package
1175 (name "python-pykeepass")
1176 (version "4.1.1.post1")
1177 (source
1178 (origin
1179 (method git-fetch)
1180 (uri (git-reference
1181 (url "https://github.com/libkeepass/pykeepass")
1182 (commit (string-append "v" version))))
1183 (file-name (git-file-name name version))
1184 (sha256
1185 (base32 "1ayvgklq3naydx01m7hyvf44ywczk5yzy2pk48bpfayl7bgk7q8d"))))
1186 (build-system pyproject-build-system)
1187 (arguments
1188 ;; tests: 115 passed
1189 (list #:test-backend #~'unittest))
1190 (native-inputs
1191 (list python-setuptools))
1192 (propagated-inputs
1193 (list python-argon2-cffi
1194 python-construct
1195 python-lxml
1196 python-pycryptodomex
1197 python-pyotp))
1198 (home-page "https://github.com/libkeepass/pykeepass")
1199 (synopsis "Python library to interact with keepass databases")
1200 (description
1201 "This library allows you to write entries to a KeePass database. It
1202supports KDBX3 and KDBX4.")
1203 ;; There are no copyright headers in the source code. The LICENSE file
1204 ;; indicates GPL3.
1205 (license license:gpl3+)))
1206
1207(define-public python-pykcs11
1208 (package
1209 (name "python-pykcs11")
1210 (version "1.5.18")
1211 (source
1212 (origin
1213 (method git-fetch)
1214 (uri (git-reference
1215 (url "https://github.com/LudovicRousseau/PyKCS11")
1216 (commit version)))
1217 (file-name (git-file-name name version))
1218 (sha256
1219 (base32 "1r1xn5lfnrnl62prd0a5ckmc8mggn6nqcnhsj9zg0vhf00ffs4gg"))))
1220 (build-system pyproject-build-system)
1221 (arguments
1222 (list
1223 #:phases
1224 #~(begin
1225 (use-modules (ice-9 textual-ports))
1226 (modify-phases %standard-phases
1227 (add-before 'check 'fix-test-run
1228 (lambda* (#:key inputs #:allow-other-keys)
1229 (delete-file-recursively "PyKCS11")
1230 (setenv "PYKCS11LIB" (search-input-file inputs "/lib/softhsm/libsofthsm2.so"))))
1231 (add-before 'check 'setup-softhsm
1232 (lambda _
1233 (call-with-output-file "softhsm2.conf"
1234 (lambda (port)
1235 (put-string port "directories.tokendir = /tmp/tokens/")))
1236 (setenv "SOFTHSM2_CONF" "softhsm2.conf")
1237 (mkdir "/tmp/tokens")
1238 (invoke "test/reset_softHSM.sh")))))))
1239 (native-inputs
1240 (list bash-minimal
1241 python-asn1crypto
1242 python-setuptools
1243 python-pytest
1244 softhsm
1245 swig))
1246 (home-page "https://github.com/LudovicRousseau/PyKCS11")
1247 (synopsis "PKCS#11 wrapper for Python")
1248 (description "This package provides a complete PKCS#11 wrapper for Python.")
1249 (license license:gpl3)))
1250
1251(define-public python-pylibscrypt
1252 (package
1253 (name "python-pylibscrypt")
1254 (version "2.0.0")
1255 (source
1256 (origin
1257 (method git-fetch)
1258 (uri (git-reference
1259 (url "https://github.com/jvarho/pylibscrypt")
1260 (commit (string-append "v" version))))
1261 (file-name (git-file-name name version))
1262 (sha256
1263 (base32 "0hshivwl3xznlqhrvwbylp40k1bfx4gnyzmxwldkwjhf1260zan1"))))
1264 (build-system pyproject-build-system)
1265 (native-inputs (list python-pytest python-setuptools python-wheel))
1266 (home-page "https://github.com/jvarho/pylibscrypt")
1267 (synopsis "Scrypt for Python")
1268 (description
1269 "This package provides another Scrypt module for Python.")
1270 (license license:isc)))
1271
1272(define-public python-libnacl
1273 (package
1274 (name "python-libnacl")
1275 (version "2.1.0")
1276 (source
1277 (origin
1278 (method url-fetch)
1279 (uri (pypi-uri "libnacl" version))
1280 (sha256
1281 (base32
1282 "0q18j8kfibhi5qckakhf0b0psf8nkll91nfp3yqxkri9vykqshgk"))))
1283 (build-system pyproject-build-system)
1284 (arguments
1285 `(#:phases
1286 (modify-phases %standard-phases
1287 (add-after 'unpack 'locate-libsodium
1288 (lambda* (#:key inputs #:allow-other-keys)
1289 (substitute* "libnacl/__init__.py"
1290 (("ctypes\\.util\\.find_library\\('sodium'\\)")
1291 (string-append "'"
1292 (search-input-file inputs "/lib/libsodium.so")
1293 "'")))))
1294 (replace 'check
1295 (lambda* (#:key tests? #:allow-other-keys)
1296 (when tests?
1297 (invoke "python" "-m" "unittest" "discover"
1298 "--start-directory" "tests" "-v")))))))
1299 (native-inputs
1300 (list python-poetry-core))
1301 (inputs
1302 (list libsodium))
1303 (home-page "https://libnacl.readthedocs.org/")
1304 (synopsis "Python bindings for libsodium based on ctypes")
1305 (description "@code{libnacl} is used to gain direct access to the
1306functions exposed by @code{NaCl} library via @code{libsodium}. It has
1307been constructed to maintain extensive documentation on how to use
1308@code{NaCl} as well as being completely portable.")
1309 (license license:asl2.0)))
1310
1311(define-public python-pyotp
1312 (package
1313 (name "python-pyotp")
1314 (version "2.9.0")
1315 (source
1316 (origin
1317 (method git-fetch)
1318 (uri (git-reference
1319 (url "https://github.com/pyauth/pyotp")
1320 (commit (string-append "v" version))))
1321 (file-name (git-file-name name version))
1322 (sha256
1323 (base32 "0fx253649bvs2w31jdwnr51dm0b6v1zhp7mprnis37c57vj4qczz"))))
1324 (build-system pyproject-build-system)
1325 (arguments
1326 (list
1327 #:test-flags
1328 #~(list "test.py")))
1329 (native-inputs
1330 (list python-setuptools
1331 python-pytest))
1332 (home-page "https://github.com/pyauth/pyotp")
1333 (synopsis "Python One Time Password Library")
1334 (description
1335 "PyOTP is a Python library for generating and verifying one-time
1336passwords. It can be used to implement two-factor (2FA) or multi-factor
1337(MFA) authentication methods in web applications and in other systems that
1338require users to log in.")
1339 (license license:expat)))
1340
1341;; XXX: This project was archived by the owner on Apr 20, 2025. It is now
1342;; read-only. Consider to remove when starts failing to build and nothing
1343;; depends on it.
1344(define-public python-rsa
1345 (package
1346 (name "python-rsa")
1347 (version "4.9.1")
1348 (source
1349 (origin
1350 (method url-fetch)
1351 (uri (pypi-uri "rsa" version))
1352 (sha256
1353 (base32 "0xdfs3mhdb9wjpckj7i4zyv9sr82m7hk0mfkvw3lrnlpakdvzgg7"))))
1354 (build-system pyproject-build-system)
1355 (arguments
1356 (list #:tests? #f)) ;tests are not included in PyPI archive
1357 (native-inputs
1358 (list python-poetry-core))
1359 (propagated-inputs
1360 (list python-pyasn1))
1361 (home-page "https://stuvel.eu/rsa")
1362 (synopsis "Pure-Python RSA implementation")
1363 (description "Python-RSA is a pure-Python RSA implementation. It supports
1364encryption and decryption, signing and verifying signatures, and key
1365generation according to PKCS#1 version 1.5. It can be used as a Python
1366library as well as on the command line.")
1367 (license license:asl2.0)))
1368
1369(define-public python-rsa-for-awscli-1
1370 (hidden-package
1371 (package
1372 (inherit python-rsa)
1373 (version "3.4.2")
1374 (source
1375 (origin
1376 (method url-fetch)
1377 (uri (pypi-uri "rsa" version))
1378 (sha256
1379 (base32 "1dcxvszbikgzh99ybdc7jq0zb9wspy2ds8z9mjsqiyv3q884xpr5"))))
1380 (native-inputs
1381 (list python-setuptools)))))
1382
1383(define-public python-scrypt
1384 (package
1385 (name "python-scrypt")
1386 (version "0.9.4")
1387 (source
1388 (origin
1389 (method git-fetch)
1390 (uri (git-reference
1391 (url "https://github.com/holgern/py-scrypt")
1392 (commit (string-append "v" version))))
1393 (file-name (git-file-name name version))
1394 (sha256
1395 (base32 "07mr8slhplk0pfji3pfb86281wf035c3vxg7w4g17vgry1l5fdg2"))))
1396 (build-system pyproject-build-system)
1397 (native-inputs (list python-pytest python-setuptools python-wheel))
1398 (inputs (list openssl))
1399 (home-page "https://github.com/holgern/py-scrypt")
1400 (synopsis "Bindings for the scrypt key derivation function library")
1401 (description
1402 "This package is a set of Python bindings for the scrypt key derivation
1403function.")
1404 (license license:bsd-2)))
1405
1406(define-public python-service-identity
1407 (package
1408 (name "python-service-identity")
1409 (version "24.2.0")
1410 (source
1411 (origin
1412 (method url-fetch)
1413 (uri (pypi-uri "service_identity" version))
1414 (sha256
1415 (base32 "02cfpry5alap6mf3ffq1gdq6s7a2cmgjqpb2bp6wcf8d7yhkns5q"))))
1416 (build-system pyproject-build-system)
1417 (native-inputs
1418 (list python-hatch-fancy-pypi-readme
1419 python-hatch-vcs
1420 python-hatchling
1421 python-idna
1422 python-pytest))
1423 (propagated-inputs
1424 (list python-attrs
1425 python-cryptography
1426 python-pyasn1
1427 python-pyasn1-modules
1428 python-six))
1429 (home-page "https://service-identity.readthedocs.io/")
1430 (synopsis "Service identity verification for PyOpenSSL")
1431 (description
1432 "@code{service_identity} aspires to give you all the tools you need for
1433verifying whether a certificate is valid for the intended purposes. In the
1434simplest case, this means host name verification. However, service_identity
1435implements RFC 6125 fully and plans to add other relevant RFCs too.")
1436 (license license:expat)))
1437
1438(define-public python-google-crc32c
1439 (package
1440 (name "python-google-crc32c")
1441 (version "1.3.0")
1442 (source
1443 (origin
1444 (method git-fetch)
1445 (uri (git-reference
1446 (url "https://github.com/googleapis/python-crc32c")
1447 (commit (string-append "v" version))))
1448 (file-name (git-file-name name version))
1449 (sha256
1450 (base32 "005ra4pfv71rq53198k7q6k63f529q3g6hkbxbwfcf82jr77hxga"))))
1451 (build-system pyproject-build-system)
1452 (inputs (list crc32c))
1453 (native-inputs (list python-pytest python-setuptools python-wheel))
1454 (home-page "https://github.com/googleapis/python-crc32c")
1455 (synopsis "Python wrapper of Google CRC32C")
1456 (description
1457 "This package provides a Python wrapper of the C library implementation
1458of the CRC32C hashing algorithm.")
1459 (license license:asl2.0)))
1460
1461(define-public python-spake2
1462 (package
1463 (name "python-spake2")
1464 (version "0.9")
1465 (source
1466 (origin
1467 (method url-fetch)
1468 (uri (pypi-uri "spake2" version))
1469 (sha256
1470 (base32 "0d4kbaxi4cv8klyqh6yb0p0qiwfdwvczy1h2mzvmlfdcsnlc87s2"))))
1471 (build-system pyproject-build-system)
1472 (native-inputs (list python-pytest python-setuptools))
1473 (propagated-inputs (list python-cryptography))
1474 (home-page "https://github.com/warner/python-spake2")
1475 (synopsis "SPAKE2 password-authenticated key exchange in Python")
1476 (description "This package provides a Python implementation of the SPAKE2
1477Password-Authenticated Key Exchange algorithm.")
1478 (license license:expat)))
1479
1480(define-public python-keyutils
1481 (package
1482 (name "python-keyutils")
1483 (version "0.6")
1484 (source
1485 (origin
1486 (method url-fetch)
1487 (uri (pypi-uri "keyutils" version))
1488 (sha256
1489 (base32 "0lipygpzhwzzsq2k5imb1jgkmj8y4khxdwhzadjs3bd56g6bmkx9"))))
1490 (build-system pyproject-build-system)
1491 (arguments
1492 (list
1493 #:tests? #f
1494 #:phases
1495 #~(modify-phases %standard-phases
1496 (add-before 'build 'regenerate-c-file
1497 (lambda _
1498 (invoke "cython" "keyutils/_keyutils.pyx"))))))
1499 (native-inputs
1500 (list python-cython python-pytest python-setuptools))
1501 (inputs
1502 (list keyutils))
1503 (home-page "https://github.com/sassoftware/python-keyutils")
1504 (synopsis "Python bindings for keyutils")
1505 (description
1506 "This is a set of python bindings for keyutils, a key management suite
1507that leverages the infrastructure provided by the Linux kernel for safely
1508storing and retrieving sensitive information in your programs.")
1509 (license license:asl2.0)))
1510
1511(define-public python-mcuboot-imgtool
1512 (package
1513 (name "python-mcuboot-imgtool")
1514 (version "1.4.0")
1515 (source
1516 (origin
1517 (method git-fetch)
1518 (uri (git-reference
1519 (url "https://github.com/mcu-tools/mcuboot")
1520 (commit (string-append "v" version))))
1521 (file-name (git-file-name name version))
1522 (sha256
1523 (base32 "1m1csyvzq4jx81zg635ssy1n7sc0z539z0myh872ll3nwqx7wa0q"))))
1524 (build-system pyproject-build-system)
1525 (arguments
1526 (list
1527 #:phases
1528 #~(modify-phases %standard-phases
1529 (add-after 'unpack 'fix-broken-test
1530 (lambda _
1531 (substitute* "scripts/imgtool/keys/ed25519_test.py"
1532 (("raw_sign")
1533 "sign_digest"))))
1534 (add-before 'build 'change-directory
1535 (lambda _
1536 (chdir "scripts"))))))
1537 (native-inputs (list python-pytest python-setuptools python-wheel))
1538 (propagated-inputs (list python-click python-intelhex python-cryptography))
1539 (home-page "https://mcuboot.com")
1540 (synopsis "Tool to securely sign firmware images for booting by MCUboot")
1541 (description
1542 "MCUboot is a secure bootloader for 32-bit MCUs. This package provides a
1543tool to securely sign firmware images for booting by MCUboot.")
1544 (license license:expat)))
1545
1546(define-public python-ntlm-auth
1547 (package
1548 (name "python-ntlm-auth")
1549 (version "1.5.0")
1550 (source
1551 (origin
1552 (method git-fetch)
1553 (uri (git-reference
1554 (url "https://github.com/jborean93/ntlm-auth")
1555 (commit (string-append "v" version))))
1556 (file-name (git-file-name name version))
1557 (sha256
1558 (base32 "00dpf5bfsy07frsjihv1k10zmwcyq4bvkilbxha7h6nlwpcm2409"))))
1559 (build-system pyproject-build-system)
1560 (native-inputs
1561 (list python-pytest python-requests python-setuptools python-wheel))
1562 (propagated-inputs (list python-cryptography))
1563 (home-page "https://github.com/jborean93/ntlm-auth")
1564 (synopsis "Calculates NTLM Authentication codes")
1565 (description
1566 "This library handles the low-level details of NTLM authentication for
1567use in authenticating with a service that uses NTLM. It will create and parse
1568the 3 different message types in the order required and produce a base64
1569encoded value that can be attached to the HTTP header.
1570
1571The goal of this library is to offer full NTLM support including signing and
1572sealing of messages as well as supporting MIC for message integrity and the
1573ability to customise and set limits on the messages sent. Please see Features
1574and Backlog for a list of what is and is not currently supported.")
1575 (license license:expat)))
1576
1577(define-public python-secretstorage
1578 (package
1579 (name "python-secretstorage")
1580 (version "3.3.3")
1581 (source
1582 (origin
1583 (method url-fetch)
1584 (uri (pypi-uri "SecretStorage" version))
1585 (sha256
1586 (base32 "0xxxxr77sgmjm1rqzdd1rkan9xg0qmv8awc1pb9adv39ycz560r4"))))
1587 (build-system pyproject-build-system)
1588 (arguments
1589 '(#:tests? #f)) ; Tests require a running dbus service.
1590 (native-inputs
1591 (list python-setuptools))
1592 (propagated-inputs
1593 (list python-cryptography python-jeepney))
1594 (home-page "https://github.com/mitya57/secretstorage")
1595 (synopsis "Python bindings to FreeDesktop.org Secret Service API")
1596 (description
1597 "@code{python-secretstorage} provides a way for securely storing passwords
1598and other secrets. It uses D-Bus Secret Service API that is supported by GNOME
1599Keyring (since version 2.30) and KSecretsService. SecretStorage supports most
1600of the functions provided by Secret Service, including creating and deleting
1601items and collections, editing items, locking and unlocking collections
1602(asynchronous unlocking is also supported).")
1603 (license license:bsd-3)))
1604
1605(define-public python-trustme
1606 (package
1607 (name "python-trustme")
1608 (version "1.2.1")
1609 (source
1610 (origin
1611 (method url-fetch)
1612 (uri (pypi-uri "trustme" version))
1613 (sha256
1614 (base32 "0zz49agi7hy82fbr03xs6k9vjgiy7v8qsp426cgv8bbzphmvla35"))))
1615 (build-system pyproject-build-system)
1616 (native-inputs
1617 (list python-hatchling
1618 python-pyopenssl
1619 python-pytest
1620 python-service-identity))
1621 (propagated-inputs
1622 (list python-cryptography
1623 python-idna))
1624 (home-page "https://trustme.readthedocs.io")
1625 (synopsis "Fake a certificate authority for tests")
1626 (description
1627 "@code{trustme} is a tiny Python package that does one thing: it gives you
1628a fake certificate authority (CA) that you can use to generate fake TLS certs to
1629use in your tests.")
1630 ;; Either license applies.
1631 (license (list license:expat license:asl2.0))))
1632
1633(define-public python-certipy
1634 (package
1635 (name "python-certipy")
1636 (version "0.2.2")
1637 (source
1638 (origin
1639 (method url-fetch)
1640 (uri (pypi-uri "certipy" version))
1641 (sha256
1642 (base32 "0pm0kf079ws9s93vpkxnw3gj6a1hi34p34bicx69rqlyh7cg7wgy"))))
1643 (build-system pyproject-build-system)
1644 (propagated-inputs (list python-cryptography))
1645 (native-inputs (list python-pypa-build
1646 python-flask
1647 python-pytest
1648 python-setuptools
1649 python-wheel))
1650 (home-page "https://github.com/LLNL/certipy")
1651 (synopsis "Utility to create and sign CAs and certificates")
1652 (description
1653 "Certipy was made to simplify the certificate creation process. To that
1654end, certipy exposes methods for creating and managing certificate authorities,
1655certificates, signing and building trust bundles.")
1656 (license license:bsd-3)))
1657
1658(define-public python-jeepney
1659 (package
1660 (name "python-jeepney")
1661 (version "0.8.0")
1662 (source
1663 (origin
1664 (method url-fetch)
1665 (uri (pypi-uri "jeepney" version))
1666 (sha256
1667 (base32 "01jqrk7pn94i7bpmj834pjrw7id659gfag6wpbv04fcpap94izjy"))))
1668 (build-system pyproject-build-system)
1669 (native-inputs
1670 (list python-async-timeout
1671 python-testpath
1672 python-trio
1673 python-pytest
1674 python-pytest-asyncio
1675 python-pytest-trio
1676 ;; For the build backend
1677 python-flit-core))
1678 (home-page "https://gitlab.com/takluyver/jeepney")
1679 (synopsis "Low-level, pure Python DBus protocol wrapper")
1680 (description
1681 "This is a low-level, pure Python DBus protocol client. It has an
1682I/O-free core, and integration modules for different event loops.")
1683 (license license:expat)))
1684
1685(define-public python-argon2-cffi
1686 (package
1687 (name "python-argon2-cffi")
1688 (version "25.1.0")
1689 (source
1690 (origin
1691 (method url-fetch)
1692 (uri (pypi-uri "argon2_cffi" version))
1693 (sha256
1694 (base32 "1ha62fg9blw38q3qayjid8608fp2a57fd81cpzic9x22ib6fajk9"))))
1695 (build-system pyproject-build-system)
1696 (native-inputs
1697 (list python-hatch-fancy-pypi-readme
1698 python-hatch-vcs
1699 python-hatchling
1700 python-pytest))
1701 (propagated-inputs
1702 (list python-argon2-cffi-bindings))
1703 (home-page "https://argon2-cffi.readthedocs.io/")
1704 (synopsis "Secure Password Hashes for Python")
1705 (description
1706 "Argon2 is a secure password hashing algorithm. It is designed to have
1707both a configurable runtime as well as memory consumption. This means that you
1708can decide how long it takes to hash a password and how much memory is required.")
1709 (license license:expat)))
1710
1711(define-public python-argon2-cffi-bindings
1712 (package
1713 (name "python-argon2-cffi-bindings")
1714 (version "25.1.0")
1715 (source
1716 (origin
1717 (method url-fetch)
1718 (uri (pypi-uri "argon2_cffi_bindings" version))
1719 (sha256
1720 (base32 "179256zsrh5c51zmv9k1sc9p102j152nzxqgwhhdhmadxbkg6mxr"))))
1721 (build-system pyproject-build-system)
1722 (arguments
1723 (list
1724 #:phases
1725 #~(modify-phases %standard-phases
1726 (add-before 'build 'use-system-argon2
1727 (lambda _
1728 (setenv "ARGON2_CFFI_USE_SYSTEM" "1"))))))
1729 (native-inputs
1730 (list python-pytest
1731 python-setuptools
1732 python-setuptools-scm))
1733 (inputs
1734 (list argon2))
1735 (propagated-inputs
1736 (list python-cffi))
1737 (home-page "https://github.com/hynek/argon2-cffi-bindings")
1738 (synopsis "Low-level CFFI bindings for Argon2")
1739 (description
1740 "argon2-cffi-bindings provides low-level CFFI bindings to the official
1741implementation of the Argon2 password hashing algorithm.")
1742 (license license:expat)))
1743
1744(define-public python-privy
1745 (package
1746 (name "python-privy")
1747 (version "6.0.0")
1748 (source
1749 (origin
1750 (method git-fetch)
1751 (uri (git-reference
1752 ;; Releases are untagged
1753 (url "https://github.com/ofek/privy")
1754 (commit "2838db3df239797c71bddacc48a4c49a83f35747")))
1755 (file-name (git-file-name name version))
1756 (sha256
1757 (base32 "1m32dh5fqc8cy7jyf1z5fs6zvmdkbq5fi98hr609gbl7s0l0y0i9"))))
1758 (build-system pyproject-build-system)
1759 (native-inputs (list python-pytest python-setuptools))
1760 (propagated-inputs (list python-argon2-cffi python-cryptography))
1761 (home-page "https://www.dropbox.com/developers")
1762 (synopsis "Library to password-protect your data")
1763 (description
1764 "Privy is a small and fast utility for password-protecting secret
1765data such as API keys, cryptocurrency wallets, or seeds for digital
1766signatures.")
1767 (license (list license:expat license:asl2.0)))) ; dual licensed
1768
1769(define-public python-pgpy
1770 (package
1771 (name "python-pgpy")
1772 (version "0.6.0")
1773 (source
1774 (origin
1775 (method url-fetch)
1776 (uri (pypi-uri "PGPy" version))
1777 (sha256
1778 (base32 "10w3h934fi1ijx72ppn67a50yhkf8n1db6xx02gk2fjc7wsjx717"))))
1779 (build-system pyproject-build-system)
1780 (arguments
1781 (list #:test-flags
1782 ;; All broken tests are in this file.
1783 ;; They fail with ValueError: key_size must be at least 1024-bits.
1784 #~(list "--ignore" "tests/test_10_exceptions.py")))
1785 (native-inputs
1786 (list python-pytest python-setuptools python-wheel))
1787 (propagated-inputs (list python-cryptography python-pyasn1))
1788 (home-page "https://github.com/SecurityInnovation/PGPy")
1789 (synopsis "Python implementation of OpenPGP")
1790 (description
1791 "Currently, PGPy can load keys and signatures of all kinds in both ASCII
1792armored and binary formats.
1793
1794It can create and verify RSA, DSA, and ECDSA signatures, at the moment. It
1795can also encrypt and decrypt messages using RSA and ECDH.")
1796 (license license:bsd-3)))
1797
1798(define-public python-pyu2f
1799 (package
1800 (name "python-pyu2f")
1801 (version "0.1.5")
1802 (source
1803 (origin
1804 (method git-fetch)
1805 (uri (git-reference
1806 (url "https://github.com/google/pyu2f/")
1807 (commit (string-append "v" version))))
1808 (file-name (git-file-name name version))
1809 (sha256
1810 (base32 "1jlpplw7hlrh8bgmp37g18panij0p7ism6r4d981my4dc73lbwik"))))
1811 (build-system pyproject-build-system)
1812 (arguments
1813 (list
1814 ;; This test requires the fakefs package.
1815 #:test-flags #~(list "--ignore=pyu2f/tests/hid/linux_test.py")))
1816 (native-inputs (list python-mock python-pytest python-setuptools))
1817 (propagated-inputs (list python-six))
1818 (home-page "https://github.com/google/pyu2f/")
1819 (synopsis "U2F host library for interacting with a U2F device over USB")
1820 (description
1821 "Pyu2f is a Python-based U2F host library. It provides functionality for
1822interacting with a U2F device over USB.")
1823 (license license:asl2.0)))
1824
1825(define-public python-sop
1826 (package
1827 (name "python-sop")
1828 (version "0.5.1")
1829 (source
1830 (origin
1831 (method git-fetch)
1832 (uri (git-reference
1833 (url "https://gitlab.com/dkg/python-sop")
1834 (commit (string-append "sop-" version))))
1835 (file-name (git-file-name name version))
1836 (sha256
1837 (base32 "0sin5miiiqgww0s52jz098x44nbnx003vfd4jn55bs5mgca60lll"))))
1838 (build-system pyproject-build-system)
1839 (arguments
1840 (list #:tests? #f)) ; XXX: No tests upstream.
1841 (native-inputs (list python-setuptools python-wheel))
1842 (home-page "https://gitlab.com/dkg/python-sop")
1843 (synopsis "Stateless OpenPGP Command-Line Interface")
1844 (description
1845 "The Stateless OpenPGP Command-Line Interface (or sop) is a
1846specification that encourages OpenPGP implementers to provide a common,
1847relatively simple command-line API for purposes of object security.
1848
1849This Python module helps implementers build such a CLI from any implementation
1850accessible to the Python interpreter.
1851
1852It does not provide such an implementation itself -- this is just the
1853scaffolding for the command line, which should make it relatively easy to
1854supply a handful of python functions as methods to a class.")
1855 (license license:expat))) ; MIT license
1856
1857(define-public python-starkbank-ecdsa
1858 (package
1859 (name "python-starkbank-ecdsa")
1860 (version "2.2.0")
1861 (home-page "https://github.com/starkbank/ecdsa-python")
1862 (source
1863 (origin
1864 (method git-fetch)
1865 (uri (git-reference
1866 (url home-page)
1867 (commit (string-append "v" version))))
1868 (file-name (git-file-name name version))
1869 (sha256
1870 (base32 "01zy16csrbyfhjl0kay9rbpbwc3dpr7kh2qkrbdy5a1n644fbahx"))))
1871 (arguments
1872 (list
1873 #:test-backend #~'unittest
1874 #:phases
1875 #~(modify-phases %standard-phases
1876 (add-after 'unpack 'remove-broken-test
1877 (lambda _
1878 (delete-file "tests/testOpenSSL.py"))))))
1879 (build-system pyproject-build-system)
1880 (native-inputs (list python-setuptools))
1881 (synopsis "Python ECDSA library")
1882 (description "This package provides a Python ECDSA library, optimized for
1883speed but without C extensions.")
1884 (license license:expat)))
1885
1886(define-public python-zxcvbn
1887 (package
1888 (name "python-zxcvbn")
1889 (version "4.5.0")
1890 (source
1891 (origin
1892 (method git-fetch) ;for tests
1893 (uri (git-reference
1894 (url "https://github.com/dwolfhub/zxcvbn-python")
1895 (commit (string-append "v" version))))
1896 (file-name (git-file-name name version))
1897 (sha256
1898 (base32 "0x39yi4zc1n6mjjk3rx32ick0hysyi9hv9ln69apcch4jf84j9fi"))))
1899 (build-system pyproject-build-system)
1900 (native-inputs (list python-pytest python-setuptools python-wheel))
1901 (home-page "https://github.com/dwolfhub/zxcvbn-python")
1902 (synopsis "Realistic password strength estimator Python library")
1903 (description
1904 "This is a Python implementation of the @code{zxcvbn} library created at
1905Dropbox. The original library, written for JavaScript, can be found
1906@url{https://github.com/dropbox/zxcvbn, here}. This port includes features
1907such as:
1908@enumerate
1909@item Accepts user data to be added to the dictionaries that are tested
1910against (name, birthdate, etc.)
1911@item Gives a score to the password, from 0 (terrible) to 4 (great).
1912@item Provides feedback on the password and ways to improve it.
1913@item Returns time estimates on how long it would take to guess the password
1914in different situations.
1915@end enumerate")
1916 (license license:expat)))
1917
1918(define-public python-zxcvbn-rs-py
1919 (package
1920 (name "python-zxcvbn-rs-py")
1921 (version "0.3.0")
1922 (source
1923 (origin
1924 (method git-fetch)
1925 (uri (git-reference
1926 (url "https://github.com/fief-dev/zxcvbn-rs-py")
1927 (commit (string-append "v" version))))
1928 (file-name (git-file-name name version))
1929 (sha256
1930 (base32 "0pmc68x6ycsz4g7sr48nb7cv6v46rljc3wb1vc531lyc6hsh80qm"))))
1931 (build-system pyproject-build-system)
1932 (arguments
1933 (list
1934 #:imported-modules `(,@%cargo-build-system-modules
1935 ,@%pyproject-build-system-modules)
1936 #:modules '(((guix build cargo-build-system) #:prefix cargo:)
1937 (guix build pyproject-build-system)
1938 (guix build utils))
1939 #:phases
1940 #~(modify-phases %standard-phases
1941 (add-after 'unpack 'prepare-cargo-build-system
1942 (lambda args
1943 (for-each
1944 (lambda (phase)
1945 (format #t "Running cargo phase: ~a~%" phase)
1946 (apply (assoc-ref cargo:%standard-phases phase)
1947 #:cargo-target #$(cargo-triplet)
1948 args))
1949 '(unpack-rust-crates
1950 configure
1951 check-for-pregenerated-files
1952 patch-cargo-checksums))))
1953 (add-before 'check 'prepare-for-tests
1954 (lambda _
1955 (delete-file-recursively "zxcvbn_rs_py"))))))
1956 (native-inputs
1957 (list rust
1958 `(,rust "cargo")
1959 maturin
1960 python-pytest
1961 python-wheel))
1962 (inputs
1963 (cargo-inputs 'python-zxcvbn-rs-py))
1964 (home-page "https://github.com/fief-dev/zxcvbn-rs-py")
1965 (synopsis
1966 "Python bindings for zxcvbn-rs, a password strength estimation library")
1967 (description
1968 "This package provides a library to estimate password strength. It is
1969implemented by python bindings for zxcvbn-rs and aims to be faster than
1970@code{python-zxcvbn} thanks to its Rust core.")
1971 (license license:expat)))
1972
1973;; XXX: Not maintained since 2016.
1974(define-public python-pydes
1975 (package
1976 (name "python-pydes")
1977 (version "2.0.1")
1978 (source
1979 (origin
1980 (method url-fetch)
1981 (uri (pypi-uri "pyDes" version))
1982 (sha256
1983 (base32 "04lh71f47y04vspfrdrq6a0hn060ibxvdp5z1pcr0gmqs8hqxaz2"))))
1984 (build-system pyproject-build-system)
1985 (arguments
1986 (list #:tests? #f)) ;no tests in PyPI, I could not fine Git
1987 (native-inputs (list python-setuptools))
1988 (home-page "http://twhiteman.netfirms.com/des.html") ;XXX: Dead link
1989 (synopsis
1990 "Pure python implementation of the DES and TRIPLE DES encryption algorithms")
1991 (description
1992 "This package provides a pure Python implementation of the DES and
1993TRIPLE DES encryption algorithms.")
1994 (license license:public-domain)))