projects/guix·blob python-team · refs

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