blob: 9c9ad4a072debadb208d211d426ea229ead123ab [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 Gaynor1bcad7b2014-04-02 14:46:56 -07005primitives. Our goal is for it to be your "cryptographic standard library". If
6you are interested in learning more about the field of cryptography, we
7recommend `Crypto 101, by Laurens Van Houtven`_.
Alex Gaynor31df5352013-12-12 18:03:26 -08008
skeuomorfb0293bf2014-01-29 21:41:02 +02009Installation
10------------
11You can install ``cryptography`` with ``pip``:
12
13.. code-block:: console
14
15 $ pip install cryptography
16
Paul Kehrerf3b57e32014-01-29 14:45:10 -060017See :doc:`Installation <installation>` for more information.
skeuomorfb0293bf2014-01-29 21:41:02 +020018
Alex Gaynor9f3468d2013-08-11 08:17:48 -040019Why a new crypto library for Python?
20------------------------------------
21
Alex Gaynor31df5352013-12-12 18:03:26 -080022If you've done cryptographic work in Python before, you've probably seen some
23other libraries in Python, such as *M2Crypto*, *PyCrypto*, or *PyOpenSSL*. In
24building ``cryptography`` we wanted to address a few issues we observed in the
25existing libraries:
Alex Gaynor9f3468d2013-08-11 08:17:48 -040026
Alex Gaynord8d91d42013-08-12 09:33:18 -040027* Lack of PyPy and Python 3 support.
Alex Gaynord6bef562013-08-11 09:09:28 -040028* Lack of maintenance.
Alex Gaynorec4ba732013-08-11 08:19:05 -040029* Use of poor implementations of algorithms (i.e. ones with known side-channel
Alex Gaynord6bef562013-08-11 09:09:28 -040030 attacks).
31* Lack of high level, "Cryptography for humans", APIs.
Alex Gaynor7ba13922014-02-03 15:00:48 -080032* Absence of algorithms such as
33 :class:`AES-GCM <cryptography.hazmat.primitives.ciphers.modes.GCM>` and
34 :class:`~cryptography.hazmat.primitives.kdf.hkdf.HKDF`.
Alex Gaynord6bef562013-08-11 09:09:28 -040035* Poor introspectability, and thus poor testability.
Alex Gaynorf0d139a2013-08-11 09:13:27 -040036* Extremely error prone APIs, and bad defaults.
Alex Gaynor9f3468d2013-08-11 08:17:48 -040037
Alex Gaynor59a6bc62014-02-18 18:13:48 -080038
39.. _cryptography-layout:
40
Alex Gaynor7c067462013-12-16 10:11:00 -080041Layout
42------
Alex Gaynor9f3468d2013-08-11 08:17:48 -040043
Alex Gaynor7c067462013-12-16 10:11:00 -080044``cryptography`` is broadly divided into two levels. One with safe
45cryptographic recipes, "cryptography for humans" if you will. These are safe
46and easy to use and don't require developers to make many decisions.
47
48The other level is low-level cryptographic primitives. These are often
49dangerous and can be used incorrectly. They require making decisions and having
50an in-depth knowledge of the cryptographic concepts at work. Because of the
Alex Gaynordf8bfea2013-12-16 10:17:48 -080051potential danger in working at this level, this is referred to as the
Alex Gaynor77762bc2014-01-01 07:53:48 -080052"hazardous materials" or "hazmat" layer. These live in the
Alex Gaynord8614a22014-01-01 08:22:40 -080053``cryptography.hazmat`` package, and their documentation will always contain an
Alex Gaynor77762bc2014-01-01 07:53:48 -080054admonition at the top.
Alex Gaynor7c067462013-12-16 10:11:00 -080055
56We recommend using the recipes layer whenever possible, and falling back to the
57hazmat layer only when necessary.
58
Alex Gaynorc62e91f2013-08-06 19:25:52 -070059.. toctree::
Alex Gaynor1abfac72013-08-07 12:59:04 -070060 :maxdepth: 2
anarcatfd2b27a2017-03-20 18:03:12 -040061 :caption: The recipes layer
Alex Gaynor1abfac72013-08-07 12:59:04 -070062
Alex Gaynor333fb102013-10-31 10:27:35 -070063 fernet
Alex Gaynor4af5b372015-07-12 10:30:59 -050064 x509/index
Alex Gaynor2a70f912014-02-06 09:47:07 -080065 random-numbers
Alex Gaynorf1a3fc02013-11-02 14:03:34 -070066 exceptions
Alex Gaynorde06b292014-02-18 16:40:09 -080067 faq
Alex Gaynor8c9dcb32013-11-03 13:10:57 -080068 glossary
Donald Stufftf04317a2013-10-27 16:44:30 -040069
Donald Stufftf04317a2013-10-27 16:44:30 -040070.. toctree::
71 :maxdepth: 2
anarcatfd2b27a2017-03-20 18:03:12 -040072 :caption: The hazardous materials layer
Donald Stufftf04317a2013-10-27 16:44:30 -040073
74 hazmat/primitives/index
Alex Gaynorf8796b12013-12-13 20:28:55 -080075 hazmat/backends/index
Alex Stapletonc368ac22013-12-31 13:43:38 +000076 hazmat/bindings/index
Alex Gaynor7c067462013-12-16 10:11:00 -080077
Alex Gaynor7c067462013-12-16 10:11:00 -080078.. toctree::
79 :maxdepth: 2
anarcatfd2b27a2017-03-20 18:03:12 -040080 :caption: The cryptography open source project
Alex Gaynor7c067462013-12-16 10:11:00 -080081
skeuomorfb0293bf2014-01-29 21:41:02 +020082 installation
Paul Kehrer0839aa82014-02-11 22:36:51 -060083 development/index
Alex Gaynor7c067462013-12-16 10:11:00 -080084 security
Alex Stapleton68bba2d2014-03-22 23:03:15 +000085 limitations
Alex Gaynor1a9bbf22013-12-24 10:59:50 -080086 api-stability
Alex Gaynor89063f62014-01-06 15:52:38 -080087 doing-a-release
Alex Gaynor3f230402014-01-08 09:21:57 -080088 changelog
Alex Gaynor7c067462013-12-16 10:11:00 -080089 community
Alex Gaynora8fc6f32014-01-23 10:48:16 -060090
91
Alex Gaynor92ddd762014-03-03 19:39:40 -080092.. note::
93
94 ``cryptography`` has not been subjected to an external audit of its code or
95 documentation. If you're interested in discussing an audit please
Alex Gaynor0df8c972014-03-03 19:43:50 -080096 :doc:`get in touch </community>`.
Alex Gaynor92ddd762014-03-03 19:39:40 -080097
Alex Gaynor1bcad7b2014-04-02 14:46:56 -070098.. _`Crypto 101, by Laurens Van Houtven`: https://www.crypto101.io/