| 1 |
Compatibility with PyCrypto |
| 2 |
=========================== |
| 3 |
|
| 4 |
PyCryptodome exposes *almost* the same API as the old `PyCrypto <https://www.dlitz.net/software/pycrypto>`_ |
| 5 |
so that *most* applications will run unmodified. |
| 6 |
However, a very few breaks in compatibility had to be introduced |
| 7 |
for those parts of the API that represented a security hazard or that |
| 8 |
were too hard to maintain. |
| 9 |
|
| 10 |
Specifically, for public key cryptography: |
| 11 |
|
| 12 |
* The following methods from public key objects (RSA, DSA, ElGamal) have been |
| 13 |
removed: |
| 14 |
|
| 15 |
- :meth:`sign` |
| 16 |
- :meth:`verify` |
| 17 |
- :meth:`encrypt` |
| 18 |
- :meth:`decrypt` |
| 19 |
- :meth:`blind` |
| 20 |
- :meth:`unblind` |
| 21 |
|
| 22 |
Applications should be updated to use instead: |
| 23 |
|
| 24 |
- :mod:`Crypto.Cipher.PKCS1_OAEP` for encrypting using RSA. |
| 25 |
- :mod:`Crypto.Signature.pkcs1_15` or :mod:`Crypto.Signature.pss` for signing using RSA. |
| 26 |
- :mod:`Crypto.Signature.DSS` for signing using DSA. |
| 27 |
* Method: :meth:`generate` for public key modules does not accept the ``progress_func`` parameter anymore. |
| 28 |
* Ambiguous method ``size`` from RSA, DSA and ElGamal key objects have been removed. |
| 29 |
Instead, use methods :meth:`size_in_bytes` and :meth:`size_in_bits` and check the documentation. |
| 30 |
* The 3 public key object types (RSA, DSA, ElGamal) are now unpickable. |
| 31 |
You must use the :meth:`export_key` method of each key object and select a good output format: for private |
| 32 |
keys that means a good password-based encryption scheme. |
| 33 |
* Removed attribute ``Crypto.PublicKey.RSA.algorithmIdentifier``. |
| 34 |
* Removed ``Crypto.PublicKey.RSA.RSAImplementation`` (which should have been private in the first place). |
| 35 |
Same for ``Crypto.PublicKey.DSA.DSAImplementation``. |
| 36 |
|
| 37 |
For symmetric key cryptography: |
| 38 |
|
| 39 |
* Symmetric ciphers do not have ECB as default mode anymore. ECB is not semantically secure |
| 40 |
and it exposes correlation across blocks. |
| 41 |
An expression like ``AES.new(key)`` will now fail. If ECB is the desired mode, |
| 42 |
one has to explicitly use ``AES.new(key, AES.MODE_ECB)``. |
| 43 |
* :mod:`Crypto.Cipher.DES3` does not allow keys that degenerate to Single DES. |
| 44 |
* Parameter :data:`segment_size` cannot be 0 for the CFB mode. |
| 45 |
* Parameters ``disabled_shortcut`` and ``overflow`` cannot be passed anymore to :mod:`Crypto.Util.Counter.new`. |
| 46 |
Parameter :data:`allow_wraparound` is ignored (counter block wraparound will **always** be checked). |
| 47 |
* The :data:`counter` parameter of a CTR mode cipher must be generated via |
| 48 |
:mod:`Crypto.Util.Counter`. It cannot be a generic callable anymore. |
| 49 |
* Keys for :mod:`Crypto.Cipher.ARC2`, :mod:`Crypto.Cipher.ARC4` and :mod:`Crypto.Cipher.Blowfish` must be at least 40 bits long (still very weak). |
| 50 |
|
| 51 |
The following packages, modules and functions have been removed: |
| 52 |
|
| 53 |
- ``Crypto.Random.OSRNG``, ``Crypto.Util.winrandom`` and ``Crypto.Random.randpool``. |
| 54 |
You should use :mod:`Crypto.Random` only. |
| 55 |
- ``Crypto.Cipher.XOR``. If you just want to XOR data, use :mod:`Crypto.Util.strxor`. |
| 56 |
- ``Crypto.Hash.new``. Use :func:`Crypto.Hash.<algorithm>.new` instead. |
| 57 |
- ``Crypto.Protocol.AllOrNothing`` |
| 58 |
- ``Crypto.Protocol.Chaffing`` |
| 59 |
- ``Crypto.Util.number.getRandomNumber`` |
| 60 |
- ``Crypto.pct_warnings`` |
| 61 |
|
| 62 |
Others: |
| 63 |
|
| 64 |
* Support for any Python version older than 2.6 is dropped. |