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