projects/guix·blob ruby-team · refs

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