blob: ec3913f41d8c2b3010853e112d1f4d81e36ff53a [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
Lucia Lic6ba99d2021-11-08 22:06:11 +080022recommend `Crypto 101, by Laurens Van Houtven`_ and `The Cryptopals Crypto
23Challenges`_.
Alex Gaynor31df5352013-12-12 18:03:26 -080024
skeuomorfb0293bf2014-01-29 21:41:02 +020025Installation
26------------
27You can install ``cryptography`` with ``pip``:
28
29.. code-block:: console
30
31 $ pip install cryptography
32
Paul Kehrerf3b57e32014-01-29 14:45:10 -060033See :doc:`Installation <installation>` for more information.
skeuomorfb0293bf2014-01-29 21:41:02 +020034
Alex Gaynor59a6bc62014-02-18 18:13:48 -080035.. _cryptography-layout:
36
Paul Kehrer51ef0eb2017-05-23 16:50:59 -070037
Alex Gaynor7c067462013-12-16 10:11:00 -080038Layout
39------
Alex Gaynor9f3468d2013-08-11 08:17:48 -040040
Alex Gaynor7c067462013-12-16 10:11:00 -080041``cryptography`` is broadly divided into two levels. One with safe
Paul Kehrerece3af12017-05-29 23:03:10 -050042cryptographic recipes that require little to no configuration choices. These
43are safe and easy to use and don't require developers to make many decisions.
Alex Gaynor7c067462013-12-16 10:11:00 -080044
45The other level is low-level cryptographic primitives. These are often
46dangerous and can be used incorrectly. They require making decisions and having
47an in-depth knowledge of the cryptographic concepts at work. Because of the
Alex Gaynordf8bfea2013-12-16 10:17:48 -080048potential danger in working at this level, this is referred to as the
Alex Gaynor77762bc2014-01-01 07:53:48 -080049"hazardous materials" or "hazmat" layer. These live in the
Alex Gaynord8614a22014-01-01 08:22:40 -080050``cryptography.hazmat`` package, and their documentation will always contain an
Alex Gaynor77762bc2014-01-01 07:53:48 -080051admonition at the top.
Alex Gaynor7c067462013-12-16 10:11:00 -080052
53We recommend using the recipes layer whenever possible, and falling back to the
54hazmat layer only when necessary.
55
Alex Gaynorc62e91f2013-08-06 19:25:52 -070056.. toctree::
Alex Gaynor1abfac72013-08-07 12:59:04 -070057 :maxdepth: 2
anarcatfd2b27a2017-03-20 18:03:12 -040058 :caption: The recipes layer
Alex Gaynor1abfac72013-08-07 12:59:04 -070059
Alex Gaynor333fb102013-10-31 10:27:35 -070060 fernet
Alex Gaynor4af5b372015-07-12 10:30:59 -050061 x509/index
Donald Stufftf04317a2013-10-27 16:44:30 -040062
Donald Stufftf04317a2013-10-27 16:44:30 -040063.. toctree::
64 :maxdepth: 2
anarcatfd2b27a2017-03-20 18:03:12 -040065 :caption: The hazardous materials layer
Donald Stufftf04317a2013-10-27 16:44:30 -040066
67 hazmat/primitives/index
Paul Kehrere10d0d62017-05-29 08:49:47 -050068 exceptions
69 random-numbers
Alex Gaynorf8796b12013-12-13 20:28:55 -080070 hazmat/backends/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/
Lucia Lic6ba99d2021-11-08 22:06:11 +080095.. _`The Cryptopals Crypto Challenges`: https://cryptopals.com/