projects/guix·blob wip-node-riscv64 · refs

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