index.rst 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. Welcome to ``pyca/cryptography``
  2. ================================
  3. ``cryptography`` includes both high level recipes and low level interfaces to
  4. common cryptographic algorithms such as symmetric ciphers, message digests, and
  5. key derivation functions. For example, to encrypt something with
  6. ``cryptography``'s high level symmetric encryption recipe:
  7. .. code-block:: pycon
  8. >>> from cryptography.fernet import Fernet
  9. >>> # Put this somewhere safe!
  10. >>> key = Fernet.generate_key()
  11. >>> f = Fernet(key)
  12. >>> token = f.encrypt(b"A really secret message. Not for prying eyes.")
  13. >>> token
  14. '...'
  15. >>> f.decrypt(token)
  16. 'A really secret message. Not for prying eyes.'
  17. If you are interested in learning more about the field of cryptography, we
  18. recommend `Crypto 101, by Laurens Van Houtven`_ and `The Cryptopals Crypto
  19. Challenges`_.
  20. Installation
  21. ------------
  22. You can install ``cryptography`` with ``pip``:
  23. .. code-block:: console
  24. $ pip install cryptography
  25. See :doc:`Installation <installation>` for more information.
  26. .. _cryptography-layout:
  27. Layout
  28. ------
  29. ``cryptography`` is broadly divided into two levels. One with safe
  30. cryptographic recipes that require little to no configuration choices. These
  31. are safe and easy to use and don't require developers to make many decisions.
  32. The other level is low-level cryptographic primitives. These are often
  33. dangerous and can be used incorrectly. They require making decisions and having
  34. an in-depth knowledge of the cryptographic concepts at work. Because of the
  35. potential danger in working at this level, this is referred to as the
  36. "hazardous materials" or "hazmat" layer. These live in the
  37. ``cryptography.hazmat`` package, and their documentation will always contain an
  38. admonition at the top.
  39. We recommend using the recipes layer whenever possible, and falling back to the
  40. hazmat layer only when necessary.
  41. .. toctree::
  42. :maxdepth: 2
  43. :caption: The recipes layer
  44. fernet
  45. x509/index
  46. .. toctree::
  47. :maxdepth: 2
  48. :caption: The hazardous materials layer
  49. hazmat/primitives/index
  50. exceptions
  51. random-numbers
  52. hazmat/backends/index
  53. hazmat/bindings/index
  54. .. toctree::
  55. :maxdepth: 2
  56. :caption: The cryptography open source project
  57. installation
  58. changelog
  59. faq
  60. development/index
  61. security
  62. limitations
  63. api-stability
  64. doing-a-release
  65. community
  66. glossary
  67. .. note::
  68. ``cryptography`` has not been subjected to an external audit of its code or
  69. documentation. If you're interested in discussing an audit please
  70. :doc:`get in touch </community>`.
  71. .. _`Crypto 101, by Laurens Van Houtven`: https://www.crypto101.io/
  72. .. _`The Cryptopals Crypto Challenges`: https://cryptopals.com/