| 1 |
El Gamal |
| 2 |
======== |
| 3 |
|
| 4 |
.. warning:: |
| 5 |
Even though ElGamal algorithms are in theory reasonably secure, |
| 6 |
in practice there are no real good reasons to prefer them to :doc:`rsa` |
| 7 |
instead. |
| 8 |
|
| 9 |
Signature algorithm |
| 10 |
------------------- |
| 11 |
The security of the ElGamal signature scheme is based (like DSA) on the discrete |
| 12 |
logarithm problem (DLP_). Given a cyclic group, a generator *g*, |
| 13 |
and an element *h*, it is hard to find an integer *x* such that :math:`g^x = h`. |
| 14 |
|
| 15 |
The group is the largest multiplicative sub-group of the integers modulo *p*, |
| 16 |
with *p* prime. |
| 17 |
The signer holds a value *x* (*0<x<p-1*) as private key, and its public |
| 18 |
key (*y* where :math:`y=g^x \text{ mod } p`) is distributed. |
| 19 |
|
| 20 |
The ElGamal signature is twice as big as *p*. |
| 21 |
|
| 22 |
Encryption algorithm |
| 23 |
-------------------- |
| 24 |
The security of the ElGamal encryption scheme is based on the computational |
| 25 |
Diffie-Hellman problem (CDH_). Given a cyclic group, a generator *g*, |
| 26 |
and two integers *a* and *b*, it is difficult to find |
| 27 |
the element :math:`g^{ab}` when only :math:`g^a` and :math:`g^b` are known, and not *a* and *b*. |
| 28 |
|
| 29 |
As before, the group is the largest multiplicative sub-group of the integers |
| 30 |
modulo *p*, with *p* prime. |
| 31 |
The receiver holds a value *a* (*0<a<p-1*) as private key, and its public key |
| 32 |
(*b* where :math:`b=g^a`) is given to the sender. |
| 33 |
|
| 34 |
The ElGamal ciphertext is twice as big as *p*. |
| 35 |
|
| 36 |
Domain parameters |
| 37 |
----------------- |
| 38 |
For both signature and encryption schemes, the values *(p,g)* are called |
| 39 |
*domain parameters*. |
| 40 |
They are not sensitive but must be distributed to all parties (senders and |
| 41 |
receivers). |
| 42 |
Different signers can share the same domain parameters, as can |
| 43 |
different recipients of encrypted messages. |
| 44 |
|
| 45 |
Security |
| 46 |
-------- |
| 47 |
Both DLP and CDH problem are believed to be difficult, and they have been proved |
| 48 |
such (and therefore secure) for more than 30 years. |
| 49 |
|
| 50 |
The cryptographic strength is linked to the magnitude of *p*. |
| 51 |
In 2017, a sufficient size for *p* is deemed to be 2048 bits. |
| 52 |
For more information, see the most recent ECRYPT_ report. |
| 53 |
|
| 54 |
The signature is four times larger than the equivalent DSA, and the ciphertext |
| 55 |
is two times larger than the equivalent RSA. |
| 56 |
|
| 57 |
Functionality |
| 58 |
------------- |
| 59 |
This module provides facilities for generating new ElGamal keys |
| 60 |
and constructing them from known components. |
| 61 |
|
| 62 |
.. _DLP: http://www.cosic.esat.kuleuven.be/publications/talk-78.pdf |
| 63 |
.. _CDH: http://en.wikipedia.org/wiki/Computational_Diffie%E2%80%93Hellman_assumption |
| 64 |
.. _ECRYPT: http://www.ecrypt.eu.org/ecrypt2/documents/D.SPA.20.pdf |
| 65 |
|
| 66 |
.. automodule:: Crypto.PublicKey.ElGamal |
| 67 |
:members: |