blob: 9a881ca7a0b819f0b76f9075231deb899dd067a9 [file] [log] [blame]
Paul Kehrer1adb9aa2017-05-23 23:39:07 -07001Welcome to ``pyca/cryptography``
2================================
Alex Gaynor1abfac72013-08-07 12:59:04 -07003
Paul Kehrer9bab8bd2017-05-24 18:15:37 -07004``cryptography`` includes both high level recipes and low level interfaces to
5common cryptographic algorithms such as symmetric ciphers, message digests, and
Paul Kehrer51ef0eb2017-05-23 16:50:59 -07006key derivation functions. For example, to encrypt something with
7``cryptography``'s high level symmetric encryption recipe:
8
9.. code-block:: pycon
10
11 >>> from cryptography.fernet import Fernet
12 >>> # Put this somewhere safe!
13 >>> key = Fernet.generate_key()
14 >>> f = Fernet(key)
15 >>> token = f.encrypt(b"A really secret message. Not for prying eyes.")
16 >>> token
17 '...'
18 >>> f.decrypt(token)
19 'A really secret message. Not for prying eyes.'
20
21If you are interested in learning more about the field of cryptography, we
Alex Gaynor1bcad7b2014-04-02 14:46:56 -070022recommend `Crypto 101, by Laurens Van Houtven`_.
Alex Gaynor31df5352013-12-12 18:03:26 -080023
skeuomorfb0293bf2014-01-29 21:41:02 +020024Installation
25------------
26You can install ``cryptography`` with ``pip``:
27
28.. code-block:: console
29
30 $ pip install cryptography
31
Paul Kehrerf3b57e32014-01-29 14:45:10 -060032See :doc:`Installation <installation>` for more information.
skeuomorfb0293bf2014-01-29 21:41:02 +020033
Alex Gaynor59a6bc62014-02-18 18:13:48 -080034.. _cryptography-layout:
35
Paul Kehrer51ef0eb2017-05-23 16:50:59 -070036
Alex Gaynor7c067462013-12-16 10:11:00 -080037Layout
38------
Alex Gaynor9f3468d2013-08-11 08:17:48 -040039
Alex Gaynor7c067462013-12-16 10:11:00 -080040``cryptography`` is broadly divided into two levels. One with safe
41cryptographic recipes, "cryptography for humans" if you will. These are safe
42and easy to use and don't require developers to make many decisions.
43
44The other level is low-level cryptographic primitives. These are often
45dangerous and can be used incorrectly. They require making decisions and having
46an in-depth knowledge of the cryptographic concepts at work. Because of the
Alex Gaynordf8bfea2013-12-16 10:17:48 -080047potential danger in working at this level, this is referred to as the
Alex Gaynor77762bc2014-01-01 07:53:48 -080048"hazardous materials" or "hazmat" layer. These live in the
Alex Gaynord8614a22014-01-01 08:22:40 -080049``cryptography.hazmat`` package, and their documentation will always contain an
Alex Gaynor77762bc2014-01-01 07:53:48 -080050admonition at the top.
Alex Gaynor7c067462013-12-16 10:11:00 -080051
52We recommend using the recipes layer whenever possible, and falling back to the
53hazmat layer only when necessary.
54
Alex Gaynorc62e91f2013-08-06 19:25:52 -070055.. toctree::
Alex Gaynor1abfac72013-08-07 12:59:04 -070056 :maxdepth: 2
anarcatfd2b27a2017-03-20 18:03:12 -040057 :caption: The recipes layer
Alex Gaynor1abfac72013-08-07 12:59:04 -070058
Alex Gaynor333fb102013-10-31 10:27:35 -070059 fernet
Alex Gaynor4af5b372015-07-12 10:30:59 -050060 x509/index
Donald Stufftf04317a2013-10-27 16:44:30 -040061
Donald Stufftf04317a2013-10-27 16:44:30 -040062.. toctree::
63 :maxdepth: 2
anarcatfd2b27a2017-03-20 18:03:12 -040064 :caption: The hazardous materials layer
Donald Stufftf04317a2013-10-27 16:44:30 -040065
66 hazmat/primitives/index
Paul Kehrere10d0d62017-05-29 08:49:47 -050067 exceptions
68 random-numbers
Alex Gaynorf8796b12013-12-13 20:28:55 -080069 hazmat/backends/index
Alex Stapletonc368ac22013-12-31 13:43:38 +000070 hazmat/bindings/index
Alex Gaynor7c067462013-12-16 10:11:00 -080071
Alex Gaynor7c067462013-12-16 10:11:00 -080072.. toctree::
73 :maxdepth: 2
anarcatfd2b27a2017-03-20 18:03:12 -040074 :caption: The cryptography open source project
Alex Gaynor7c067462013-12-16 10:11:00 -080075
skeuomorfb0293bf2014-01-29 21:41:02 +020076 installation
Paul Kehrere10d0d62017-05-29 08:49:47 -050077 changelog
78 faq
Paul Kehrer0839aa82014-02-11 22:36:51 -060079 development/index
Alex Gaynor7c067462013-12-16 10:11:00 -080080 security
Alex Stapleton68bba2d2014-03-22 23:03:15 +000081 limitations
Alex Gaynor1a9bbf22013-12-24 10:59:50 -080082 api-stability
Alex Gaynor89063f62014-01-06 15:52:38 -080083 doing-a-release
Alex Gaynor7c067462013-12-16 10:11:00 -080084 community
Paul Kehrere10d0d62017-05-29 08:49:47 -050085 glossary
Alex Gaynora8fc6f32014-01-23 10:48:16 -060086
87
Alex Gaynor92ddd762014-03-03 19:39:40 -080088.. note::
89
90 ``cryptography`` has not been subjected to an external audit of its code or
91 documentation. If you're interested in discussing an audit please
Alex Gaynor0df8c972014-03-03 19:43:50 -080092 :doc:`get in touch </community>`.
Alex Gaynor92ddd762014-03-03 19:39:40 -080093
Alex Gaynor1bcad7b2014-04-02 14:46:56 -070094.. _`Crypto 101, by Laurens Van Houtven`: https://www.crypto101.io/