1{ stdenv
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, openssl
6, cryptography_vectors
7, darwin
8, packaging
9, six
10, pythonOlder
11, enum34
12, ipaddress
13, isPyPy
14, cffi
15, pytest
16, pretend
17, iso8601
18, pytz
19, hypothesis
20}:
21
22buildPythonPackage rec {
23 pname = "cryptography";
24 version = "2.8"; # Also update the hash in vectors.nix
25
26 src = fetchPypi {
27 inherit pname version;
28 sha256 = "0l8nhw14npknncxdnp7n4hpmjyscly6g7fbivyxkjwvlv071zniw";
29 };
30
31 outputs = [ "out" "dev" ];
32
33 buildInputs = [ openssl ]
34 ++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
35 propagatedBuildInputs = [
36 packaging
37 six
38 ] ++ stdenv.lib.optional (pythonOlder "3.4") enum34
39 ++ stdenv.lib.optional (pythonOlder "3.3") ipaddress
40 ++ stdenv.lib.optional (!isPyPy) cffi;
41
42 checkInputs = [
43 cryptography_vectors
44 hypothesis
45 iso8601
46 pretend
47 pytest
48 pytz
49 ];
50
51 # remove when https://github.com/pyca/cryptography/issues/4998 is fixed
52 checkPhase = ''
53 py.test --disable-pytest-warnings tests -k 'not load_ecdsa_no_named_curve'
54 '';
55
56 # IOKit's dependencies are inconsistent between OSX versions, so this is the best we
57 # can do until nix 1.11's release
58 __impureHostDeps = [ "/usr/lib" ];
59
60 meta = with stdenv.lib; {
61 description = "A package which provides cryptographic recipes and primitives";
62 longDescription = ''
63 Cryptography includes both high level recipes and low level interfaces to
64 common cryptographic algorithms such as symmetric ciphers, message
65 digests, and key derivation functions.
66 Our goal is for it to be your "cryptographic standard library". It
67 supports Python 2.7, Python 3.4+, and PyPy 5.3+.
68 '';
69 homepage = https://github.com/pyca/cryptography;
70 license = with licenses; [ asl20 bsd3 psfl ];
71 maintainers = with maintainers; [ primeos ];
72 };
73}