summaryrefslogtreecommitdiff
path: root/lib/Crypto/SelfTest/PublicKey
Commit message (Collapse)AuthorAgeFilesLines
* Extended fix for the RSA boundary checkLegrandin2014-06-221-0/+11
|
* Remove a few custom exception types.Legrandin2014-06-221-23/+23
| | | | | | | | | | | The following custom exceptions are replaced with ValueError: * Crypto.Util.PaddingError * Crypto.PublicKey.KeyFormatError The custom Crypto.Util.asn1.NoDerElementError is now private to the module. Some white spaces have been removed.
* Refactor 3 places handling fastmath ImportErrorMarc Abramowitz2014-02-222-20/+4
| | | | | so that they call `Crypto.SelfTest.st_common.handle_fastmath_import_error`, thereby eliminiating duplicate code.
* Use different method for getting ext_suffixMarc Abramowitz2014-02-222-2/+4
| | | | | | | | | | | | | ``` ext_suffix = get_config_var("EXT_SUFFIX") or get_config_var("SO") ``` because `get_config_var("SO")` returns None in Python 3.4.0a4 because the "SO" variable is deprecated and "EXT_SUFFIX" is the new way to get this information (see: http://bugs.python.org/issue19555) This fixes `TypeError: Can't convert 'NoneType' object to str implicitly` errors when running the tests on Python 3.4.0a4.
* Removed most 'import *' statementsLegrandin2013-10-201-1/+1
| | | | | | | | | | | | [dlitz@dlitz.net: Re-ordered commits; so don't import S2V yet] [dlitz@dlitz.net: Included an additional 'import *' change from the following commit:] commit 4ec64d8eaaa4965889eb8e3b801fc77aa84e0a4e Author: Legrandin <helderijs@gmail.com> Date: Tue Sep 10 07:28:08 2013 +0200 Removed last references to ApiUsageError [dlitz@dlitz.net: Removed unrelated whitespace changes]
* whitespace changes (pre-AEAD)Legrandin2013-10-201-1/+1
| | | | | | | [dlitz@dlitz.net: Whitespace changes extracted from the author's pull request:] - [9c13f9c] Rename 'IV' parameter to 'nonce' for AEAD modes. - [4ec64d8] Removed last references to ApiUsageError - [ee46922] Removed most 'import *' statements
* Fix unhexlify in Python 3.2Dwayne Litzenberger2013-07-141-1/+1
| | | | | | | | Under Python 3.2, unhexlify expects to receive a `bytes` object. Passing it a (unicodr) `str` object causes it to raise the following exception: TypeError: 'str' does not support the buffer interface
* Add support for import/export of DSA keysLegrandin2013-07-143-1/+396
| | | | | | | | | | | | This patch adds methods importKey() to DSA module and exportKey() to _DSAobj object. Public and private keys can be imported/exported in a variety of formats: * DER vs PEM * PKCS#8 vs OpenSSL vs OpenSSH/OpenSSL * Encrypted vs clear
* Added support for PKCS#8-encrypted private keys.Legrandin2013-07-141-29/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch contains the following changes: - Private RSA keys can be imported/exported in encrypted form, protected according to PKCS#8 and: * PBKDF2WithHMAC-SHA1AndDES-EDE3-CBC. * PBKDF2WithHMAC-SHA1AndAES128-CBC * PBKDF2WithHMAC-SHA1AndAES192-CBC * PBKDF2WithHMAC-SHA1AndAES256-CBC In addition to that, it is possible to import keys i the following weak formats: * pbeWithMD5AndDES-CBC * pbeWithSHA1AndRC2-CBC * pbeWithMD5AndRC2-CBC * pbeWithSHA1AndDES-CBC - The following new module (and 1 new package) are added: * Crypto.Util.Padding for simple padding/unpadding logic * Crypto.IO._PBES for PBE-related PKCS#5 logic * Crypto.IO.PEM for PEM wrapping/unwrapping * Crypto.IO.PKCS8 for PKCS#8 wrapping/unwrapping - All Object ID (OIDs) are now in dotted form to increase readability. - Add AES support to PEM format (decode only). The PEM module can decrypt messages protected with AES-CBC. - Update RSA import test cases. - Updated to PKCS8 test cases
* Fix RSA object serialization: Python 3 compatibilityDwayne Litzenberger2013-02-161-15/+21
|
* Fix RSA object serializationFrank Sievertsen2013-02-161-0/+60
|
* Raise a ValueError as documented.Sebastian Ramacher2012-05-281-0/+4
| | | | Also add a test case for it.
* Return a byte string if format is set to OpenSSH.Sebastian Ramacher2012-05-281-1/+1
| | | | RSA.exportKey claims to return a byte string, so really return one.
* Reenable redefined tests.Sebastian Ramacher2012-05-281-3/+3
| | | | | | | | The test suite contains tests that are disabled because they have the same name as other tests. Renaming them enables them again. PKCS1_OAEP_Tests.testEncryptDecrypt1 is updated to work with the new interface of PKCS1_OAEP.
* Add ability to import RSAPublicKey objects (encoded in DER or PEM)Legrandin2012-05-181-0/+24
|
* Describe unit tests for importKeyLegrandin2012-05-181-2/+12
|
* Fixes to make test suite pass for Python 2.1 and Python 3Legrandin2012-05-111-2/+2
|
* Add negative test for signature verification.Legrandin2012-05-031-2/+6
| | | | | Verify that Elgamal signature works with longs (it was disabled by mistake).
* Added test vectors for ElGamal signatures.Legrandin2012-05-031-18/+58
|
* Add ElGamal tests to the test suite.Legrandin2012-04-271-0/+1
|
* Added some test vectors for ElGamal (encryption only). Fixed two small bugs ↵Legrandin2012-04-261-0/+166
| | | | in ElGamal code.
* Merge from upstreamLegrandin2011-12-222-18/+32
|\
| * Py3k: Fix test_importKey: Don't pass unicode string to .decrypt()v2.4Dwayne C. Litzenberger2011-10-221-4/+4
| | | | | | | | We work with bytes, not unicode.
| * Py3k: fix when RSA.importKey is called with a str argument, instead of bytesDwayne C. Litzenberger2011-10-221-5/+20
| |
| * Python 3.x fixes:Dwayne C. Litzenberger2011-10-221-3/+3
| | | | | | | | | | - Use absolute imports - Fix StringIO import so that 2to3 can translate it
| * Add test cases to prove that an imported RSA private key really behaves like ↵Legrandin2011-10-171-5/+20
| | | | | | | | | | | | | | | | one (BUG 702835). Conflicts: lib/Crypto/SelfTest/PublicKey/test_importKey.py
* | Merged from upstream (py3k support) and modified so that all unit tests pass.Legrandin2011-10-183-213/+235
|\ \ | |/
| * Unwraping byte conversion on test vectors.Anders Sundman2011-04-243-33/+33
| | | | | | | | Doing the wraping later, at the point of use instead.
| * Add Ron Rivet TestThorsten Behrens2010-12-302-1/+2
| | | | | | | | | | o Add Ron Rivet DES test to test_DES.py o Started on API documentation for 3.x
| * PY3K _fastmath supportThorsten Behrens2010-12-292-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * PY3K support for _fastmath.c; removed floordiv(a,b) hack and replaced with ↵Thorsten Behrens2010-12-293-8/+8
| | | | | | | | divmod(a,b)[0]; move to assertEqual throughout the test suite to prep for assert_ and failIf being removed in 3.3/3.4
| * More consistent use of binary strings in test scripts. Now suceeds with ↵Thorsten Behrens2010-12-282-100/+101
| | | | | | | | Python 3.2b2
| * Changes to allow pycrpyto to work on Python 3.x as well as 2.1 through 2.7Thorsten Behrens2010-12-283-26/+32
| |
* | Added Lorenz Quack's native C implementation of all SHA-2 algorithmLegrandin2011-10-161-0/+2
| | | | | | | | | | | | | | | | | | (as submitted here https://bugs.launchpad.net/pycrypto/+bug/544792) so that they are available also in Python 2.1, 2.2, 2.3 and 2.4. Regardless where the implementation comes from (Python standard library or our native modules, depending on the Python version), all Crypto.Hash objects are always used as front-ends.
* | Added support for export and import of unencrypted PKCS#8 keys (with tests).Legrandin2011-10-111-1/+59
| | | | | | | | FIX: Certain public exponents were not correctly exported in OpenSSH keys.
* | Added support for pass phrase and DES/3DES encrypted PEM keys, for both ↵Legrandin2011-10-031-0/+53
| | | | | | | | import and export.
* | Added support for export of public RSA keys in OpenSSH formatLegrandin2011-09-211-0/+7
| |
* | Add support for import of OpenSSH public keysLegrandin2011-09-211-0/+8
| |
* | A message is printed if RSA tests are performed without fastmath.Legrandin2011-09-201-1/+1
| |
* | Test RSA key import with both fast and slow RSA enginesLegrandin2011-02-211-11/+24
| |
* | Factorization of n from d stops after 100 attempts, with test cases.Legrandin2011-02-061-1/+14
| |
* | Keep p<q check while generating an RSA key, but tell people why really we do ↵Legrandin2011-01-191-1/+0
| | | | | | | | it (that is, because it helps a little the inversion step that follows).
* | Allow RSA to be generated with an arbitary public exponent e.Legrandin2011-01-181-0/+9
| | | | | | | | | | | | | | | | Small fix to importKey documentation (ASN.1 structure names were incorrect for public keys). Factors of an RSA private key are computed from private exponent d (both slowmath and fastmath).
* | Pure tab-to-space conversion with :retab in vim.Legrandin2011-01-161-79/+79
| |
* | Add test cases to prove that an imported RSA private key really behaves like ↵Legrandin2011-01-161-5/+20
| | | | | | | | one (BUG 702835).
* | Improve the test command in setup.py, by allowing tests to beLegrandin2011-01-102-2/+4
|/ | | | performed on a single sub-package or module only.
* _slowmath: Compute RSA u parameter when it's not given to RSA.constructDwayne C. Litzenberger2010-08-261-0/+1
| | | | This makes _slowmath behave the same as _fastmath in this regard.
* Support for older versions of pythonLegrandin2010-08-021-4/+4
| | | | | | This patch add support for older python 2.1/2.2 to the previous one (DER/PEM). Committer: Legrandin <gooksankoo@hoiptorrow.mailexpire.com>
* Add ability to export and import RSA keys in DER and PEM format.Legrandin2010-08-022-0/+143
| | | | | | | | | | | | | | | | | | | | | | 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>
* Fix PyCrypto when floor division (python -Qnew) is enabledDwayne C. Litzenberger2010-05-291-1/+1
|