projects/guix·blob nckx-patch-1 · refs

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