projects/guix·blob perlssl · refs

2098 lines · 77.1 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Eric Dvorsak <[email protected]>
3;;; Copyright © 2015-2021, 2023, 2024 Efraim Flashner <[email protected]>
4;;; Copyright © 2015, 2016, 2017, 2019 Leo Famulari <[email protected]>
5;;; Copyright © 2016, 2017, 2020, 2022, 2023 Marius Bakke <[email protected]>
6;;; Copyright © 2017 Ben Sturmfels <[email protected]>
7;;; Copyright © 2016 Sou Bunnbu <[email protected]>
8;;; Copyright © 2015 Cyril Roelandt <[email protected]>
9;;; Copyright © 2014, 2017 Eric Bavier <[email protected]>
10;;; Copyright © 2015, 2016 David Thompson <[email protected]>
11;;; Copyright © 2016, 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <[email protected]>
12;;; Copyright © 2016, 2017 Nikita <[email protected]>
13;;; Copyright © 2014, 2015 Mark H Weaver <[email protected]>
14;;; Copyright © 2015, 2016, 2017, 2019, 2022, 2024, 2025 Ricardo Wurmus <[email protected]>
15;;; Copyright © 2016 Danny Milosavljevic <[email protected]>
16;;; Copyright © 2016, 2017, 2020 Arun Isaac <[email protected]>
17;;; Copyright © 2017 Carlo Zancanaro <[email protected]>
18;;; Copyright © 2018 Tomáš Čech <[email protected]>
19;;; Copyright © 2018, 2021 Nicolas Goaziou <[email protected]>
20;;; Copyright © 2018 Vagrant Cascadian <[email protected]>
21;;; Copyright © 2018 Nam Nguyen <[email protected]>
22;;; Copyright © 2019, 2025 Guillaume Le Vaillant <[email protected]>
23;;; Copyright © 2019 Clément Lassieur <[email protected]>
24;;; Copyright © 2020 Alexandros Theodotou <[email protected]>
25;;; Copyright © 2020 Justus Winter <[email protected]>
26;;; Copyright © 2020, 2021 Vinicius Monego <[email protected]>
27;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <[email protected]>
28;;; Copyright © 2021 Maxime Devos <[email protected]>
29;;; Copyright © 2022 Artyom V. Poptsov <[email protected]>
30;;; Copyright © 2022 Antero Mejr <[email protected]>
31;;; Copyright © 2023 Juliana Sims <[email protected]>
32;;; Copyright © 2023, 2025 Zheng Junjie <[email protected]>
33;;; Copyright © 2024 jgart <[email protected]>
34;;; Copyright © 2025 Sharlatan Hellseher <[email protected]>
35;;; Copyright © 2025 Nguyễn Gia Phong <[email protected]>
36;;; Copyright © 2025 Adrien 'neox' Bourmault <[email protected]>
37;;;
38;;; This file is part of GNU Guix.
39;;;
40;;; GNU Guix is free software; you can redistribute it and/or modify it
41;;; under the terms of the GNU General Public License as published by
42;;; the Free Software Foundation; either version 3 of the License, or (at
43;;; your option) any later version.
44;;;
45;;; GNU Guix is distributed in the hope that it will be useful, but
46;;; WITHOUT ANY WARRANTY; without even the implied warranty of
47;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48;;; GNU General Public License for more details.
49;;;
50;;; You should have received a copy of the GNU General Public License
51;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
52
53(define-module (gnu packages python-crypto)
54 #:use-module (guix packages)
55 #:use-module (guix download)
56 #:use-module (guix gexp)
57 #:use-module (guix hg-download)
58 #:use-module (guix git-download)
59 #:use-module (guix build-system cargo)
60 #:use-module (guix build-system pyproject)
61 #:use-module (guix utils)
62 #:use-module (gnu packages)
63 #:use-module (gnu packages nss)
64 #:use-module (gnu packages bash)
65 #:use-module (gnu packages check)
66 #:use-module (gnu packages crypto)
67 #:use-module (gnu packages kerberos)
68 #:use-module (gnu packages libffi)
69 #:use-module (gnu packages lsof)
70 #:use-module (gnu packages multiprecision)
71 #:use-module (gnu packages password-utils)
72 #:use-module (gnu packages pkg-config)
73 #:use-module (gnu packages protobuf)
74 #:use-module (gnu packages python)
75 #:use-module (gnu packages python-build)
76 #:use-module (gnu packages python-check)
77 #:use-module (gnu packages python-compression)
78 #:use-module (gnu packages python-web)
79 #:use-module (gnu packages python-xyz)
80 #:use-module (gnu packages rust)
81 #:use-module (gnu packages rust-apps)
82 #:use-module (gnu packages security-token)
83 #:use-module (gnu packages swig)
84 #:use-module (gnu packages time)
85 #:use-module (gnu packages tls)
86 #:use-module (gnu packages xml)
87 #:use-module ((guix licenses) #:prefix license:)
88 #:use-module (srfi srfi-1))
89
90(define-public python-base58
91 (package
92 (name "python-base58")
93 (version "2.1.1")
94 (source
95 (origin
96 (method url-fetch)
97 (uri (pypi-uri "base58" version))
98 (sha256
99 (base32 "1317ly0db7nnjg5k58f6nqa0svfcvn446xd5bpiyi0bfbczwpl65"))))
100 (build-system pyproject-build-system)
101 (native-inputs
102 (list python-pyhamcrest
103 python-pytest
104 python-pytest-benchmark
105 python-setuptools
106 python-wheel))
107 (home-page "https://github.com/keis/base58")
108 (synopsis "Base58 and Base58Check implementation")
109 (description
110 "Base58 and Base58Check implementation compatible with what is used by
111the Bitcoin network.")
112 (license license:expat)))
113
114(define-public python-bcrypt
115 (package
116 (name "python-bcrypt")
117 (version "3.2.2") ;the latest not Rust version
118 (source
119 (origin
120 (method url-fetch)
121 (uri (pypi-uri "bcrypt" version))
122 (sha256
123 (base32 "1yvbdfmkssx1jf2lrhbs58xljmyi3p82r7rav82pf1bp44642g23"))))
124 (build-system pyproject-build-system)
125 (native-inputs
126 (list python-pytest
127 python-setuptools))
128 (propagated-inputs
129 (list python-cffi))
130 (home-page "https://github.com/pyca/bcrypt/")
131 (synopsis "Modern password hashing library")
132 (description
133 "Bcrypt is a Python module which provides a password hashing method based
134on the Blowfish password hashing algorithm, as described in
135@url{http://static.usenix.org/events/usenix99/provos.html,\"A Future-Adaptable
136Password Scheme\"} by Niels Provos and David Mazieres.")
137 (license license:asl2.0)))
138
139(define-public python-bip32utils
140 (package
141 (name "python-bip32utils")
142 (version "0.3.post4")
143 (source
144 (origin
145 (method url-fetch)
146 (uri (pypi-uri "bip32utils" version))
147 (sha256
148 (base32 "1hj8iirdwxj2f3gp0d3bmz4gfll26ixkidh6rk9qjykjpc7z8w2r"))))
149 (build-system pyproject-build-system)
150 (arguments
151 (list #:tests? #f)) ;no tests
152 (native-inputs
153 (list python-setuptools))
154 (propagated-inputs
155 (list python-ecdsa))
156 ;; Original link is gone <https://github.com/prusnak/bip32utils>.
157 (home-page "https://salsa.debian.org/debian/python-bip32utils")
158 (synopsis
159 "Python implementation of Bitcoin hierarchical deterministic wallet")
160 (description
161 "This package provides utilities for generating and using Bitcoin
162Hierarchical Deterministic wallets
163(BIP0032).")
164 (license license:expat)))
165
166(define-public python-eth-hash
167 (package
168 (name "python-eth-hash")
169 (version "0.8.0")
170 (source
171 (origin
172 (method git-fetch)
173 (uri (git-reference
174 (url "https://github.com/ethereum/eth-hash")
175 (commit (string-append "v" version))))
176 (file-name (git-file-name name version))
177 (sha256
178 (base32 "1g4zlg134glfdxx8hzsmiq10lnl110c3fdgxk0kyq4r3msn7fa57"))))
179 (build-system pyproject-build-system)
180 (arguments
181 (list #:test-flags #~(list "tests/core" "tests/backends/pycryptodome")))
182 (native-inputs
183 (list python-pytest
184 python-setuptools))
185 (propagated-inputs
186 (list python-pycryptodome))
187 (home-page "https://github.com/ethereum/eth-hash")
188 (synopsis "Ethereum hashing function")
189 (description
190 "This package provides a Ethereum hashing function - keccak256 (sha3).")
191 (license license:expat)))
192
193(define-public python-murmurhash
194 (package
195 (name "python-murmurhash")
196 (version "1.0.10")
197 (source
198 (origin
199 (method git-fetch)
200 (uri (git-reference
201 (url "https://github.com/explosion/murmurhash")
202 (commit (string-append "v" version))))
203 (file-name (git-file-name name version))
204 (sha256
205 (base32 "02ny4391kbrssq9bf7kq75615ragvbjhsqi9hgv7wiaiz6yai1k8"))))
206 (build-system pyproject-build-system)
207 (arguments
208 (list
209 #:phases
210 #~(modify-phases %standard-phases
211 (add-after 'install 'fix-installation
212 (lambda* (#:key inputs outputs #:allow-other-keys)
213 (with-directory-excursion
214 (string-append (site-packages inputs outputs) "/murmurhash")
215 (delete-file-recursively "tests")
216 (delete-file "mrmr.pyx")
217 (for-each
218 (lambda (file)
219 (chmod file #o555))
220 (find-files "." "\\.so$")))))
221 ;; XXX: Otherwise ModuleNotFoundError, and --pyargs doesn't seem
222 ;; to fix the issue.
223 (replace 'check
224 (lambda args
225 (copy-recursively "murmurhash/tests" "tests")
226 (delete-file-recursively "murmurhash")
227 (with-directory-excursion "tests"
228 (apply (assoc-ref %standard-phases 'check) args)))))))
229 (native-inputs
230 (list python-cython
231 python-murmurhash3
232 python-pytest
233 python-setuptools))
234 (home-page "https://github.com/explosion/murmurhash")
235 (synopsis "Cython bindings for MurmurHash2")
236 (description
237 "This package provides Cython bindings for MurmurHash2.")
238 (license license:expat)))
239
240(define-public python-passlib
241 (package
242 ;; TODO: Migrate to a fork as the project is not maintained.
243 ;; See: guix/guix#8068.
244 (name "python-passlib")
245 (version "1.7.4")
246 (source
247 (origin
248 (method hg-fetch)
249 (uri (hg-reference
250 (url "https://foss.heptapod.net/python-libs/passlib")
251 (changeset version)))
252 (file-name (hg-file-name name version))
253 (sha256
254 (base32 "1knbafs3ckcc6prd1ln2r0sdkawpzx7naf749cj3ljlms8v0bsca"))))
255 (build-system pyproject-build-system)
256 (arguments
257 (list
258 ;; tests: 1099 passed, 1011 skipped, 199 warnings
259 #:test-flags
260 #~(list "--numprocesses" (number->string (min 8 (parallel-job-count)))
261 ;; AssertionError: expected 'linux' platform would have native
262 ;; support for 'des_crypt', 'md5_crypt', 'sha256_crypt',
263 ;; 'sha512_crypt'
264 #$@(map (lambda (test)
265 (string-append "--deselect=passlib/"
266 "tests/test_handlers.py::"))
267 (list "des_crypt_os_crypt_test::test_82_crypt_support"
268 "md5_crypt_os_crypt_test::test_82_crypt_support"
269 "sha256_crypt_os_crypt_test::test_82_crypt_support"
270 "sha512_crypt_os_crypt_test::test_82_crypt_support")))
271 #:phases
272 #~(modify-phases %standard-phases
273 (add-before 'check 'set-PYTHON_EGG_CACHE
274 ;; Some tests require access to "$HOME/.cython".
275 (lambda _
276 (setenv "PYTHON_EGG_CACHE" "/tmp"))))))
277 (native-inputs
278 (list python-pytest
279 python-pytest-xdist
280 python-setuptools))
281 (propagated-inputs
282 (list python-argon2-cffi python-bcrypt python-cryptography))
283 (home-page "https://foss.heptapod.net/python-libs/passlib")
284 (synopsis "Comprehensive password hashing framework")
285 (description
286 "Passlib is a password hashing library for Python 2 & 3, which provides
287cross-platform implementations of over 30 password hashing algorithms, as well
288as a framework for managing existing password hashes. It's designed to be
289useful for a wide range of tasks, from verifying a hash found in /etc/shadow,
290to providing full-strength password hashing for multi-user application.")
291 (license license:bsd-3)))
292
293(define-public python-paramiko
294 (package
295 (name "python-paramiko")
296 (version "4.0.0")
297 (source
298 (origin
299 (method url-fetch)
300 (uri (pypi-uri "paramiko" version))
301 (sha256
302 (base32 "17ynnmagd44gpp76r26rz1kldb37f79hm4ibinlckj8c71xz09ba"))))
303 (build-system pyproject-build-system)
304 (native-inputs
305 (list python-icecream
306 python-pytest
307 python-pytest-relaxed
308 python-setuptools))
309 (propagated-inputs
310 (list python-bcrypt
311 python-cryptography
312 python-invoke
313 python-pyasn1
314 python-pynacl))
315 (home-page "https://www.paramiko.org/")
316 (synopsis "SSHv2 protocol library")
317 (description "Paramiko is a python implementation of the SSHv2 protocol,
318providing both client and server functionality. While it leverages a Python C
319extension for low level cryptography (PyCrypto), Paramiko itself is a pure
320Python interface around SSH networking concepts.")
321 (license license:lgpl2.1+)))
322
323(define-public python-ecdsa
324 (package
325 (name "python-ecdsa")
326 (version "0.19.0")
327 (source
328 (origin
329 (method url-fetch)
330 (uri (pypi-uri "ecdsa" version))
331 (sha256
332 (base32 "1y3bmx6aw5klx143jas3czwbsfvr5d3fs8gm1bfh16b5k48svsk0"))))
333 (build-system pyproject-build-system)
334 (arguments
335 (list
336 ;; Test fails with error: AssertionError: KeyboardInterrupt not raised.
337 #:test-flags #~(list "-k" "not test_multithreading_with_interrupts")))
338 (native-inputs
339 (list openssl
340 python-pytest
341 python-setuptools
342 python-wheel))
343 (propagated-inputs
344 (list python-six))
345 (home-page "https://github.com/warner/python-ecdsa")
346 (synopsis "ECDSA cryptographic signature library (pure python)")
347 (description
348 "This is an easy-to-use implementation of ECDSA cryptography (Elliptic
349Curve Digital Signature Algorithm), implemented purely in Python. With this
350library, you can quickly create key pairs (signing key and verifying key), sign
351messages, and verify the signatures. The keys and signatures are very short,
352making them easy to handle and incorporate into other protocols.")
353 (license license:expat)))
354
355(define-public python-kerberos
356 (package
357 (name "python-kerberos")
358 (version "1.3.1")
359 (source
360 (origin
361 (method url-fetch)
362 (uri (pypi-uri "kerberos" version))
363 (sha256
364 (base32 "0b0a8rrwgfjrslz3jd3r5l7vr7jx5bc17sq0dbwn002f58a4dl6d"))))
365 (build-system pyproject-build-system)
366 (arguments
367 ;; No tests in PyPI, provided in Git but all of them require networking.
368 (list #:tests? #f))
369 (native-inputs
370 (list python-setuptools
371 python-wheel))
372 (inputs
373 (list mit-krb5))
374 (home-page "https://github.com/apple/ccs-pykerberos")
375 (synopsis "Python Kerberos library used by CalendarServer")
376 (description
377 "This Python package is a high-level wrapper for Kerberos (GSSAPI)
378operations. The goal is to avoid having to build a module that wraps the
379entire Kerberos.framework, and instead offer a limited set of functions that
380do what is needed for client/server Kerberos authentication based on
381<http://www.ietf.org/rfc/rfc4559.txt>.")
382 (license license:asl2.0)))
383
384(define-public python-keyring
385 (package
386 (name "python-keyring")
387 (version "25.7.0")
388 (source
389 (origin
390 (method git-fetch)
391 (uri (git-reference
392 (url "https://github.com/jaraco/keyring")
393 (commit (string-append "v" version))))
394 (file-name (git-file-name name version))
395 (sha256
396 (base32 "116nkhnldhgqd5nz0wf5zfjnkmlrpwj47pdd8p4r1zrizkr3dnxz"))))
397 (build-system pyproject-build-system)
398 (native-inputs
399 (list python-pyfakefs
400 python-pytest
401 python-setuptools
402 python-setuptools-scm))
403 (propagated-inputs
404 (list python-jaraco-classes
405 python-jaraco-context
406 python-jaraco-functools
407 python-jeepney
408 python-secretstorage))
409 (home-page "https://github.com/jaraco/keyring")
410 (synopsis "Store and access your passwords safely")
411 (description
412 "The Python keyring lib provides a easy way to access the system keyring
413service from python. It can be used in any application that needs safe
414password storage.")
415 ;; "MIT" and PSF dual license, see:
416 ;; <https://github.com/jaraco/keyring/issues/263>.
417 (license license:x11)))
418
419(define-public python-keyrings-alt
420 (package
421 (name "python-keyrings-alt")
422 (version "5.0.2")
423 (source
424 (origin
425 (method url-fetch)
426 (uri (pypi-uri "keyrings_alt" version))
427 (sha256
428 (base32 "1yv9gnmkw6kpsjgnid0k1qcd49n9csqcvf02cl88bcf8knz7w2cg"))))
429 (build-system pyproject-build-system)
430 (native-inputs
431 (list python-keyring
432 python-pytest
433 python-setuptools
434 python-setuptools-scm
435 python-wheel))
436 (propagated-inputs
437 (list python-jaraco-classes
438 python-jaraco-context))
439 (home-page "https://github.com/jaraco/keyrings.alt")
440 (synopsis "Alternate keyring implementations")
441 (description
442 "Keyrings in this package may have security risks or other implications.
443These backends were extracted from the main keyring project to make them
444available for those who wish to employ them, but are discouraged for general
445production use. Include this module and use its backends at your own risk.")
446 (license license:expat)))
447
448(define-public python-blake3
449 (package
450 (name "python-blake3")
451 (version "1.0.8")
452 (source
453 (origin
454 (method url-fetch)
455 (uri (pypi-uri "blake3" version))
456 (sha256
457 (base32 "1fk5n55cl2iigrjdwwsm6h8q6in1l19cihh44s0kbh57ypqcfg2i"))))
458 (build-system cargo-build-system)
459 (arguments
460 (list
461 #:install-source? #f
462 #:imported-modules `(,@%pyproject-build-system-modules
463 ,@%cargo-build-system-modules)
464 #:modules `((guix build cargo-build-system)
465 ((guix build pyproject-build-system) #:prefix py:)
466 (guix build utils))
467 #:phases
468 #~(modify-phases %standard-phases
469 (add-after 'build 'build-python-module
470 (assoc-ref py:%standard-phases 'build))
471 (add-after 'build-python-module 'install-python-module
472 (assoc-ref py:%standard-phases 'install)))))
473 (native-inputs
474 (list python-wrapper
475 maturin))
476 (inputs (cargo-inputs 'python-blake3))
477 (propagated-inputs (list python-typing-extensions))
478 (home-page "https://github.com/oconnor663/blake3-py")
479 (synopsis "Python bindings for the Rust blake3 crate")
480 (description "This package provides Python bindings for the Rust crate of
481blake3, a cryptographic hash function.")
482 ;; This work is released into the public domain with CC0
483 ;; 1.0. Alternatively, it is licensed under the Apache License 2.0.
484 (license (list license:asl2.0 license:cc0))))
485
486(define-public python-certauth
487 (package
488 (name "python-certauth")
489 (version "1.3.0")
490 (source
491 (origin
492 (method url-fetch)
493 (uri (pypi-uri "certauth" version))
494 (sha256
495 (base32
496 "1yxqfb5131wahjyw9pxz03bq476rcfx62s6k53xx4cqbzzgdaqkq"))))
497 (build-system pyproject-build-system)
498 (arguments
499 (list
500 #:test-flags
501 #~(list "-k" (string-join
502 (list
503 ;; Those tests uses PKCS12, which has been removed in
504 ;; pyopenssl 23.3.0:
505 "not test_custom_not_before_not_after"
506 "test_ca_cert_in_mem")
507 " and not "))
508 #:phases
509 #~(modify-phases %standard-phases
510 (add-after 'unpack 'adjust-test
511 (lambda _
512 ;; Newer PyOpenSSL no longer separates extensions with
513 ;; newline (this can be removed for >1.3.0).
514 (substitute* "test/test_certauth.py"
515 (("7334\\\\n, DNS") "7334, DNS")))))))
516 (propagated-inputs
517 (list python-pyopenssl python-tldextract))
518 (native-inputs
519 (list nss-certs-for-test python-pytest python-setuptools))
520 (home-page "https://github.com/ikreymer/certauth")
521 (synopsis "Certificate authority creation tool")
522 (description "This package provides a small library, built on top of
523pyOpenSSL, which allows for creating a custom certificate authority (CA)
524certificate, and generating on-demand dynamic host certs using that CA
525certificate. It is most useful for use with a man-in-the-middle HTTPS proxy,
526for example, for recording or replaying web content.")
527 (license license:expat)))
528
529(define-public python-certifi
530 (package
531 (name "python-certifi")
532 (version "2025.06.15")
533 (source
534 (origin
535 (method git-fetch) ; no tests in PyPI package
536 (uri (git-reference
537 (url "https://github.com/certifi/python-certifi")
538 (commit version)))
539 (file-name (git-file-name name version))
540 (sha256
541 (base32 "1yyy3c64xbwfg2b8hi1fd6vwh56fzc90jfy3czimv5i91gwrl7ba"))
542 (snippet #~(begin
543 (delete-file "certifi/cacert.pem")
544 (delete-file "certifi/core.py")
545 (with-output-to-file "certifi/core.py"
546 (lambda _
547 (display
548 "\"\"\"
549certifi.py
550~~~~~~~~~~
551This file is a Guix-specific version of core.py.
552
553This module returns the installation location of SSL_CERT_FILE or
554/etc/ssl/certs/ca-certificates.crt, or its contents.
555\"\"\"
556import os
557
558_CA_CERTS = None
559
560try:
561 _CA_CERTS = os.environ [\"SSL_CERT_FILE\"]
562except:
563 _CA_CERTS = os.path.join(\"/etc\", \"ssl\", \"certs\", \"ca-certificates.crt\")
564
565def where() -> str:
566 return _CA_CERTS
567
568def contents() -> str:
569 with open(where(), \"r\", encoding=\"ascii\") as data:
570 return data.read()")))))))
571 (build-system pyproject-build-system)
572 (native-inputs
573 (list nss-certs-for-test
574 python-pytest
575 python-setuptools
576 python-wheel))
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;; XXX: This project was archived by the owner on Apr 20, 2025. It is now
1376;; read-only. Consider to remove when starts failing to build and nothing
1377;; depends on it.
1378(define-public python-rsa
1379 (package
1380 (name "python-rsa")
1381 (version "4.9.1")
1382 (source
1383 (origin
1384 (method url-fetch)
1385 (uri (pypi-uri "rsa" version))
1386 (sha256
1387 (base32 "0xdfs3mhdb9wjpckj7i4zyv9sr82m7hk0mfkvw3lrnlpakdvzgg7"))))
1388 (build-system pyproject-build-system)
1389 (arguments
1390 (list #:tests? #f)) ;tests are not included in PyPI archive
1391 (native-inputs
1392 (list python-poetry-core))
1393 (propagated-inputs
1394 (list python-pyasn1))
1395 (home-page "https://stuvel.eu/rsa")
1396 (synopsis "Pure-Python RSA implementation")
1397 (description "Python-RSA is a pure-Python RSA implementation. It supports
1398encryption and decryption, signing and verifying signatures, and key
1399generation according to PKCS#1 version 1.5. It can be used as a Python
1400library as well as on the command line.")
1401 (license license:asl2.0)))
1402
1403(define-public python-rsa-for-awscli-1
1404 (hidden-package
1405 (package
1406 (inherit python-rsa)
1407 (version "3.4.2")
1408 (source
1409 (origin
1410 (method url-fetch)
1411 (uri (pypi-uri "rsa" version))
1412 (sha256
1413 (base32 "1dcxvszbikgzh99ybdc7jq0zb9wspy2ds8z9mjsqiyv3q884xpr5"))))
1414 (native-inputs
1415 (list python-setuptools)))))
1416
1417(define-public python-scrypt
1418 (package
1419 (name "python-scrypt")
1420 (version "0.9.4")
1421 (source
1422 (origin
1423 (method git-fetch)
1424 (uri (git-reference
1425 (url "https://github.com/holgern/py-scrypt")
1426 (commit (string-append "v" version))))
1427 (file-name (git-file-name name version))
1428 (sha256
1429 (base32 "07mr8slhplk0pfji3pfb86281wf035c3vxg7w4g17vgry1l5fdg2"))))
1430 (build-system pyproject-build-system)
1431 (native-inputs (list python-pytest python-setuptools python-wheel))
1432 (inputs (list openssl))
1433 (home-page "https://github.com/holgern/py-scrypt")
1434 (synopsis "Bindings for the scrypt key derivation function library")
1435 (description
1436 "This package is a set of Python bindings for the scrypt key derivation
1437function.")
1438 (license license:bsd-2)))
1439
1440(define-public python-service-identity
1441 (package
1442 (name "python-service-identity")
1443 (version "24.2.0")
1444 (source
1445 (origin
1446 (method url-fetch)
1447 (uri (pypi-uri "service_identity" version))
1448 (sha256
1449 (base32 "02cfpry5alap6mf3ffq1gdq6s7a2cmgjqpb2bp6wcf8d7yhkns5q"))))
1450 (build-system pyproject-build-system)
1451 (native-inputs
1452 (list python-hatch-fancy-pypi-readme
1453 python-hatch-vcs
1454 python-hatchling
1455 python-idna
1456 python-pytest))
1457 (propagated-inputs
1458 (list python-attrs
1459 python-cryptography
1460 python-pyasn1
1461 python-pyasn1-modules
1462 python-six))
1463 (home-page "https://service-identity.readthedocs.io/")
1464 (synopsis "Service identity verification for PyOpenSSL")
1465 (description
1466 "@code{service_identity} aspires to give you all the tools you need for
1467verifying whether a certificate is valid for the intended purposes. In the
1468simplest case, this means host name verification. However, service_identity
1469implements RFC 6125 fully and plans to add other relevant RFCs too.")
1470 (license license:expat)))
1471
1472(define-public python-google-crc32c
1473 (package
1474 (name "python-google-crc32c")
1475 (version "1.3.0")
1476 (source
1477 (origin
1478 (method git-fetch)
1479 (uri (git-reference
1480 (url "https://github.com/googleapis/python-crc32c")
1481 (commit (string-append "v" version))))
1482 (file-name (git-file-name name version))
1483 (sha256
1484 (base32 "005ra4pfv71rq53198k7q6k63f529q3g6hkbxbwfcf82jr77hxga"))))
1485 (build-system pyproject-build-system)
1486 (inputs (list crc32c))
1487 (native-inputs (list python-pytest python-setuptools python-wheel))
1488 (home-page "https://github.com/googleapis/python-crc32c")
1489 (synopsis "Python wrapper of Google CRC32C")
1490 (description
1491 "This package provides a Python wrapper of the C library implementation
1492of the CRC32C hashing algorithm.")
1493 (license license:asl2.0)))
1494
1495(define-public python-shamir-mnemonic
1496 (package
1497 (name "python-shamir-mnemonic")
1498 (version "0.3.0")
1499 (source
1500 (origin
1501 (method git-fetch)
1502 (uri (git-reference
1503 (url "https://github.com/trezor/python-shamir-mnemonic")
1504 (commit (string-append "v" version))))
1505 (file-name (git-file-name name version))
1506 (sha256
1507 (base32 "0nzg1l9hrjgrw8jnji8jjl6yy8wixxipcbdjhmh6x1vn1z25ndia"))))
1508 (build-system pyproject-build-system)
1509 (native-inputs
1510 (list python-bip32utils
1511 python-poetry-core
1512 python-pytest))
1513 (propagated-inputs
1514 (list python-click))
1515 (home-page "https://github.com/trezor/python-shamir-mnemonic")
1516 (synopsis "SLIP-39 Shamir Mnemonics")
1517 (description
1518 "This package provides a reference implementation of SLIP-0039: Shamir's
1519Secret-Sharing for Mnemonic Codes. This SLIP describes a standard and
1520interoperable implementation of Shamir's secret sharing (SSS). SSS splits a
1521secret into unique parts which can be distributed among participants, and
1522requires a specified minimum number of parts to be supplied in order to
1523reconstruct the original secret. Knowledge of fewer than the required number
1524of parts does not leak information about the secret.")
1525 (license license:expat)))
1526
1527(define-public python-slip10
1528 (package
1529 (name "python-slip10")
1530 (version "1.1.0")
1531 (source
1532 (origin
1533 (method git-fetch)
1534 (uri (git-reference
1535 (url "https://github.com/trezor/python-slip10")
1536 (commit (string-append "v" version))))
1537 (file-name (git-file-name name version))
1538 (sha256
1539 (base32 "0r1p7kxg1hcc3mcda8mrrhrnx6idzik7gw8c42q4359yp633vv83"))))
1540 (build-system pyproject-build-system)
1541 (native-inputs
1542 (list python-poetry-core
1543 python-pytest))
1544 (propagated-inputs
1545 (list python-cryptography))
1546 (home-page "https://github.com/trezor/python-slip10")
1547 (synopsis "Reference implementation of SLIP10 ")
1548 (description
1549 "This package provides a reference implementation of the SLIP-0010 (see:
1550https://github.com/satoshilabs/slips, slip-0010.md) specification,which
1551generalizes the BIP-0032 (see: https://github.com/bitcoin/bips/tree,
1552bip-0032.mediawiki) derivation scheme for private and public key pairs in
1553hierarchical deterministic wallets for the curves secp256k1, NIST P-256,
1554ed25519 and curve25519.")
1555 (license license:bsd-3)))
1556
1557(define-public python-spake2
1558 (package
1559 (name "python-spake2")
1560 (version "0.9")
1561 (source
1562 (origin
1563 (method url-fetch)
1564 (uri (pypi-uri "spake2" version))
1565 (sha256
1566 (base32 "0d4kbaxi4cv8klyqh6yb0p0qiwfdwvczy1h2mzvmlfdcsnlc87s2"))))
1567 (build-system pyproject-build-system)
1568 (native-inputs (list python-pytest python-setuptools))
1569 (propagated-inputs (list python-cryptography))
1570 (home-page "https://github.com/warner/python-spake2")
1571 (synopsis "SPAKE2 password-authenticated key exchange in Python")
1572 (description "This package provides a Python implementation of the SPAKE2
1573Password-Authenticated Key Exchange algorithm.")
1574 (license license:expat)))
1575
1576(define-public python-keyutils
1577 (package
1578 (name "python-keyutils")
1579 (version "0.6")
1580 (source
1581 (origin
1582 (method url-fetch)
1583 (uri (pypi-uri "keyutils" version))
1584 (sha256
1585 (base32 "0lipygpzhwzzsq2k5imb1jgkmj8y4khxdwhzadjs3bd56g6bmkx9"))))
1586 (build-system pyproject-build-system)
1587 (arguments
1588 (list
1589 #:tests? #f
1590 #:phases
1591 #~(modify-phases %standard-phases
1592 (add-before 'build 'regenerate-c-file
1593 (lambda _
1594 (invoke "cython" "keyutils/_keyutils.pyx"))))))
1595 (native-inputs
1596 (list python-cython python-pytest python-setuptools))
1597 (inputs
1598 (list keyutils))
1599 (home-page "https://github.com/sassoftware/python-keyutils")
1600 (synopsis "Python bindings for keyutils")
1601 (description
1602 "This is a set of python bindings for keyutils, a key management suite
1603that leverages the infrastructure provided by the Linux kernel for safely
1604storing and retrieving sensitive information in your programs.")
1605 (license license:asl2.0)))
1606
1607(define-public python-mcuboot-imgtool
1608 (package
1609 (name "python-mcuboot-imgtool")
1610 (version "1.4.0")
1611 (source
1612 (origin
1613 (method git-fetch)
1614 (uri (git-reference
1615 (url "https://github.com/mcu-tools/mcuboot")
1616 (commit (string-append "v" version))))
1617 (file-name (git-file-name name version))
1618 (sha256
1619 (base32 "1m1csyvzq4jx81zg635ssy1n7sc0z539z0myh872ll3nwqx7wa0q"))))
1620 (build-system pyproject-build-system)
1621 (arguments
1622 (list
1623 #:phases
1624 #~(modify-phases %standard-phases
1625 (add-after 'unpack 'fix-broken-test
1626 (lambda _
1627 (substitute* "scripts/imgtool/keys/ed25519_test.py"
1628 (("raw_sign")
1629 "sign_digest"))))
1630 (add-before 'build 'change-directory
1631 (lambda _
1632 (chdir "scripts"))))))
1633 (native-inputs (list python-pytest python-setuptools python-wheel))
1634 (propagated-inputs (list python-click python-intelhex python-cryptography))
1635 (home-page "https://mcuboot.com")
1636 (synopsis "Tool to securely sign firmware images for booting by MCUboot")
1637 (description
1638 "MCUboot is a secure bootloader for 32-bit MCUs. This package provides a
1639tool to securely sign firmware images for booting by MCUboot.")
1640 (license license:expat)))
1641
1642(define-public python-ntlm-auth
1643 (package
1644 (name "python-ntlm-auth")
1645 (version "1.5.0")
1646 (source
1647 (origin
1648 (method git-fetch)
1649 (uri (git-reference
1650 (url "https://github.com/jborean93/ntlm-auth")
1651 (commit (string-append "v" version))))
1652 (file-name (git-file-name name version))
1653 (sha256
1654 (base32 "00dpf5bfsy07frsjihv1k10zmwcyq4bvkilbxha7h6nlwpcm2409"))))
1655 (build-system pyproject-build-system)
1656 (native-inputs
1657 (list python-pytest python-requests python-setuptools python-wheel))
1658 (propagated-inputs (list python-cryptography))
1659 (home-page "https://github.com/jborean93/ntlm-auth")
1660 (synopsis "Calculates NTLM Authentication codes")
1661 (description
1662 "This library handles the low-level details of NTLM authentication for
1663use in authenticating with a service that uses NTLM. It will create and parse
1664the 3 different message types in the order required and produce a base64
1665encoded value that can be attached to the HTTP header.
1666
1667The goal of this library is to offer full NTLM support including signing and
1668sealing of messages as well as supporting MIC for message integrity and the
1669ability to customise and set limits on the messages sent. Please see Features
1670and Backlog for a list of what is and is not currently supported.")
1671 (license license:expat)))
1672
1673(define-public python-secretstorage
1674 (package
1675 (name "python-secretstorage")
1676 (version "3.3.3")
1677 (source
1678 (origin
1679 (method url-fetch)
1680 (uri (pypi-uri "SecretStorage" version))
1681 (sha256
1682 (base32 "0xxxxr77sgmjm1rqzdd1rkan9xg0qmv8awc1pb9adv39ycz560r4"))))
1683 (build-system pyproject-build-system)
1684 (arguments
1685 '(#:tests? #f)) ; Tests require a running dbus service.
1686 (native-inputs
1687 (list python-setuptools))
1688 (propagated-inputs
1689 (list python-cryptography python-jeepney))
1690 (home-page "https://github.com/mitya57/secretstorage")
1691 (synopsis "Python bindings to FreeDesktop.org Secret Service API")
1692 (description
1693 "@code{python-secretstorage} provides a way for securely storing passwords
1694and other secrets. It uses D-Bus Secret Service API that is supported by GNOME
1695Keyring (since version 2.30) and KSecretsService. SecretStorage supports most
1696of the functions provided by Secret Service, including creating and deleting
1697items and collections, editing items, locking and unlocking collections
1698(asynchronous unlocking is also supported).")
1699 (license license:bsd-3)))
1700
1701(define-public python-trustme
1702 (package
1703 (name "python-trustme")
1704 (version "1.2.1")
1705 (source
1706 (origin
1707 (method url-fetch)
1708 (uri (pypi-uri "trustme" version))
1709 (sha256
1710 (base32 "0zz49agi7hy82fbr03xs6k9vjgiy7v8qsp426cgv8bbzphmvla35"))))
1711 (build-system pyproject-build-system)
1712 (native-inputs
1713 (list python-hatchling
1714 python-pyopenssl
1715 python-pytest
1716 python-service-identity))
1717 (propagated-inputs
1718 (list python-cryptography
1719 python-idna))
1720 (home-page "https://trustme.readthedocs.io")
1721 (synopsis "Fake a certificate authority for tests")
1722 (description
1723 "@code{trustme} is a tiny Python package that does one thing: it gives you
1724a fake certificate authority (CA) that you can use to generate fake TLS certs to
1725use in your tests.")
1726 ;; Either license applies.
1727 (license (list license:expat license:asl2.0))))
1728
1729(define-public python-certipy
1730 (package
1731 (name "python-certipy")
1732 (version "0.2.2")
1733 (source
1734 (origin
1735 (method url-fetch)
1736 (uri (pypi-uri "certipy" version))
1737 (sha256
1738 (base32 "0pm0kf079ws9s93vpkxnw3gj6a1hi34p34bicx69rqlyh7cg7wgy"))))
1739 (build-system pyproject-build-system)
1740 (propagated-inputs (list python-cryptography))
1741 (native-inputs (list python-pypa-build
1742 python-flask
1743 python-pytest
1744 python-setuptools
1745 python-wheel))
1746 (home-page "https://github.com/LLNL/certipy")
1747 (synopsis "Utility to create and sign CAs and certificates")
1748 (description
1749 "Certipy was made to simplify the certificate creation process. To that
1750end, certipy exposes methods for creating and managing certificate authorities,
1751certificates, signing and building trust bundles.")
1752 (license license:bsd-3)))
1753
1754(define-public python-jeepney
1755 (package
1756 (name "python-jeepney")
1757 (version "0.9")
1758 (source
1759 (origin
1760 (method git-fetch)
1761 (uri (git-reference
1762 (url "https://gitlab.com/takluyver/jeepney")
1763 (commit version)))
1764 (file-name (git-file-name name version))
1765 (sha256
1766 (base32 "06vxw61a6zp4pvxmpdlpn29mh6bgjl317f3k1kc29gj3zgh3zk3p"))))
1767 (build-system pyproject-build-system)
1768 (native-inputs
1769 (list python-flit-core
1770 python-pytest
1771 python-pytest-asyncio
1772 python-pytest-trio
1773 python-testpath))
1774 (propagated-inputs
1775 (list python-trio)) ;optional
1776 (home-page "https://gitlab.com/takluyver/jeepney")
1777 (synopsis "Low-level, pure Python DBus protocol wrapper")
1778 (description
1779 "This is a low-level, pure Python DBus protocol client. It has an
1780I/O-free core, and integration modules for different event loops.")
1781 (license license:expat)))
1782
1783(define-public python-argon2-cffi
1784 (package
1785 (name "python-argon2-cffi")
1786 (version "25.1.0")
1787 (source
1788 (origin
1789 (method url-fetch)
1790 (uri (pypi-uri "argon2_cffi" version))
1791 (sha256
1792 (base32 "1ha62fg9blw38q3qayjid8608fp2a57fd81cpzic9x22ib6fajk9"))))
1793 (build-system pyproject-build-system)
1794 (native-inputs
1795 (list python-hatch-fancy-pypi-readme
1796 python-hatch-vcs
1797 python-hatchling
1798 python-pytest))
1799 (propagated-inputs
1800 (list python-argon2-cffi-bindings))
1801 (home-page "https://argon2-cffi.readthedocs.io/")
1802 (synopsis "Secure Password Hashes for Python")
1803 (description
1804 "Argon2 is a secure password hashing algorithm. It is designed to have
1805both a configurable runtime as well as memory consumption. This means that you
1806can decide how long it takes to hash a password and how much memory is required.")
1807 (license license:expat)))
1808
1809(define-public python-argon2-cffi-bindings
1810 (package
1811 (name "python-argon2-cffi-bindings")
1812 (version "25.1.0")
1813 (source
1814 (origin
1815 (method url-fetch)
1816 (uri (pypi-uri "argon2_cffi_bindings" version))
1817 (sha256
1818 (base32 "179256zsrh5c51zmv9k1sc9p102j152nzxqgwhhdhmadxbkg6mxr"))))
1819 (build-system pyproject-build-system)
1820 (arguments
1821 (list
1822 #:phases
1823 #~(modify-phases %standard-phases
1824 (add-before 'build 'use-system-argon2
1825 (lambda _
1826 (setenv "ARGON2_CFFI_USE_SYSTEM" "1"))))))
1827 (native-inputs
1828 (list python-pytest
1829 python-setuptools
1830 python-setuptools-scm))
1831 (inputs
1832 (list argon2))
1833 (propagated-inputs
1834 (list python-cffi))
1835 (home-page "https://github.com/hynek/argon2-cffi-bindings")
1836 (synopsis "Low-level CFFI bindings for Argon2")
1837 (description
1838 "argon2-cffi-bindings provides low-level CFFI bindings to the official
1839implementation of the Argon2 password hashing algorithm.")
1840 (license license:expat)))
1841
1842(define-public python-privy
1843 (package
1844 (name "python-privy")
1845 (version "6.0.0")
1846 (source
1847 (origin
1848 (method git-fetch)
1849 (uri (git-reference
1850 ;; Releases are untagged
1851 (url "https://github.com/ofek/privy")
1852 (commit "2838db3df239797c71bddacc48a4c49a83f35747")))
1853 (file-name (git-file-name name version))
1854 (sha256
1855 (base32 "1m32dh5fqc8cy7jyf1z5fs6zvmdkbq5fi98hr609gbl7s0l0y0i9"))))
1856 (build-system pyproject-build-system)
1857 (native-inputs (list python-pytest python-setuptools))
1858 (propagated-inputs (list python-argon2-cffi python-cryptography))
1859 (home-page "https://www.dropbox.com/developers")
1860 (synopsis "Library to password-protect your data")
1861 (description
1862 "Privy is a small and fast utility for password-protecting secret
1863data such as API keys, cryptocurrency wallets, or seeds for digital
1864signatures.")
1865 (license (list license:expat license:asl2.0)))) ; dual licensed
1866
1867(define-public python-pgpy
1868 (package
1869 (name "python-pgpy")
1870 (version "0.6.0")
1871 (source
1872 (origin
1873 (method url-fetch)
1874 (uri (pypi-uri "PGPy" version))
1875 (sha256
1876 (base32 "10w3h934fi1ijx72ppn67a50yhkf8n1db6xx02gk2fjc7wsjx717"))))
1877 (build-system pyproject-build-system)
1878 (arguments
1879 (list #:test-flags
1880 ;; All broken tests are in this file.
1881 ;; They fail with ValueError: key_size must be at least 1024-bits.
1882 #~(list "--ignore" "tests/test_10_exceptions.py")))
1883 (native-inputs
1884 (list python-pytest python-setuptools python-wheel))
1885 (propagated-inputs (list python-cryptography python-pyasn1))
1886 (home-page "https://github.com/SecurityInnovation/PGPy")
1887 (synopsis "Python implementation of OpenPGP")
1888 (description
1889 "Currently, PGPy can load keys and signatures of all kinds in both ASCII
1890armored and binary formats.
1891
1892It can create and verify RSA, DSA, and ECDSA signatures, at the moment. It
1893can also encrypt and decrypt messages using RSA and ECDH.")
1894 (license license:bsd-3)))
1895
1896(define-public python-pyu2f
1897 (package
1898 (name "python-pyu2f")
1899 ;; Released version fails tests in Python 3.12.
1900 ;; pyu2f is no longer being developed.
1901 (properties '((commit . "064be5ab9f4282855a15c79ecb9f7eec37f3938c")
1902 (revision . "0")))
1903 (version (git-version "0.1.5"
1904 (assoc-ref properties 'revision)
1905 (assoc-ref properties 'commit)))
1906 (source
1907 (origin
1908 (method git-fetch)
1909 (uri (git-reference
1910 (url "https://github.com/google/pyu2f/")
1911 (commit (assoc-ref properties 'commit))))
1912 (file-name (git-file-name name version))
1913 (sha256
1914 (base32 "1373q4vzn449p8vsclhrsa5jb3vx9x77g2hdvibim5qwa1d724b9"))))
1915 (build-system pyproject-build-system)
1916 (arguments
1917 (list
1918 ;; This test requires the fakefs package.
1919 #:test-flags #~(list "--ignore=pyu2f/tests/hid/linux_test.py")))
1920 (native-inputs (list python-mock python-pytest python-setuptools))
1921 (propagated-inputs (list python-six))
1922 (home-page "https://github.com/google/pyu2f/")
1923 (synopsis "U2F host library for interacting with a U2F device over USB")
1924 (description
1925 "Pyu2f is a Python-based U2F host library. It provides functionality for
1926interacting with a U2F device over USB.")
1927 (license license:asl2.0)))
1928
1929(define-public python-sop
1930 (package
1931 (name "python-sop")
1932 (version "0.5.1")
1933 (source
1934 (origin
1935 (method git-fetch)
1936 (uri (git-reference
1937 (url "https://gitlab.com/dkg/python-sop")
1938 (commit (string-append "sop-" version))))
1939 (file-name (git-file-name name version))
1940 (sha256
1941 (base32 "0sin5miiiqgww0s52jz098x44nbnx003vfd4jn55bs5mgca60lll"))))
1942 (build-system pyproject-build-system)
1943 (arguments
1944 (list #:tests? #f)) ; XXX: No tests upstream.
1945 (native-inputs (list python-setuptools python-wheel))
1946 (home-page "https://gitlab.com/dkg/python-sop")
1947 (synopsis "Stateless OpenPGP Command-Line Interface")
1948 (description
1949 "The Stateless OpenPGP Command-Line Interface (or sop) is a
1950specification that encourages OpenPGP implementers to provide a common,
1951relatively simple command-line API for purposes of object security.
1952
1953This Python module helps implementers build such a CLI from any implementation
1954accessible to the Python interpreter.
1955
1956It does not provide such an implementation itself -- this is just the
1957scaffolding for the command line, which should make it relatively easy to
1958supply a handful of python functions as methods to a class.")
1959 (license license:expat))) ; MIT license
1960
1961(define-public python-starkbank-ecdsa
1962 (package
1963 (name "python-starkbank-ecdsa")
1964 (version "2.2.0")
1965 (home-page "https://github.com/starkbank/ecdsa-python")
1966 (source
1967 (origin
1968 (method git-fetch)
1969 (uri (git-reference
1970 (url home-page)
1971 (commit (string-append "v" version))))
1972 (file-name (git-file-name name version))
1973 (sha256
1974 (base32 "01zy16csrbyfhjl0kay9rbpbwc3dpr7kh2qkrbdy5a1n644fbahx"))))
1975 (arguments
1976 (list
1977 #:test-backend #~'unittest
1978 #:phases
1979 #~(modify-phases %standard-phases
1980 (add-after 'unpack 'remove-broken-test
1981 (lambda _
1982 (delete-file "tests/testOpenSSL.py"))))))
1983 (build-system pyproject-build-system)
1984 (native-inputs (list python-setuptools))
1985 (synopsis "Python ECDSA library")
1986 (description "This package provides a Python ECDSA library, optimized for
1987speed but without C extensions.")
1988 (license license:expat)))
1989
1990(define-public python-zxcvbn
1991 (package
1992 (name "python-zxcvbn")
1993 (version "4.5.0")
1994 (source
1995 (origin
1996 (method git-fetch) ;for tests
1997 (uri (git-reference
1998 (url "https://github.com/dwolfhub/zxcvbn-python")
1999 (commit (string-append "v" version))))
2000 (file-name (git-file-name name version))
2001 (sha256
2002 (base32 "0x39yi4zc1n6mjjk3rx32ick0hysyi9hv9ln69apcch4jf84j9fi"))))
2003 (build-system pyproject-build-system)
2004 (native-inputs (list python-pytest python-setuptools python-wheel))
2005 (home-page "https://github.com/dwolfhub/zxcvbn-python")
2006 (synopsis "Realistic password strength estimator Python library")
2007 (description
2008 "This is a Python implementation of the @code{zxcvbn} library created at
2009Dropbox. The original library, written for JavaScript, can be found
2010@url{https://github.com/dropbox/zxcvbn, here}. This port includes features
2011such as:
2012@enumerate
2013@item Accepts user data to be added to the dictionaries that are tested
2014against (name, birthdate, etc.)
2015@item Gives a score to the password, from 0 (terrible) to 4 (great).
2016@item Provides feedback on the password and ways to improve it.
2017@item Returns time estimates on how long it would take to guess the password
2018in different situations.
2019@end enumerate")
2020 (license license:expat)))
2021
2022(define-public python-zxcvbn-rs-py
2023 (package
2024 (name "python-zxcvbn-rs-py")
2025 (version "0.3.0")
2026 (source
2027 (origin
2028 (method git-fetch)
2029 (uri (git-reference
2030 (url "https://github.com/fief-dev/zxcvbn-rs-py")
2031 (commit (string-append "v" version))))
2032 (file-name (git-file-name name version))
2033 (sha256
2034 (base32 "0pmc68x6ycsz4g7sr48nb7cv6v46rljc3wb1vc531lyc6hsh80qm"))))
2035 (build-system pyproject-build-system)
2036 (arguments
2037 (list
2038 #:imported-modules `(,@%cargo-build-system-modules
2039 ,@%pyproject-build-system-modules)
2040 #:modules '(((guix build cargo-build-system) #:prefix cargo:)
2041 (guix build pyproject-build-system)
2042 (guix build utils))
2043 #:phases
2044 #~(modify-phases %standard-phases
2045 (add-after 'unpack 'prepare-cargo-build-system
2046 (lambda args
2047 (for-each
2048 (lambda (phase)
2049 (format #t "Running cargo phase: ~a~%" phase)
2050 (apply (assoc-ref cargo:%standard-phases phase)
2051 #:cargo-target #$(cargo-triplet)
2052 args))
2053 '(unpack-rust-crates
2054 configure
2055 check-for-pregenerated-files
2056 patch-cargo-checksums))))
2057 (add-before 'check 'prepare-for-tests
2058 (lambda _
2059 (delete-file-recursively "zxcvbn_rs_py"))))))
2060 (native-inputs
2061 (list rust
2062 `(,rust "cargo")
2063 maturin
2064 python-pytest
2065 python-wheel))
2066 (inputs
2067 (cargo-inputs 'python-zxcvbn-rs-py))
2068 (home-page "https://github.com/fief-dev/zxcvbn-rs-py")
2069 (synopsis
2070 "Python bindings for zxcvbn-rs, a password strength estimation library")
2071 (description
2072 "This package provides a library to estimate password strength. It is
2073implemented by python bindings for zxcvbn-rs and aims to be faster than
2074@code{python-zxcvbn} thanks to its Rust core.")
2075 (license license:expat)))
2076
2077;; XXX: Not maintained since 2016.
2078(define-public python-pydes
2079 (package
2080 (name "python-pydes")
2081 (version "2.0.1")
2082 (source
2083 (origin
2084 (method url-fetch)
2085 (uri (pypi-uri "pyDes" version))
2086 (sha256
2087 (base32 "04lh71f47y04vspfrdrq6a0hn060ibxvdp5z1pcr0gmqs8hqxaz2"))))
2088 (build-system pyproject-build-system)
2089 (arguments
2090 (list #:tests? #f)) ;no tests in PyPI, I could not fine Git
2091 (native-inputs (list python-setuptools))
2092 (home-page "http://twhiteman.netfirms.com/des.html") ;XXX: Dead link
2093 (synopsis
2094 "Pure python implementation of the DES and TRIPLE DES encryption algorithms")
2095 (description
2096 "This package provides a pure Python implementation of the DES and
2097TRIPLE DES encryption algorithms.")
2098 (license license:public-domain)))