Skip to content

Commit

Permalink
Polished the Crypto.PublicKey page.Added hyperlinks to RFCs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Legrandin committed Apr 12, 2012
1 parent 35a748d commit e6ef5de
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions lib/Crypto/PublicKey/ElGamal.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
# SOFTWARE.
# ===================================================================

"""ElGamal public-key algorithm (encryption and signature)."""

__revision__ = "$Id$"

from Crypto.PublicKey.pubkey import *
Expand Down
19 changes: 14 additions & 5 deletions lib/Crypto/PublicKey/RSA.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# SOFTWARE.
# ===================================================================

"""RSA public-key cryptography algorithm.
"""RSA public-key cryptography algorithm (signature and encryption).
RSA_ is the most widespread and used public key algorithm. Its security is
based on the difficulty of factoring large integers. The algorithm has
Expand Down Expand Up @@ -308,7 +308,7 @@ def exportKey(self, format='PEM', passphrase=None, pkcs=1):
:Parameter format: The format to use for wrapping the key.
- *'DER'*. Binary encoding, always unencrypted.
- *'PEM'*. Textual encoding, done according to RFC1421/3.
- *'PEM'*. Textual encoding, done according to `RFC1421`_/`RFC1423`_.
Unencrypted (default) or encrypted.
- *'OpenSSH'*. Textual encoding, done according to OpenSSH specification.
Only suitable for public keys (not private keys).
Expand All @@ -318,7 +318,7 @@ def exportKey(self, format='PEM', passphrase=None, pkcs=1):
:Type passphrase: string
:Parameter pkcs: The PKCS standard to follow for encoding the key.
You have two choices: **1** (PKCS#1, RFC3447) or **8** (PKCS#8, RFC5208).
You have two choices: **1** (PKCS#1, `RFC3447`_) or **8** (PKCS#8, `RFC5208`_).
PKCS#8 is only available for private keys.
PKCS#1 is the default.
PKCS standards are not relevant for the *OpenSSH* format.
Expand All @@ -327,6 +327,11 @@ def exportKey(self, format='PEM', passphrase=None, pkcs=1):
:Return: A byte string with the encoded public or private half.
:Raise ValueError:
When the format is unknown.
.. _RFC1421: http://www.ietf.org/rfc/rfc1421.txt
.. _RFC1423: http://www.ietf.org/rfc/rfc1423.txt
.. _RFC3447: http://www.ietf.org/rfc/rfc3447.txt
.. _RFC5208: http://www.ietf.org/rfc/rfc5208.txt
"""
if passphrase is not None:
passphrase = tobytes(passphrase)
Expand Down Expand Up @@ -580,9 +585,9 @@ def importKey(self, externKey, passphrase=None):
The key can be in any of the following formats:
- DER + PKCS#1 (binary)
- PEM + PKCS#1 (textual, according to RFC1421/3)
- PEM + PKCS#1 (textual, according to `RFC1421`_/`RFC1423`_)
- DER + PKCS#8 (binary, private key only)
- PEM + PKCS#8 (textual, according to RFC5208, private key only)
- PEM + PKCS#8 (textual, according to `RFC5208`_, private key only)
- OpenSSH (textual public key only)
In case of PEM + PKCS#1, the key can be encrypted with DES or 3TDES according to a certain ``pass phrase``.
Expand All @@ -597,6 +602,10 @@ def importKey(self, externKey, passphrase=None):
:Raise ValueError/IndexError/TypeError:
When the given key cannot be parsed (possibly because the pass phrase is wrong).
.. _RFC1421: http://www.ietf.org/rfc/rfc1421.txt
.. _RFC1423: http://www.ietf.org/rfc/rfc1423.txt
.. _RFC5208: http://www.ietf.org/rfc/rfc5208.txt
"""
externKey = tobytes(externKey)
if passphrase is not None:
Expand Down
2 changes: 2 additions & 0 deletions lib/Crypto/PublicKey/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
Crypto.PublicKey.RSA (Signing, encryption, and blinding)
Crypto.PublicKey.qNEW (Signature only)
======================== =============================================
:undocumented: _DSA, _RSA, _fastmath, _slowmath, pubkey
"""

__all__ = ['RSA', 'DSA', 'ElGamal', 'qNEW']
Expand Down
2 changes: 2 additions & 0 deletions lib/Crypto/PublicKey/qNEW.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
# ===================================================================
#

"""q-NEW public-key signature algorithm."""

__revision__ = "$Id$"

from Crypto.PublicKey import pubkey
Expand Down

0 comments on commit e6ef5de

Please sign in to comment.