blob: b800bcaf16ff214bca81e9e8392f3d5f30d2fb42 [file] [log] [blame]
Alex Gaynor1abfac72013-08-07 12:59:04 -07001Welcome to ``cryptography``
2===========================
3
Alex Gaynor66ba6012013-10-28 10:11:21 -07004``cryptography`` is a Python library which exposes cryptographic recipes and
Alex Gaynor31df5352013-12-12 18:03:26 -08005primitives. We hope it'll be your one-stop-shop for all your cryptographic
6needs in Python.
7
8Installing
9----------
10
Alex Gaynor292902e2014-01-08 15:18:52 -080011You can install ``cryptography`` with ``pip``:
Alex Gaynor31df5352013-12-12 18:03:26 -080012
13.. code-block:: console
14
Alex Gaynor292902e2014-01-08 15:18:52 -080015 $ pip install cryptography
Alex Gaynorc62e91f2013-08-06 19:25:52 -070016
Alex Gaynora8fc6f32014-01-23 10:48:16 -060017.. note::
18
19 If you're on Windows you'll need to make sure you have OpenSSL installed.
Konstantinos Koukopoulos7010df92014-01-28 03:35:25 -080020 There are `pre-compiled binaries`_ available. If your installation is in
Konstantinos Koukopoulos8f369b72014-01-28 03:43:06 -080021 an unusual location set the ``LIB`` and ``INCLUDE`` environment variables
Konstantinos Koukopoulos5d9c6b22014-01-28 16:29:38 +020022 to include the corresponding locations. For example:
23
24 .. code-block:: console
25
26 C:\> \path\to\vcvarsall.bat x86_amd64
27 C:\> set LIB=C:\OpenSSL-1.0.1f-64bit\lib;%LIB%
28 C:\> set INCLUDE=C:\OpenSSL-1.0.1f-64bit\include;%INCLUDE%
29 C:\> pip install cryptography
Alex Gaynora8fc6f32014-01-23 10:48:16 -060030
31
Alex Gaynor9f3468d2013-08-11 08:17:48 -040032Why a new crypto library for Python?
33------------------------------------
34
Alex Gaynor31df5352013-12-12 18:03:26 -080035If you've done cryptographic work in Python before, you've probably seen some
36other libraries in Python, such as *M2Crypto*, *PyCrypto*, or *PyOpenSSL*. In
37building ``cryptography`` we wanted to address a few issues we observed in the
38existing libraries:
Alex Gaynor9f3468d2013-08-11 08:17:48 -040039
Alex Gaynord8d91d42013-08-12 09:33:18 -040040* Lack of PyPy and Python 3 support.
Alex Gaynord6bef562013-08-11 09:09:28 -040041* Lack of maintenance.
Alex Gaynorec4ba732013-08-11 08:19:05 -040042* Use of poor implementations of algorithms (i.e. ones with known side-channel
Alex Gaynord6bef562013-08-11 09:09:28 -040043 attacks).
44* Lack of high level, "Cryptography for humans", APIs.
45* Absence of algorithms such as AES-GCM.
46* Poor introspectability, and thus poor testability.
Alex Gaynorf0d139a2013-08-11 09:13:27 -040047* Extremely error prone APIs, and bad defaults.
Alex Gaynor9f3468d2013-08-11 08:17:48 -040048
Alex Gaynor7c067462013-12-16 10:11:00 -080049Layout
50------
Alex Gaynor9f3468d2013-08-11 08:17:48 -040051
Alex Gaynor7c067462013-12-16 10:11:00 -080052``cryptography`` is broadly divided into two levels. One with safe
53cryptographic recipes, "cryptography for humans" if you will. These are safe
54and easy to use and don't require developers to make many decisions.
55
56The other level is low-level cryptographic primitives. These are often
57dangerous and can be used incorrectly. They require making decisions and having
58an in-depth knowledge of the cryptographic concepts at work. Because of the
Alex Gaynordf8bfea2013-12-16 10:17:48 -080059potential danger in working at this level, this is referred to as the
Alex Gaynor77762bc2014-01-01 07:53:48 -080060"hazardous materials" or "hazmat" layer. These live in the
Alex Gaynord8614a22014-01-01 08:22:40 -080061``cryptography.hazmat`` package, and their documentation will always contain an
Alex Gaynor77762bc2014-01-01 07:53:48 -080062admonition at the top.
Alex Gaynor7c067462013-12-16 10:11:00 -080063
64We recommend using the recipes layer whenever possible, and falling back to the
65hazmat layer only when necessary.
66
67The recipes layer
68~~~~~~~~~~~~~~~~~
Alex Gaynorc62e91f2013-08-06 19:25:52 -070069
70.. toctree::
Alex Gaynor1abfac72013-08-07 12:59:04 -070071 :maxdepth: 2
72
Alex Gaynor333fb102013-10-31 10:27:35 -070073 fernet
Alex Gaynorf1a3fc02013-11-02 14:03:34 -070074 exceptions
Alex Gaynor8c9dcb32013-11-03 13:10:57 -080075 glossary
Donald Stufftf04317a2013-10-27 16:44:30 -040076
Alex Gaynor2cfbc122013-12-16 10:19:00 -080077The hazardous materials layer
78~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Donald Stufftf04317a2013-10-27 16:44:30 -040079
80.. toctree::
81 :maxdepth: 2
82
83 hazmat/primitives/index
Alex Gaynorf8796b12013-12-13 20:28:55 -080084 hazmat/backends/index
Alex Stapletonc368ac22013-12-31 13:43:38 +000085 hazmat/bindings/index
Alex Gaynor7c067462013-12-16 10:11:00 -080086
Alex Gaynor7c067462013-12-16 10:11:00 -080087The ``cryptography`` open source project
88~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89
90.. toctree::
91 :maxdepth: 2
92
93 contributing
94 security
Alex Gaynor1a9bbf22013-12-24 10:59:50 -080095 api-stability
Alex Gaynor89063f62014-01-06 15:52:38 -080096 doing-a-release
Alex Gaynor3f230402014-01-08 09:21:57 -080097 changelog
Alex Gaynor7c067462013-12-16 10:11:00 -080098 community
Alex Gaynora8fc6f32014-01-23 10:48:16 -060099
100
Alex Gaynore7651de2014-01-23 11:34:35 -0600101.. _`pre-compiled binaries`: https://www.openssl.org/related/binaries.html