Home | Trees | Indices | Help |
|
---|
|
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 withstood attacks for 30 years, and it is therefore considered reasonably secure for new designs.
The algorithm can be used for both confidentiality (encryption) and authentication (digital signature). It is worth noting that signing and decryption are significantly slower than verification and encryption. The cryptograhic strength is primarily linked to the length of the modulus n. In 2012, a sufficient length is deemed to be 2048 bits. For more information, see the most recent ECRYPT report.
Both RSA ciphertext and RSA signature are as big as the modulus n (256 bytes if n is 2048 bit long).
This module provides facilities for generating fresh, new RSA keys, constructing them from known components, exporting them, and importing them.
>>> from Crypto.PublicKey import RSA >>> >>> key = RSA.generate(2048) >>> f = open('mykey.pem','w') >>> f.write(RSA.exportKey('PEM')) >>> f.close() ... >>> f = open('mykey.pem','r') >>> key = RSA.importKey(f.read())
Even though you may choose to directly use the methods of an RSA key object to perform the primitive cryptographic operations (e.g. _RSAobj.encrypt), it is recommended to use one of the standardized schemes instead (like Crypto.Cipher.PKCS1_v1_5 or Crypto.Signature.PKCS1_v1_5).
Classes | |
_RSAobj Class defining an actual RSA key. |
|
RSAImplementation An RSA key factory. |
Variables | |
generate = _impl.generate Randomly generate a fresh, new RSA key object. |
|
construct = _impl.construct Construct an RSA key object from a tuple of valid RSA components. |
|
importKey = _impl.importKey Import an RSA key (public or private half), encoded in standard form. |
|
error = _impl.error
|
Variables Details |
generateRandomly generate a fresh, new RSA key object. See RSAImplementation.generate.
|
constructConstruct an RSA key object from a tuple of valid RSA components. See RSAImplementation.construct.
|
importKeyImport an RSA key (public or private half), encoded in standard form. See RSAImplementation.importKey.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Jul 25 17:50:53 2014 | http://epydoc.sourceforge.net |