INSTALL.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. Installation
  2. ------------
  3. The installation procedure depends on the package you want the library to be in.
  4. PyCryptodome can be used as:
  5. #. **an almost drop-in replacement for the old PyCrypto library**.
  6. You install it with::
  7. pip install pycryptodome
  8. In this case, all modules are installed under the ``Crypto`` package.
  9. You can test everything is right with::
  10. python -m Crypto.SelfTest
  11. One must avoid having both PyCrypto and PyCryptodome installed
  12. at the same time, as they will interfere with each other.
  13. This option is therefore recommended only when you are sure that
  14. the whole application is deployed in a ``virtualenv``.
  15. #. **a library independent of the old PyCrypto**.
  16. You install it with::
  17. pip install pycryptodomex
  18. You can test everything is right with::
  19. python -m Cryptodome.SelfTest
  20. In this case, all modules are installed under the ``Cryptodome`` package.
  21. PyCrypto and PyCryptodome can coexist.
  22. The procedures below go a bit more in detail, by explaining
  23. how to setup the environment for compiling the C extensions
  24. for each OS, and how to install the GMP library.
  25. Compiling in Linux Ubuntu
  26. ~~~~~~~~~~~~~~~~~~~~~~~~~
  27. .. note::
  28. If you want to install under the ``Crypto`` package, replace
  29. below ``pycryptodomex`` with ``pycryptodome``.
  30. For Python 2.x::
  31. $ sudo apt-get install build-essential python-dev
  32. $ pip install pycryptodomex
  33. $ python -m Cryptodome.SelfTest
  34. For Python 3.x::
  35. $ sudo apt-get install build-essential python3-dev
  36. $ pip install pycryptodomex
  37. $ python3 -m Cryptodome.SelfTest
  38. For PyPy::
  39. $ sudo apt-get install build-essential pypy-dev
  40. $ pip install pycryptodomex
  41. $ pypy -m Cryptodome.SelfTest
  42. Compiling in Linux Fedora
  43. ~~~~~~~~~~~~~~~~~~~~~~~~~
  44. .. note::
  45. If you want to install under the ``Crypto`` package, replace
  46. below ``pycryptodomex`` with ``pycryptodome``.
  47. For Python 2.x::
  48. $ sudo yum install gcc gmp python-devel
  49. $ pip install pycryptodomex
  50. $ python -m Cryptodome.SelfTest
  51. For Python 3.x::
  52. $ sudo yum install gcc gmp python3-devel
  53. $ pip install pycryptodomex
  54. $ python3 -m Cryptodome.SelfTest
  55. For PyPy::
  56. $ sudo yum install gcc gmp pypy-devel
  57. $ pip install pycryptodomex
  58. $ pypy -m Cryptodome.SelfTest
  59. Windows (from sources, Python 2.x, Python <=3.2)
  60. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  61. .. note::
  62. If you want to install under the ``Crypto`` package, replace
  63. below ``pycryptodomex`` with ``pycryptodome``.
  64. Windows does not come with a C compiler like most Unix systems.
  65. The simplest way to compile the *Pycryptodome* extensions from
  66. source code is to install the minimum set of Visual Studio
  67. components freely made available by Microsoft.
  68. #. Run Python from the command line and note down its version
  69. and whether it is a 32 bit or a 64 bit application.
  70. For instance, if you see::
  71. Python 2.7.2+ ... [MSC v.1500 32 bit (Intel)] on win32
  72. you clearly have Python 2.7 and it is a 32 bit application.
  73. #. **[Only once]** Install `Virtual Clone Drive`_.
  74. #. **[Only once]** Download the ISO image of the
  75. `MS SDK for Windows 7 and . NET Framework 3.5 SP1 <http://www.microsoft.com/en-us/download/details.aspx?id=18950>`_.
  76. It contains the Visual C++ 2008 compiler.
  77. There are three ISO images available: you will need ``GRMSDK_EN_DVD.iso`` if your
  78. Windows OS is 32 bits or ``GRMSDKX_EN_DVD.iso`` if 64 bits.
  79. Mount the ISO with *Virtual Clone Drive* and install the C/C++ compilers and the
  80. redistributable only.
  81. #. If your Python is a 64 bit application, open a command prompt and perform the following steps::
  82. > cd "C:\Program Files\Microsoft SDKs\Windows\v7.0"
  83. > cmd /V:ON /K Bin\SetEnv.Cmd /x64 /release
  84. > set DISTUTILS_USE_SDK=1
  85. Replace ``/x64`` with ``/x86`` if your Python is a 32 bit application.
  86. #. Compile and install PyCryptodome::
  87. > pip install pycryptodomex --no-use-wheel
  88. #. To make sure everything work fine, run the test suite::
  89. > python -m Cryptodome.SelfTest
  90. Windows (from sources, Python 3.3 and 3.4)
  91. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  92. .. note::
  93. If you want to install under the ``Crypto`` package, replace
  94. below ``pycryptodomex`` with ``pycryptodome``.
  95. Windows does not come with a C compiler like most Unix systems.
  96. The simplest way to compile the *Pycryptodome* extensions from
  97. source code is to install the minimum set of Visual Studio
  98. components freely made available by Microsoft.
  99. #. Run Python from the command line and note down its version
  100. and whether it is a 32 bit or a 64 bit application.
  101. For instance, if you see::
  102. Python 2.7.2+ ... [MSC v.1500 32 bit (Intel)] on win32
  103. you clearly have Python 2.7 and it is a 32 bit application.
  104. #. **[Only once]** Install `Virtual Clone Drive <https://www.redfox.bz/virtual-clonedrive.html>`_.
  105. #. **[Only once]** Download the ISO image of the
  106. `MS SDK for Windows 7 and . NET Framework 4 <https://www.microsoft.com/en-us/download/details.aspx?id=8442>`_.
  107. It contains the Visual C++ 2010 compiler.
  108. There are three ISO images available: you will need ``GRMSDK_EN_DVD.iso`` if your
  109. Windows OS is 32 bits or ``GRMSDKX_EN_DVD.iso`` if 64 bits.
  110. Mount the ISO with *Virtual Clone Drive* and install the C/C++ compilers and the
  111. redistributable only.
  112. #. If your Python is a 64 bit application, open a command prompt and perform the following steps::
  113. > cd "C:\Program Files\Microsoft SDKs\Windows\v7.1"
  114. > cmd /V:ON /K Bin\SetEnv.Cmd /x64 /release
  115. > set DISTUTILS_USE_SDK=1
  116. Replace ``/x64`` with ``/x86`` if your Python is a 32 bit application.
  117. #. Compile and install PyCryptodome::
  118. > pip install pycryptodomex --no-use-wheel
  119. #. To make sure everything work fine, run the test suite::
  120. > python -m Cryptodome.SelfTest
  121. Windows (from sources, Python 3.5 and newer)
  122. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  123. .. note::
  124. If you want to install under the ``Crypto`` package, replace
  125. below ``pycryptodomex`` with ``pycryptodome``.
  126. Windows does not come with a C compiler like most Unix systems.
  127. The simplest way to compile the *PyCryptodome* extensions from
  128. source code is to install the minimum set of Visual Studio
  129. components freely made available by Microsoft.
  130. #. **[Once only]** Download `Build Tools for Visual Studio 2019 <https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019>`_.
  131. In the installer, select the *C++ build tools*, the *Windows 10 SDK*, and the latest version of *MSVC v142 x64/x86 build tools*.
  132. #. Compile and install PyCryptodome::
  133. > pip install pycryptodomex --no-binary :all:
  134. #. To make sure everything work fine, run the test suite::
  135. > python -m Cryptodome.SelfTest
  136. Documentation
  137. ~~~~~~~~~~~~~
  138. Project documentation is written in reStructuredText and it is stored under ``Doc/src``.
  139. To publish it as HTML files, you need to install `sphinx <http://www.sphinx-doc.org/en/stable/>`_ and
  140. use::
  141. > make -C Doc/ html
  142. It will then be available under ``Doc/_build/html/``.
  143. PGP verification
  144. ~~~~~~~~~~~~~~~~
  145. All source packages and wheels on PyPI are cryptographically signed.
  146. They can be verified with the following PGP key::
  147. -----BEGIN PGP PUBLIC KEY BLOCK-----
  148. mQINBFTXjPgBEADc3j7vnma9MXRshBPPXXenVpthQD6lrF/3XaBT2RptSf/viOD+
  149. tz85du5XVp+r0SYYGeMNJCQ9NsztxblN/lnKgkfWRmSrB+V6QGS+e3bR5d9OIxzN
  150. 7haPxBnyRj//hCT/kKis6fa7N9wtwKBBjbaSX+9vpt7Rrt203sKfcChA4iR3EG89
  151. TNQoc/kGGmwk/gyjfU38726v0NOhMKJp2154iQQVZ76hTDk6GkOYHTcPxdkAj4jS
  152. Dd74M9sOtoOlyDLHOLcWNnlWGgZjtz0z0qSyFXRSuOfggTxrepWQgKWXXzgVB4Jo
  153. 0bhmXPAV8vkX5BoG6zGkYb47N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. pThgeOWxV6u1fhz4CeC1Hc8WOYr8S7G8P10Ji6owOcj/a1QuCW8XDB2omCTXlhFj
  170. zpC9dX8HgmUVnbPNiMjphihbKXoOcunRx4ZvqIa8mnTbI4tHtR0K0tI4MmbpcVOZ
  171. 8IFJ0nZJXuZiL57ijLREisPYmHfBHAgmh1j/W7kCDQRU14z4ARAA3QATRgvOSYFh
  172. nJOnIz6PO3G9kXWjJ8wvp3yE1/PwwTc3NbVUSNCW14xgM2Ryhn9NVh8iEGtPGmUP
  173. 4vu7rvuLC2rBs1joBTyqf0mDghlZrb5ZjXv5LcG9SA6FdAXRU6T+b1G2ychKkhEh
  174. d/ulLw/TKLds9zHhE+hkAagLQ5jqjcQN0iX5EYaOukiPUGmnd9fOEGi9YMYtRdrH
  175. +3bZxUpsRStLBWJ6auY7Bla8NJOhaWpr5p/ls+mnDWoqf+tXCCps1Da/pfHKYDFc
  176. 2VVdyM/VfNny9eaczYpnj5hvIAACWChgGDBwxPh2DGdUfiQi/QqrK96+F7ulqz6V
  177. 2exX4CL0cPv5fUpQqSU/0R5WApM9bl2+wljFhoCXlydU9HNn+0GatGzEoo3yrV/m
  178. PXv7d6NdZxyOqgxu/ai/z++F2pWUXSBxZN3Gv28boFKQhmtthTcFudNUtQOchhn8
  179. Pf/ipVISqrsZorTx9Qx4fPScEWjwbh84Uz20bx0sQs1oYcek2YG5RhEdzqJ6W78R
  180. S/dbzlNYMXGdkxB6C63m8oiGvw0hdN/iGVqpNAoldFmjnFqSgKpyPwfLmmdstJ6f
  181. xFZdGPnKexCpHbKr9fg50jZRenIGai79qPIiEtCZHIdpeemSrc7TKRPV3H2aMNfG
  182. L5HTqcyaM2+QrMtHPMoOFzcjkigLimMAEQEAAYkCHwQYAQIACQUCVNeM+AIbDAAK
  183. CRDabO+N4RaZEo7lD/45J6z2wbL8aIudGEL0aY3hfmW3qrUyoHgaw35KsOY9vZwb
  184. cZuJe0RlYptOreH/NrbR5SXODfhd2sxYyyvXBOuZh9i7OOBsrAd5UE01GCvToPwh
  185. 7IpMV3GSSAB4P8XyJh20tZqiZOYKhmbf29gUDzqAI6GzUa0U8xidUKpW2zqYGZjp
  186. wk3RI1fS7tyi/0N8B9tIZF48kbvpFDAjF8w7NSCrgRquAL7zJZIG5o5zXJM/ffF3
  187. 67Dnz278MbifdM/HJ+Tj0R0Uvvki9Z61nT653SoUgvILQyC72XI+x0+3GQwsE38a
  188. 5aJNZ1NBD3/v+gERQxRfhM5iLFLXK0Xe4K2XFM1g0yN4L4bQPbhSCq88g9Dhmygk
  189. XPbBsrK0NKPVnyGyUXM0VpgRbot11hxx02jC3HxS1nlLF+oQdkKFzJAMOU7UbpX/
  190. oO+286J1FmpG+fihIbvp1Quq48immtnzTeLZbYCsG4mrM+ySYd0Er0G8TBdAOTiN
  191. 3zMbGX0QOO2fOsJ1d980cVjHn5CbAo8C0A/4/R2cXAfpacbvTiNq5BVk9NKa2dNb
  192. kmnTStP2qILWmm5ASXlWhOjWNmptvsUcK+8T+uQboLioEv19Ob4j5Irs/OpOuP0K
  193. v4woCi9+03HMS42qGSe/igClFO3+gUMZg9PJnTJhuaTbytXhUBgBRUPsS+lQAQ==
  194. =DpoI
  195. -----END PGP PUBLIC KEY BLOCK-----
  196. .. _pypi: https://pypi.python.org/pypi/pycryptodome
  197. .. _get-pip.py: https://bootstrap.pypa.io/get-pip.py
  198. .. _GMP: http://gmplib.org