Commit graph

57 commits

Author SHA1 Message Date
Thorsten Behrens
cb48387f66 PY3K _fastmath support
o _fastmath now builds and runs on PY3K
o Changes to setup.py to allow /usr/include for gmp.h
o Changes to setup.py to allow linking fastmath w/ static mpir
  on Windows without warning messages
o Changes to test_DSA/test_RSA to throw an exception if _fastmath
  is present but cannot be imported (due to an issue building
  _fastmath or the shared gmp/mpir libraries not being reachable)
o number.py has the code to flag a failing _fastmath, but that
  code is commented out for a better runtime experience
o Clean up the if for py21compat import - should have been == not is
o Clean up some '== None' occurences, now 'is None' instead
2010-12-29 13:21:05 -05:00
Thorsten Behrens
295ce314d9 Changes to allow pycrpyto to work on Python 3.x as well as 2.1 through 2.7 2010-12-28 16:26:52 -05:00
Dwayne C. Litzenberger
6833a7bf18 Make RSA.generate raise a more user-friendly exception message when the user tries to generate a bogus-length key.
Before this change, doing RSA.generate(128*5) would raise an exception saying:

    "bits must be multiple of 128 and > 512"

This was because getStrongPrime was raising the exception when trying to
generate 320-bit primes (which is correct behaviour).  Now, we raise a more
friendly error message:

    "RSA modulus length must be a multiple of 256 and > 1024"
2010-08-27 00:14:40 -04:00
Legrandin
902ea14fc2 Support for older versions of python
This patch add support for older python 2.1/2.2 to the previous one (DER/PEM).

Committer: Legrandin <gooksankoo@hoiptorrow.mailexpire.com>
2010-08-02 16:34:53 -04:00
Legrandin
0f45878cef Add ability to export and import RSA keys in DER and PEM format.
Typical usage for importing an RSA key:

f = file("ssl.pem")
key = RSA.importKey(f.read())
f.close()
key.verify(hash, signature)

Typical usage for exporting an RSA public key:

key = RSA.generate(512, randfunc)
f = file("ssl.der","w")
f.write(key.publickey.exportKey('DER'))
f.close()

I confirm I am eligible for submitting code to pycrypto according
to http://www.dlitz.net/software/pycrypto/submission-requirements/
fetched on 27 December 2009.

Committer: Legrandin <gooksankoo@hoiptorrow.mailexpire.com>
2010-08-02 16:34:13 -04:00
Dwayne C. Litzenberger
386de1947b Legal: Dedicate my files to the public domain.
In an attempt to simplify the copyright status of PyCrypto, I'm placing my
code into the public domain, and encouraging other contributors to do the
same.

I have used a public domain dedication that was recommended in a book on FOSS legal
issues[1], followed by the warranty disclaimer boilerplate from the MIT license.

[1] _Intellectual Property and Open Source: A Practical Guide to Protecting
    Code_, a book written by Van Lindberg and published by O'Reilly Media.
    (ISBN 978-0-596-51796-0)
2009-03-01 10:22:51 -05:00
Dwayne C. Litzenberger
ff8a657a8d cleanup: Move modules to "lib/Crypto" subdirectory.
This will avoid the previous situation where scripts like the old "test.py"
get included accidentally in a release.  It also frees us to put additional
build scripts in the top-level directory of the source tree.
2009-02-28 13:14:53 -05:00
Renamed from PublicKey/RSA.py (Browse further)