projects/guix·blob version-0.15.0 · refs

965 lines · 34.6 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Eric Dvorsak <[email protected]>
3;;; Copyright © 2015, 2016, 2017 Efraim Flashner <[email protected]>
4;;; Copyright © 2015, 2016, 2017 Leo Famulari <[email protected]>
5;;; Copyright © 2016, 2017 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 Tobias Geerinckx-Rice <[email protected]>
12;;; Copyright © 2016, 2017 Nils Gillmann <[email protected]>
13;;; Copyright © 2014, 2015 Mark H Weaver <[email protected]>
14;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <[email protected]>
15;;; Copyright © 2016 Danny Milosavljevic <[email protected]>
16;;; Copyright © 2016, 2017 Arun Isaac <[email protected]>
17;;; Copyright © 2017 Carlo Zancanaro <[email protected]>
18;;; Copyright © 2018 Tomáš Čech <[email protected]>
19;;; Copyright © 2018 Nicolas Goaziou <[email protected]>
20;;; Copyright © 2018 Vagrant Cascadian <[email protected]>
21;;;
22;;; This file is part of GNU Guix.
23;;;
24;;; GNU Guix is free software; you can redistribute it and/or modify it
25;;; under the terms of the GNU General Public License as published by
26;;; the Free Software Foundation; either version 3 of the License, or (at
27;;; your option) any later version.
28;;;
29;;; GNU Guix is distributed in the hope that it will be useful, but
30;;; WITHOUT ANY WARRANTY; without even the implied warranty of
31;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32;;; GNU General Public License for more details.
33;;;
34;;; You should have received a copy of the GNU General Public License
35;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
36
37(define-module (gnu packages python-crypto)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix git-download)
41 #:use-module (guix build-system python)
42 #:use-module (gnu packages)
43 #:use-module (gnu packages check)
44 #:use-module (gnu packages crypto)
45 #:use-module (gnu packages libffi)
46 #:use-module (gnu packages multiprecision)
47 #:use-module (gnu packages protobuf)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages python-web)
50 #:use-module (gnu packages time)
51 #:use-module (gnu packages tls)
52 #:use-module ((guix licenses) #:prefix license:)
53 #:use-module (srfi srfi-1))
54
55(define-public python-base58
56 (package
57 (name "python-base58")
58 (version "1.0.0")
59 (source
60 (origin
61 (method url-fetch)
62 (uri (pypi-uri "base58" version))
63 (sha256
64 (base32
65 "0lgnk7ycdxwhk2bkygl30nsks56bvrdj79ix76iv965pz808pzn5"))))
66 (build-system python-build-system)
67 (native-inputs
68 `(("python-pyhamcrest" ,python-pyhamcrest)))
69 (home-page "https://github.com/keis/base58")
70 (synopsis "Base58 and Base58Check implementation")
71 (description "Base58 and Base58Check implementation compatible
72with what is used by the Bitcoin network.")
73 (license license:expat)))
74
75(define-public python-bcrypt
76 (package
77 (name "python-bcrypt")
78 (version "3.1.4")
79 (source
80 (origin
81 (method url-fetch)
82 (uri (pypi-uri "bcrypt" version))
83 (sha256
84 (base32
85 "13cyrnqwkhc70rs6dg65z4yrrr3dc42fhk11804fqmci9hvimvb7"))))
86 (build-system python-build-system)
87 (native-inputs
88 `(("python-pycparser" ,python-pycparser)
89 ("python-pytest" ,python-pytest)))
90 (propagated-inputs
91 `(("python-cffi" ,python-cffi)
92 ("python-six" ,python-six)))
93 (home-page "https://github.com/pyca/bcrypt/")
94 (synopsis
95 "Modern password hashing library")
96 (description
97 "Bcrypt is a Python module which provides a password hashing method based
98on the Blowfish password hashing algorithm, as described in
99@url{http://static.usenix.org/events/usenix99/provos.html,\"A Future-Adaptable
100Password Scheme\"} by Niels Provos and David Mazieres.")
101 (license license:asl2.0)))
102
103(define-public python2-bcrypt
104 (package-with-python2 python-bcrypt))
105
106(define-public python-passlib
107 (package
108 (name "python-passlib")
109 (version "1.7.1")
110 (source
111 (origin
112 (method url-fetch)
113 (uri (pypi-uri "passlib" version))
114 (sha256
115 (base32
116 "1q2khqpj9rlcgdmkypjdq1kswvhjf72bq0zk2cv669cc2dj8z51x"))))
117 (build-system python-build-system)
118 (native-inputs
119 `(("python-nose" ,python-nose)))
120 (propagated-inputs
121 `(("python-py-bcrypt" ,python-py-bcrypt)))
122 (arguments
123 `(#:phases
124 (modify-phases %standard-phases
125 (add-before 'check 'set-PYTHON_EGG_CACHE
126 ;; some tests require access to "$HOME/.cython"
127 (lambda* _ (setenv "PYTHON_EGG_CACHE" "/tmp") #t)))))
128 (home-page "https://bitbucket.org/ecollins/passlib")
129 (synopsis
130 "Comprehensive password hashing framework")
131 (description
132 "Passlib is a password hashing library for Python 2 & 3, which provides
133cross-platform implementations of over 30 password hashing algorithms, as well
134as a framework for managing existing password hashes. It's designed to be
135useful for a wide range of tasks, from verifying a hash found in /etc/shadow,
136to providing full-strength password hashing for multi-user application.")
137 (license license:bsd-3)))
138
139(define-public python2-passlib
140 (package-with-python2 python-passlib))
141
142(define-public python-py-bcrypt
143 (package
144 (name "python-py-bcrypt")
145 (version "0.4")
146 (source
147 (origin
148 (method url-fetch)
149 (uri (string-append
150 "https://pypi.python.org/packages/source/p/py-bcrypt/py-bcrypt-"
151 version
152 ".tar.gz"))
153 (sha256
154 (base32
155 "0y6smdggwi5s72v6p1nn53dg6w05hna3d264cq6kas0lap73p8az"))))
156 (build-system python-build-system)
157 (home-page "https://code.google.com/p/py-bcrypt")
158 (synopsis
159 "Bcrypt password hashing and key derivation")
160 (description
161 "A python wrapper of OpenBSD's Blowfish password hashing code. This
162system hashes passwords using a version of Bruce Schneier's Blowfish block
163cipher with modifications designed to raise the cost of off-line password
164cracking and frustrate fast hardware implementation. The computation cost of
165the algorithm is parametised, so it can be increased as computers get faster.
166The intent is to make a compromise of a password database less likely to
167result in an attacker gaining knowledge of the plaintext passwords (e.g. using
168John the Ripper).")
169 ;; "sha2.c" is under BSD-3;
170 ;; "blowfish.c" and "bcrypt.c" are under BSD-4;
171 ;; the rest is under ISC.
172 (license (list license:isc license:bsd-3 license:bsd-4))))
173
174(define-public python2-py-bcrypt
175 (package-with-python2 python-py-bcrypt))
176
177(define-public python-pyblake2
178 (package
179 (name "python-pyblake2")
180 (version "1.1.2")
181 (source
182 (origin
183 (method url-fetch)
184 (uri (pypi-uri "pyblake2" version))
185 (sha256
186 (base32
187 "0gz9hgznv5zw4qjq43xa56y0yikimx30gffvibxzm0nv5sq7xk2w"))))
188 (build-system python-build-system)
189 (home-page "https://github.com/dchest/pyblake2")
190 (synopsis "BLAKE2 hash function for Python")
191 (description "BLAKE2 is a cryptographic hash function, which offers
192stronger security while being as fast as MD5 or SHA-1, and comes in two
193flavors: @code{BLAKE2b}, optimized for 64-bit platforms and produces digests
194of any size between 1 and 64 bytes, and @code{BLAKE2s}, optimized for 8- to
19532-bit platforms and produces digests of any size between 1 and 32 bytes.
196
197This package provides a Python interface for BLAKE2.")
198 ;; The COPYING file declares it as public domain, with the option to
199 ;; alternatively use and redistribute it under a variety of permissive
200 ;; licenses. cc0 is explicitly mentioned in setup.py and pyblake2module.c.
201 (license (list license:public-domain license:cc0))))
202
203(define-public python-paramiko
204 (package
205 (name "python-paramiko")
206 (version "2.4.1")
207 (source
208 (origin
209 (method url-fetch)
210 (uri (pypi-uri "paramiko" version))
211 (sha256
212 (base32
213 "1wx4s95i2cdh8hhi1c3jb8lzk71jifa3z9wjfsx905y7lrsngqrk"))))
214 (build-system python-build-system)
215 (arguments
216 `(;; FIXME: Tests require many unpackaged libraries, see dev-requirements.txt.
217 #:tests? #f))
218 (propagated-inputs
219 `(("python-pyasn1" ,python-pyasn1)
220 ("python-cryptography" ,python-cryptography)))
221 (home-page "http://www.paramiko.org/")
222 (synopsis "SSHv2 protocol library")
223 (description "Paramiko is a python implementation of the SSHv2 protocol,
224providing both client and server functionality. While it leverages a Python C
225extension for low level cryptography (PyCrypto), Paramiko itself is a pure
226Python interface around SSH networking concepts.")
227 (license license:lgpl2.1+)))
228
229(define-public python2-paramiko
230 (package-with-python2 python-paramiko))
231
232(define-public python-ecdsa
233 (package
234 (name "python-ecdsa")
235 (version "0.13")
236 (source
237 (origin
238 (method url-fetch)
239 (uri (string-append
240 "https://pypi.python.org/packages/source/e/ecdsa/ecdsa-"
241 version
242 ".tar.gz"))
243 (sha256
244 (base32
245 "1yj31j0asmrx4an9xvsaj2icdmzy6pw0glfpqrrkrphwdpi1xkv4"))))
246 (build-system python-build-system)
247 (inputs
248 `(("openssl" ,openssl)))
249 (home-page
250 "https://github.com/warner/python-ecdsa")
251 (synopsis
252 "ECDSA cryptographic signature library (pure python)")
253 (description
254 "This is an easy-to-use implementation of ECDSA cryptography (Elliptic
255Curve Digital Signature Algorithm), implemented purely in Python. With this
256library, you can quickly create keypairs (signing key and verifying key), sign
257messages, and verify the signatures. The keys and signatures are very short,
258making them easy to handle and incorporate into other protocols.")
259 (license license:expat)))
260
261(define-public python2-ecdsa
262 (package-with-python2 python-ecdsa))
263
264;;; Pycrypto is abandoned upstream:
265;;;
266;;; https://github.com/dlitz/pycrypto/issues/173
267;;;
268;;; TODO Remove this package from GNU Guix.
269(define-public python-pycrypto
270 (package
271 (name "python-pycrypto")
272 (version "2.6.1")
273 (source
274 (origin
275 (method url-fetch)
276 (uri (pypi-uri "pycrypto" version))
277 (patches (search-patches "python-pycrypto-CVE-2013-7459.patch"))
278 (sha256
279 (base32
280 "0g0ayql5b9mkjam8hym6zyg6bv77lbh66rv1fyvgqb17kfc1xkpj"))))
281 (build-system python-build-system)
282 (inputs
283 `(("python" ,python)
284 ("gmp" ,gmp)))
285 (arguments
286 `(#:phases
287 (modify-phases %standard-phases
288 (add-before 'build 'set-build-env
289 ;; pycrypto runs an autoconf configure script behind the scenes
290 (lambda _ (setenv "CONFIG_SHELL" (which "bash")) #t)))))
291 (home-page "http://www.pycrypto.org/")
292 (synopsis "Cryptographic modules for Python")
293 (description
294 "Pycrypto is a collection of both secure hash functions (such as SHA256
295and RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal,
296etc.). The package is structured to make adding new modules easy.")
297 (license license:public-domain)))
298
299(define-public python2-pycrypto
300 (let ((pycrypto (package-with-python2 python-pycrypto)))
301 (package (inherit pycrypto)
302 (inputs
303 `(("python" ,python-2)
304 ,@(alist-delete
305 "python"
306 (package-inputs pycrypto)))))))
307
308(define-public python-keyring
309 (package
310 (name "python-keyring")
311 (version "8.7")
312 (source
313 (origin
314 (method url-fetch)
315 (uri (pypi-uri "keyring" version))
316 (sha256
317 (base32
318 "0482rmi2x6p78wl2kz8qzyq21xz1sbbfwnv5x7dggar4vkwxhzfx"))))
319 (build-system python-build-system)
320 (native-inputs
321 `(("python-setuptools-scm" ,python-setuptools-scm)))
322 (propagated-inputs
323 `(("python-pycrypto" ,python-pycrypto)))
324 (arguments
325 `(#:tests? #f)) ;TODO: tests require pytest
326 (home-page "https://github.com/jaraco/keyring")
327 (synopsis "Store and access your passwords safely")
328 (description
329 "The Python keyring lib provides a easy way to access the system keyring
330service from python. It can be used in any application that needs safe
331password storage.")
332 ;; "MIT" and PSF dual license
333 (license license:x11)))
334
335(define-public python2-keyring
336 (package-with-python2 python-keyring))
337
338(define-public python-certifi
339 (package
340 (name "python-certifi")
341 (version "2017.1.23")
342 (source (origin
343 (method url-fetch)
344 (uri (pypi-uri "certifi" version))
345 (sha256
346 (base32
347 "1klrzl3hgvcf2mjk00g0k3kk1p2z27vzwnxivwar4vhjmjvpz1w1"))))
348 (build-system python-build-system)
349 (home-page "https://certifi.io/")
350 (synopsis "Python CA certificate bundle")
351 (description
352 "Certifi is a Python library that contains a CA certificate bundle, which
353is used by the Requests library to verify HTTPS requests.")
354 (license license:asl2.0)))
355
356(define-public python2-certifi
357 (package-with-python2 python-certifi))
358
359(define-public python-cryptography-vectors
360 (package
361 (name "python-cryptography-vectors")
362 (version "2.2.2")
363 (source
364 (origin
365 (method url-fetch)
366 (uri (pypi-uri "cryptography_vectors" version))
367 (sha256
368 (base32
369 "122na0c6r24ch2ifyr4ccjyih0inpqy7bc5za77699g3pa22rd98"))))
370 (build-system python-build-system)
371 (home-page "https://github.com/pyca/cryptography")
372 (synopsis "Test vectors for the cryptography package")
373 (description
374 "This package contains test vectors for the cryptography package.")
375 ;; Distributed under either BSD-3 or ASL2.0
376 (license (list license:bsd-3 license:asl2.0))))
377
378(define-public python2-cryptography-vectors
379 (package-with-python2 python-cryptography-vectors))
380
381(define-public python-cryptography
382 (package
383 (name "python-cryptography")
384 (version "2.2.2")
385 (source
386 (origin
387 (method url-fetch)
388 (uri (pypi-uri "cryptography" version))
389 (sha256
390 (base32
391 "0qrgip8vgcpk7v1jwf67mg50np5iprxrv8qrg8p382hkd6zrbhlz"))))
392 (build-system python-build-system)
393 (inputs
394 `(("openssl" ,openssl)))
395 (propagated-inputs
396 `(("python-asn1crypto" ,python-asn1crypto)
397 ("python-cffi" ,python-cffi)
398 ("python-six" ,python-six)
399 ("python-idna" ,python-idna)
400 ("python-iso8601" ,python-iso8601)))
401 (native-inputs
402 `(("python-cryptography-vectors" ,python-cryptography-vectors)
403 ("python-hypothesis" ,python-hypothesis)
404 ("python-pretend" ,python-pretend)
405 ("python-pytz" ,python-pytz)
406 ("python-pytest" ,python-pytest)))
407 (home-page "https://github.com/pyca/cryptography")
408 (synopsis "Cryptographic recipes and primitives for Python")
409 (description
410 "cryptography is a package which provides cryptographic recipes and
411primitives to Python developers. It aims to be the “cryptographic standard
412library” for Python. The package includes both high level recipes, and low
413level interfaces to common cryptographic algorithms such as symmetric ciphers,
414message digests and key derivation functions.")
415 ;; Distributed under either BSD-3 or ASL2.0
416 (license (list license:bsd-3 license:asl2.0))
417 (properties `((python2-variant . ,(delay python2-cryptography))))))
418
419(define-public python2-cryptography
420 (let ((crypto (package-with-python2
421 (strip-python2-variant python-cryptography))))
422 (package (inherit crypto)
423 (propagated-inputs
424 `(("python2-ipaddress" ,python2-ipaddress)
425 ("python2-backport-ssl-match-hostname"
426 ,python2-backport-ssl-match-hostname)
427 ("python2-enum34" ,python2-enum34)
428 ,@(package-propagated-inputs crypto))))))
429
430(define-public python-pyopenssl
431 (package
432 (name "python-pyopenssl")
433 (version "18.0.0")
434 (source
435 (origin
436 (method url-fetch)
437 (uri (pypi-uri "pyOpenSSL" version))
438 (sha256
439 (base32
440 "1055rb456nvrjcij3sqj6c6l3kmh5cqqay0nsmx3pxq07d1g3234"))))
441 (build-system python-build-system)
442 (arguments
443 '(#:phases
444 (modify-phases %standard-phases
445 (delete 'check)
446 (add-after 'install 'check
447 (lambda* (#:key inputs outputs #:allow-other-keys)
448 (add-installed-pythonpath inputs outputs)
449 (zero? (system* "py.test" "-v" "-k"
450 (string-append
451 ;; This test tries to look up certificates from
452 ;; the compiled-in default path in OpenSSL, which
453 ;; does not exist in the build environment.
454 "not test_fallback_default_verify_paths "
455 ;; This test attempts to make a connection to
456 ;; an external web service.
457 "and not test_set_default_verify_paths"))))))))
458 (propagated-inputs
459 `(("python-cryptography" ,python-cryptography)
460 ("python-six" ,python-six)))
461 (inputs
462 `(("openssl" ,openssl)))
463 (native-inputs
464 `(("python-flaky" ,python-flaky)
465 ("python-pretend" ,python-pretend)
466 ("python-pytest" ,python-pytest)))
467 (home-page "https://github.com/pyca/pyopenssl")
468 (synopsis "Python wrapper module around the OpenSSL library")
469 (description
470 "PyOpenSSL is a high-level wrapper around a subset of the OpenSSL
471library.")
472 (license license:asl2.0)))
473
474(define-public python2-pyopenssl
475 (package-with-python2 python-pyopenssl))
476
477(define-public python-ed25519
478 (package
479 (name "python-ed25519")
480 (version "1.4")
481 (source
482 (origin
483 (method url-fetch)
484 (uri (pypi-uri "ed25519" version))
485 (sha256
486 (base32
487 "0ahx1nkxa0xis3cw0h5c4fpgv8mq4znkq7kajly33lc3317bk499"))))
488 (build-system python-build-system)
489 (home-page "https://github.com/warner/python-ed25519")
490 (synopsis "Ed25519 public-key signatures")
491 (description "Ed25519 public-key signatures")
492 (license license:expat)))
493
494(define-public python2-ed25519
495 (package-with-python2 python-ed25519))
496
497(define-public python-axolotl-curve25519
498 (package
499 (name "python-axolotl-curve25519")
500 (version "0.1")
501 (source
502 (origin
503 (method git-fetch)
504 (uri (git-reference
505 (url "https://github.com/tgalal/python-axolotl-curve25519")
506 (commit "e4a9c4de0eae27223200579c58d1f8f6d20637e2")))
507 (file-name (string-append name "-" version "-checkout"))
508 (sha256
509 (base32
510 "0agap5q0hmvf6cwzjqc05kw53pjgf6942pcivpazksmg1vk400ra"))))
511 (build-system python-build-system)
512 (arguments
513 `(;; Prevent creation of the egg. This works around
514 ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20765
515 #:configure-flags '("--root=/")))
516 (home-page "https://github.com/tgalal/python-axolotl-curve25519")
517 (synopsis "Python wrapper for curve25519 library")
518 (description "This is a python wrapper for the curve25519 library
519with ed25519 signatures. The C code was pulled from
520libaxolotl-android. At the moment this wrapper is meant for use by
521python-axolotl.")
522 (license (list license:gpl3 ; Most files
523 license:bsd-3)))) ; curve/curve25519-donna.c
524
525(define-public python2-axolotl-curve25519
526 (package-with-python2 python-axolotl-curve25519))
527
528(define-public python-axolotl
529 (package
530 (name "python-axolotl")
531 (version "0.1.39")
532 (source
533 (origin
534 (method url-fetch)
535 (uri (string-append
536 "https://github.com/tgalal/python-axolotl/archive/"
537 version ".tar.gz"))
538 (file-name (string-append name "-" version ".tar.gz"))
539 (patches (search-patches "python-axolotl-AES-fix.patch"))
540 (sha256
541 (base32 "0badsgkgz0ir3hqynxzsfjgacppi874syvvmgccc6j164053x6zm"))))
542 (build-system python-build-system)
543 (arguments
544 `(#:phases
545 (modify-phases %standard-phases
546 ;; Don't install tests
547 (add-before 'install 'remove-tests
548 (lambda _
549 (for-each delete-file-recursively
550 '("axolotl/tests" "build/lib/axolotl/tests"))
551 #t)))))
552 (propagated-inputs
553 `(("python-axolotl-curve25519" ,python-axolotl-curve25519)
554 ("python-dateutil" ,python-dateutil)
555 ("python-protobuf" ,python-protobuf)
556 ("python-pycrypto" ,python-pycrypto)))
557 (home-page "https://github.com/tgalal/python-axolotl")
558 (synopsis "Python port of libaxolotl-android")
559 (description "This is a python port of libaxolotl-android. This
560is a ratcheting forward secrecy protocol that works in synchronous and
561asynchronous messaging environments.")
562 (license license:gpl3)))
563
564(define-public python2-axolotl
565 (package-with-python2 python-axolotl))
566
567;; SlowAES isn't compatible with Python 3.
568(define-public python2-slowaes
569 (package
570 (name "python2-slowaes")
571 (version "0.1a1")
572 (source
573 (origin
574 (method url-fetch)
575 (uri (pypi-uri "slowaes" version))
576 (sha256
577 (base32
578 "02dzajm83a7lqgxf6r3hgj64wfmcxz8gs4nvgxpvj5n19kjqlrc3"))))
579 (build-system python-build-system)
580 (arguments `(#:python ,python-2))
581 (home-page "http://code.google.com/p/slowaes/")
582 (synopsis "Implementation of AES in Python")
583 (description "This package contains an implementation of AES in Python.
584This implementation is slow (hence the project name) but still useful when
585faster ones are not available.")
586 (license license:asl2.0)))
587
588(define-public python-pyaes
589 (package
590 (name "python-pyaes")
591 (version "1.6.1")
592 (source
593 (origin
594 (method url-fetch)
595 (uri (pypi-uri "pyaes" version))
596 (sha256
597 (base32
598 "13vdaff15k0jyfcss4b4xvfgm8xyv0nrbyw5n1qc7lrqbi0b3h82"))))
599 (build-system python-build-system)
600 (home-page "https://github.com/ricmoo/pyaes")
601 (synopsis "Implementation of AES in Python")
602 (description "This package contains a pure-Python implementation of the
603AES block cipher algorithm and the common modes of operation (CBC, CFB, CTR,
604ECB and OFB).")
605 (license license:expat)))
606
607(define-public python2-pyaes
608 (package-with-python2 python-pyaes))
609
610(define-public python-asn1crypto
611 (package
612 (name "python-asn1crypto")
613 (version "0.22.0")
614 (source
615 (origin
616 (method url-fetch)
617 (uri (string-append "https://github.com/wbond/asn1crypto/archive/"
618 version ".tar.gz"))
619 (file-name (string-append name "-" version ".tar.gz"))
620 (sha256
621 (base32
622 "1kn910896l3knmilla1c9ly20q181s43w1ah08lzkbm1h3j6pcz0"))))
623 (build-system python-build-system)
624 (home-page "https://github.com/wbond/asn1crypto")
625 (synopsis "ASN.1 parser and serializer in Python")
626 (description "asn1crypto is an ASN.1 parser and serializer with definitions
627for private keys, public keys, certificates, CRL, OCSP, CMS, PKCS#3, PKCS#7,
628PKCS#8, PKCS#12, PKCS#5, X.509 and TSP.")
629 (license license:expat)))
630
631(define-public python2-asn1crypto
632 (package-with-python2 python-asn1crypto))
633
634(define-public python-pynacl
635 (package
636 (name "python-pynacl")
637 (version "1.2.1")
638 (source
639 (origin
640 (method url-fetch)
641 (uri (pypi-uri "PyNaCl" version))
642 (modules '((guix build utils)))
643 ;; Remove bundled libsodium.
644 (snippet '(begin (delete-file-recursively "src/libsodium")
645 #t))
646 (sha256
647 (base32
648 "1ada3qr83cliap6dk897vnvjkynij1kjqbwizdbgarazlyh8zlz0"))))
649 (build-system python-build-system)
650 (arguments
651 `(#:phases
652 (modify-phases %standard-phases
653 (add-before 'build 'use-system-sodium
654 (lambda _
655 (setenv "SODIUM_INSTALL" "system")
656 #t)))))
657 (native-inputs
658 `(("python-hypothesis" ,python-hypothesis)
659 ("python-pytest" ,python-pytest)))
660 (propagated-inputs
661 `(("python-cffi" ,python-cffi)
662 ("python-six" ,python-six)
663 ("libsodium" ,libsodium)))
664 (home-page "https://github.com/pyca/pynacl/")
665 (synopsis "Python bindings to libsodium")
666 (description
667 "PyNaCl is a Python binding to libsodium, which is a fork of the
668Networking and Cryptography library. These libraries have a stated goal
669of improving usability, security and speed.")
670 (license license:asl2.0)))
671
672(define-public python2-pynacl
673 (package-with-python2 python-pynacl))
674
675(define-public python2-pgpdump
676 (package
677 (name "python2-pgpdump")
678 (version "1.5")
679 (source
680 (origin
681 (method url-fetch)
682 (uri (pypi-uri "pgpdump" version))
683 (sha256
684 (base32
685 "0s4nh8h7qsdj2yf29bspjs1zvxd4lcd11r6g11dp7fppgf2h0iqw"))))
686 (build-system python-build-system)
687
688 ;; Currently fails to build with Python 3.
689 (arguments `(#:python ,python-2))
690
691 (home-page "https://github.com/toofishes/python-pgpdump")
692 (synopsis "Python library for parsing PGP packets")
693 (description
694 "Python-pgpdump is an OpenPGP packet parser based on
695@uref{http://www.mew.org/~kazu/proj/pgpdump/, pgpdump}. It notably supports:
696
697@itemize
698@item signature packets;
699@item public key packets;
700@item secret key packets;
701@item trust, user ID, and user attribute packets;
702@item ASCII-armor decoding and CRC check.
703@end itemize\n")
704 (license license:bsd-3)))
705
706(define-public python2-roca-detect
707 (package
708 (name "python2-roca-detect")
709 (version "1.0.8")
710 (source
711 (origin
712 (method url-fetch)
713 (uri (pypi-uri "roca-detect" version))
714 (sha256
715 (base32
716 "1di4akyw2lf5r8zfwvyhkilz8jv8g4b66rgaqwfabmjwma6gnw27"))))
717 (build-system python-build-system)
718 (native-inputs
719 ;; TODO: apk_parse_ph4, pyjks
720 `(("python2-dateutil" ,python2-dateutil)
721 ("python2-six" ,python2-six)
722 ("python2-cryptography" ,python2-cryptography)
723 ("python2-future" ,python2-future)
724 ("python2-coloredlogs" ,python2-coloredlogs)
725 ("python2-pgpdump" ,python2-pgpdump)))
726 (arguments
727 `(;; Basic testing routine is quite simple and works with Py3
728 ;; but the rest of the code that processes the different
729 ;; key formats and extracts the modulus for inspection is
730 ;; not yet fully py3 ready.
731 #:python ,python-2))
732 (home-page "https://github.com/crocs-muni/roca")
733 (synopsis "ROCA detection tool")
734 (description
735 "This tool is related to the paper entitled @i{Return of the
736Coppersmith’s Attack: Practical Factorization of Widely Used RSA Moduli}. It
737enables you to test public RSA keys for a presence of the described
738vulnerability. Currently the tool supports the following key formats: X.509
739Certificate (DER encoded, PEM encoded), RSA PEM (encoded private key, public
740key), SSH public key, ASC-encoded OpenPGP key, APK Android application, LDIFF
741file, and more.")
742 (license license:gpl3)))
743
744(define-public python-ecpy
745 (package
746 (name "python-ecpy")
747 (version "0.8.2")
748 (source
749 (origin
750 (method url-fetch)
751 (uri (pypi-uri "ECPy" version))
752 (sha256
753 (base32
754 "090fqnj8z0xm44jrfpll7j45r68m6kp7mjr7yxzg93j42h3sj285"))))
755 (build-system python-build-system)
756 (propagated-inputs
757 `(("python-future" ,python-future)))
758 (home-page "https://github.com/ubinity/ECPy")
759 (synopsis "Pure Python Elliptic Curve Library")
760 (description "This package provides a Elliptic Curve Library in pure
761Python.")
762 (license license:asl2.0)))
763
764(define-public python2-ecpy
765 (package-with-python2 python-ecpy))
766
767(define-public python-josepy
768 (package
769 (name "python-josepy")
770 (version "1.1.0")
771 (source (origin
772 (method url-fetch)
773 (uri (pypi-uri "josepy" version))
774 (sha256
775 (base32
776 "11khz8malzrv375b27jjkv66z6z6khdx1v5mkkr4vq16gp3n4p7v"))))
777 (build-system python-build-system)
778 (arguments
779 ;; The tests require flake8 >= 3.5, which is not yet packaged.
780 '(#:tests? #f))
781 (propagated-inputs
782 `(("python-cryptography" ,python-cryptography)
783 ("python-pyopenssl" ,python-pyopenssl)
784 ("python-six" ,python-six)))
785;; TODO Enable when we have flake8 >= 3.5.
786; (native-inputs
787; `(("python-coverage" ,python-coverage)
788; ("python-flake8" ,python-flake8)
789; ("python-isort" ,python-isort)
790; ("python-mock" ,python-mock)
791; ("python-pytest" ,python-pytest)
792; ("python-pytest-cov" ,python-pytest-cov)
793; ("python-pytest-cache" ,python-pytest-cache)
794; ("python-pytest-flake8" ,python-pytest-flake8)))
795 (home-page "https://github.com/certbot/josepy")
796 (synopsis "JOSE protocol implementation in Python")
797 (description "This package provides a Python implementation of the JOSE
798protocol (Javascript Object Signing and Encryption).")
799 (license license:asl2.0)))
800
801(define-public python2-josepy
802 (package-with-python2 python-josepy))
803
804(define-public python-pycryptodome
805 (package
806 (name "python-pycryptodome")
807 (version "3.5.1")
808 (source
809 (origin
810 (method url-fetch)
811 (uri (pypi-uri "pycryptodome" version))
812 (sha256
813 (base32
814 "15mc1h5ij1b6hcqvb048kb4k0ip64n2ky0zz0rml2s78ylv7g5dp"))))
815 (build-system python-build-system)
816 (home-page "https://www.pycryptodome.org")
817 (synopsis "Cryptographic library for Python")
818 (description "This package provides a cryptographic library for Python.
819
820It brings the following enhancements with respect to the last official version
821of PyCrypto:
822
823@itemize
824@item Authenticated encryption modes (GCM, CCM, EAX, SIV, OCB)
825@item Accelerated AES on Intel platforms via AES-NI
826@item First class support for PyPy
827@item Elliptic curves cryptography (NIST P-256 curve only)
828@item Better and more compact API (nonce and iv attributes for ciphers,
829automatic generation of random nonces and IVs, simplified CTR cipher mode, and
830more)
831@item SHA-3 (including SHAKE XOFs) and BLAKE2 hash algorithms
832@item Salsa20 and ChaCha20 stream ciphers
833@item scrypt and HKDF
834@item Deterministic (EC)DSA
835@item Password-protected PKCS#8 key containers
836@item Shamir’s Secret Sharing scheme
837@item Random numbers get sourced directly from the OS (and not from a CSPRNG
838in userspace)
839@item Cleaner RSA and DSA key generation (largely based on FIPS 186-4)
840@item Major clean ups and simplification of the code base
841@end itemize\n")
842 (license license:bsd-2)))
843
844(define-public python2-pycryptodome
845 (package-with-python2 python-pycryptodome))
846
847(define-public python-m2crypto
848 (package
849 (name "python-m2crypto")
850 (version "0.29.0")
851 (source
852 (origin
853 (method url-fetch)
854 (uri (pypi-uri "M2Crypto" version))
855 (sha256
856 (base32 "1h16gpilrnlzc0iyj1mnd1iqh8wchzjsxjqw9n344glimg2s5zm0"))))
857 (build-system python-build-system)
858 (inputs `(("openssl" ,openssl)))
859 (propagated-inputs `(("python-typing" ,python-typing)))
860 (home-page "https://gitlab.com/m2crypto/m2crypto")
861 (synopsis "Python crypto and TLS toolkit")
862 (description "@code{M2Crypto} is a complete Python wrapper for OpenSSL
863featuring RSA, DSA, DH, EC, HMACs, message digests, symmetric ciphers
864(including AES); TLS functionality to implement clients and servers; HTTPS
865extensions to Python's httplib, urllib, and xmlrpclib; unforgeable HMAC'ing
866AuthCookies for web session management; FTP/TLS client and server; S/MIME;
867M2Crypto can also be used to provide TLS for Twisted. Smartcards supported
868through the Engine interface.")
869 (license license:expat)))
870
871(define-public python2-m2crypto
872 (package-with-python2 python-m2crypto))
873
874(define-public python-pylibscrypt
875 (package
876 (name "python-pylibscrypt")
877 (version "1.7.1")
878 (source
879 (origin
880 (method url-fetch)
881 (uri (pypi-uri "pylibscrypt" version))
882 (sha256
883 (base32
884 "1b3rgzl6dbzs08vhv41b6y4n5189wv7lr27acxn104hs45745abs"))))
885 (build-system python-build-system)
886 (arguments
887 `(#:phases
888 (modify-phases %standard-phases
889 (add-before 'build 'hard-code-path-to-libscrypt
890 (lambda* (#:key inputs #:allow-other-keys)
891 (let ((libscrypt (assoc-ref inputs "libscrypt")))
892 (substitute* "pylibscrypt/pylibscrypt.py"
893 (("find_library\\('scrypt'\\)")
894 (string-append "'" libscrypt "/lib/libscrypt.so'")))
895 #t))))
896 ;; The library can use various scrypt implementations and tests all of
897 ;; them. Since we only provide a single implementation, most tests
898 ;; fail. Simply skip them.
899 #:tests? #f))
900 ;; FIXME: Using "libscrypt" is the second best choice. The best one
901 ;; requires "hashlib.scrypt", provided by Python 3.6+ built with OpenSSL
902 ;; 1.1+. Use that as soon as Guix provides it.
903 (inputs
904 `(("libscrypt" ,libscrypt)))
905 (home-page "https://github.com/jvarho/pylibscrypt")
906 (synopsis "Scrypt for Python")
907 (description "There are a lot of different scrypt modules for Python, but
908none of them have everything that I'd like, so here's one more. It uses
909@code{libscrypt}.")
910 (license license:isc)))
911
912(define-public python-libnacl
913 (package
914 (name "python-libnacl")
915 (version "1.6.1")
916 (source
917 (origin
918 (method url-fetch)
919 (uri (pypi-uri "libnacl" version))
920 (sha256
921 (base32
922 "0nv7n8nfswkhl614x5mllrkvaslraa0053q11iylb337cy43vb4v"))))
923 (build-system python-build-system)
924 (arguments
925 `(#:phases
926 (modify-phases %standard-phases
927 (add-after 'unpack 'locate-libsodium
928 (lambda* (#:key inputs #:allow-other-keys)
929 (substitute* "libnacl/__init__.py"
930 (("(return ctypes.cdll.LoadLibrary\\(')libsodium.so('\\))"
931 _ pre post)
932 (let ((libsodium (string-append (assoc-ref inputs "libsodium")
933 "/lib/libsodium.so")))
934 (string-append pre libsodium post)))))))))
935 (native-inputs
936 `(("python-pyhamcrest" ,python-pyhamcrest)))
937 (inputs
938 `(("libsodium" ,libsodium)))
939 (home-page "https://libnacl.readthedocs.org/")
940 (synopsis "Python bindings for libsodium based on ctypes")
941 (description "@code{libnacl} is used to gain direct access to the
942functions exposed by @code{NaCl} library via @code{libsodium}. It has
943been constructed to maintain extensive documentation on how to use
944@code{NaCl} as well as being completely portable.")
945 (license license:asl2.0)))
946
947(define-public python-scrypt
948 (package
949 (name "python-scrypt")
950 (version "0.8.6")
951 (source
952 (origin
953 (method url-fetch)
954 (uri (pypi-uri "scrypt" version))
955 (sha256
956 (base32
957 "0b9nw10hfdl0jflm3b62q485ssc3f3f33lpg4yy407gs8wnrn8zq"))))
958 (build-system python-build-system)
959 (inputs
960 `(("openssl" ,openssl)))
961 (home-page "http://bitbucket.org/mhallin/py-scrypt")
962 (synopsis "Bindings for the scrypt key derivation function library")
963 (description "This is a set of Python bindings for the scrypt key
964derivation function.")
965 (license license:bsd-2)))