| 1 |
Installation |
| 2 |
------------ |
| 3 |
|
| 4 |
The installation procedure depends on the package you want the library to be in. |
| 5 |
PyCryptodome can be used as: |
| 6 |
|
| 7 |
#. **An almost drop-in replacement for the old PyCrypto library**. |
| 8 |
You install it with:: |
| 9 |
|
| 10 |
pip install pycryptodome |
| 11 |
|
| 12 |
In this case, all modules are installed under the ``Crypto`` package. |
| 13 |
You can test everything is right with:: |
| 14 |
|
| 15 |
pip install pycryptodome-test-vectors |
| 16 |
python -m Crypto.SelfTest |
| 17 |
|
| 18 |
One must avoid having both PyCrypto and PyCryptodome installed |
| 19 |
at the same time, as they will interfere with each other. |
| 20 |
This option is therefore recommended only when you are sure that |
| 21 |
the whole application is deployed in a ``virtualenv``. |
| 22 |
|
| 23 |
#. **A library independent of the old PyCrypto**. |
| 24 |
You install it with:: |
| 25 |
|
| 26 |
pip install pycryptodomex |
| 27 |
|
| 28 |
You can test everything is right with:: |
| 29 |
|
| 30 |
pip install pycryptodome-test-vectors |
| 31 |
python -m Cryptodome.SelfTest |
| 32 |
|
| 33 |
In this case, all modules are installed under the ``Cryptodome`` package. |
| 34 |
The old PyCrypto and PyCryptodome can coexist. |
| 35 |
|
| 36 |
.. note:: |
| 37 |
|
| 38 |
If you intend to run PyCryptodome with Python 2.7 under Windows, you must first install |
| 39 |
the `Microsoft Visual C++ 2015 Redistributable <https://www.microsoft.com/en-us/download/details.aspx?id=52685>`_. |
| 40 |
That is not necessary if you use Python 3. |
| 41 |
|
| 42 |
The procedures below go a bit more in detail, by explaining |
| 43 |
how to setup the environment for compiling the C extensions |
| 44 |
for each OS, and how to install the GMP library. |
| 45 |
|
| 46 |
Compiling in Linux Ubuntu |
| 47 |
~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 48 |
|
| 49 |
.. note:: |
| 50 |
If you want to install under the ``Crypto`` package, replace |
| 51 |
below ``pycryptodomex`` with ``pycryptodome``. |
| 52 |
|
| 53 |
For Python 2.x:: |
| 54 |
|
| 55 |
$ sudo apt-get install build-essential python-dev |
| 56 |
$ pip install pycryptodomex |
| 57 |
$ pip install pycryptodome-test-vectors |
| 58 |
$ python -m Cryptodome.SelfTest |
| 59 |
|
| 60 |
For Python 3.x:: |
| 61 |
|
| 62 |
$ sudo apt-get install build-essential python3-dev |
| 63 |
$ pip install pycryptodomex |
| 64 |
$ pip install pycryptodome-test-vectors |
| 65 |
$ python3 -m Cryptodome.SelfTest |
| 66 |
|
| 67 |
For PyPy:: |
| 68 |
|
| 69 |
$ sudo apt-get install build-essential pypy-dev |
| 70 |
$ pip install pycryptodomex |
| 71 |
$ pip install pycryptodome-test-vectors |
| 72 |
$ pypy -m Cryptodome.SelfTest |
| 73 |
|
| 74 |
Compiling in Linux Fedora |
| 75 |
~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 76 |
|
| 77 |
.. note:: |
| 78 |
If you want to install under the ``Crypto`` package, replace |
| 79 |
below ``pycryptodomex`` with ``pycryptodome``. |
| 80 |
|
| 81 |
For Python 2.x:: |
| 82 |
|
| 83 |
$ sudo yum install gcc gmp python-devel |
| 84 |
$ pip install pycryptodomex |
| 85 |
$ pip install pycryptodome-test-vectors |
| 86 |
$ python -m Cryptodome.SelfTest |
| 87 |
|
| 88 |
For Python 3.x:: |
| 89 |
|
| 90 |
$ sudo yum install gcc gmp python3-devel |
| 91 |
$ pip install pycryptodomex |
| 92 |
$ pip install pycryptodome-test-vectors |
| 93 |
$ python3 -m Cryptodome.SelfTest |
| 94 |
|
| 95 |
For PyPy:: |
| 96 |
|
| 97 |
$ sudo yum install gcc gmp pypy-devel |
| 98 |
$ pip install pycryptodomex |
| 99 |
$ pip install pycryptodome-test-vectors |
| 100 |
$ pypy -m Cryptodome.SelfTest |
| 101 |
|
| 102 |
|
| 103 |
Windows (from sources) |
| 104 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 105 |
|
| 106 |
.. note:: |
| 107 |
If you want to install under the ``Crypto`` package, replace |
| 108 |
below ``pycryptodomex`` with ``pycryptodome``. That being the case and if you want to run the test, instead of ``Cryptodome.SelfTest``, run ``Crypto.SelfTest``. |
| 109 |
|
| 110 |
Windows does not come with a C compiler like most Unix systems. |
| 111 |
The simplest way to compile the *PyCryptodome* extensions from |
| 112 |
source code is to install the minimum set of Visual Studio |
| 113 |
components freely made available by Microsoft. |
| 114 |
|
| 115 |
#. **[Once only]** Download `Build Tools for Visual Studio 2019 <https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019>`_. |
| 116 |
In the installer, select the *C++ build tools*, the *Windows 10 SDK*, and the latest version of *MSVC v142 x64/x86 build tools*. |
| 117 |
|
| 118 |
#. Compile and install PyCryptodome:: |
| 119 |
|
| 120 |
> pip install pycryptodomex --no-binary :all: |
| 121 |
|
| 122 |
#. To make sure everything work fine, run the test suite:: |
| 123 |
|
| 124 |
> pip install pycryptodome-test-vectors |
| 125 |
> python -m Cryptodome.SelfTest |
| 126 |
|
| 127 |
Documentation |
| 128 |
~~~~~~~~~~~~~ |
| 129 |
|
| 130 |
Project documentation is written in reStructuredText and it is stored under ``Doc/src``. |
| 131 |
To publish it as HTML files, you need to install `sphinx <http://www.sphinx-doc.org/en/stable/>`_ and |
| 132 |
use:: |
| 133 |
|
| 134 |
> make -C Doc/ html |
| 135 |
|
| 136 |
It will then be available under ``Doc/_build/html/``. |
| 137 |
|
| 138 |
PGP verification |
| 139 |
~~~~~~~~~~~~~~~~ |
| 140 |
|
| 141 |
All source packages and wheels on PyPI are cryptographically signed. |
| 142 |
They can be verified with the following PGP key:: |
| 143 |
|
| 144 |
-----BEGIN PGP PUBLIC KEY BLOCK----- |
| 145 |
|
| 146 |
mQINBFTXjPgBEADc3j7vnma9MXRshBPPXXenVpthQD6lrF/3XaBT2RptSf/viOD+ |
| 147 |
tz85du5XVp+r0SYYGeMNJCQ9NsztxblN/lnKgkfWRmSrB+V6QGS+e3bR5d9OIxzN |
| 148 |
7haPxBnyRj//hCT/kKis6fa7N9wtwKBBjbaSX+9vp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zlNYMXGdkxB6C63m8oiGvw0hdN/iGVqpNAoldFmjnFqSgKpyPwfLmmdstJ6f |
| 179 |
xFZdGPnKexCpHbKr9fg50jZRenIGai79qPIiEtCZHIdpeemSrc7TKRPV3H2aMNfG |
| 180 |
L5HTqcyaM2+QrMtHPMoOFzcjkigLimMAEQEAAYkCHwQYAQIACQUCVNeM+AIbDAAK |
| 181 |
CRDabO+N4RaZEo7lD/45J6z2wbL8aIudGEL0aY3hfmW3qrUyoHgaw35KsOY9vZwb |
| 182 |
cZuJe0RlYptOreH/NrbR5SXODfhd2sxYyyvXBOuZh9i7OOBsrAd5UE01GCvToPwh |
| 183 |
7IpMV3GSSAB4P8XyJh20tZqiZOYKhmbf29gUDzqAI6GzUa0U8xidUKpW2zqYGZjp |
| 184 |
wk3RI1fS7tyi/0N8B9tIZF48kbvpFDAjF8w7NSCrgRquAL7zJZIG5o5zXJM/ffF3 |
| 185 |
67Dnz278MbifdM/HJ+Tj0R0Uvvki9Z61nT653SoUgvILQyC72XI+x0+3GQwsE38a |
| 186 |
5aJNZ1NBD3/v+gERQxRfhM5iLFLXK0Xe4K2XFM1g0yN4L4bQPbhSCq88g9Dhmygk |
| 187 |
XPbBsrK0NKPVnyGyUXM0VpgRbot11hxx02jC3HxS1nlLF+oQdkKFzJAMOU7UbpX/ |
| 188 |
oO+286J1FmpG+fihIbvp1Quq48immtnzTeLZbYCsG4mrM+ySYd0Er0G8TBdAOTiN |
| 189 |
3zMbGX0QOO2fOsJ1d980cVjHn5CbAo8C0A/4/R2cXAfpacbvTiNq5BVk9NKa2dNb |
| 190 |
kmnTStP2qILWmm5ASXlWhOjWNmptvsUcK+8T+uQboLioEv19Ob4j5Irs/OpOuP0K |
| 191 |
v4woCi9+03HMS42qGSe/igClFO3+gUMZg9PJnTJhuaTbytXhUBgBRUPsS+lQAQ== |
| 192 |
=DpoI |
| 193 |
-----END PGP PUBLIC KEY BLOCK----- |
| 194 |
|
| 195 |
.. _pypi: https://pypi.python.org/pypi/pycryptodome |
| 196 |
.. _get-pip.py: https://bootstrap.pypa.io/get-pip.py |
| 197 |
.. _GMP: http://gmplib.org |