Commit graph

23 commits

Author SHA1 Message Date
Legrandin
7073325ff7 Update to documentation 2015-07-19 19:12:47 +00:00
Legrandin
b52930835d Small clean up to PSS code 2015-07-12 19:57:16 +00:00
Legrandin
29302e0686 Fix missing module problem on Windows 2015-07-11 20:37:33 +00:00
Legrandin
f45c561328 Add Crypto.Signature.pkcs1_pss with NIST test vectors
Crypto.Signature.PKCS1_PSS is reverted to the old behavior it had
in PyCrypto: verify() returns True/False and does not raise an
exception with wrong signature.
2015-07-11 20:26:17 +00:00
Legrandin
0e38393c74 Revert verify method of PKCS1_PSS to old behavior (return True/False) 2015-07-01 20:28:43 +00:00
Legrandin
db6c6f8e5e Add support or BLAKE2s and BLAKE2b 2015-04-16 14:11:50 +02:00
Legrandin
1f3c1b4fcc Remove Crypto.PublicKey.RSA.RSAImplementation
In the process, we add a "randfunc" parameter to
- Crypto.Cipher.PKCS1_OAEP.new()
- Crypto.Cipher.PKCS1_v1_5.new()
- Crypto.Signature.PKCS1_PSS.new()
to set the PRNG used by each algorithm.
Previously, the PRNG was taken from the RSA key itself.
2015-03-11 11:30:33 -04:00
Legrandin
b6321900a7 Cleaning up the Hash module 2015-01-30 22:38:51 +01:00
Legrandin
1c3c049a4c Clean up Crypto.PublicKey module
This patch does a few things to simplify the public key classes
(RSA, DSA and ElGamal):

* It removes the Crypto.PublicKey.pubkey module. The 3 classes
  do not have an ancestor anymore.
* Methods sign(), verify(), encrypt(), and decrypt() are removed.
* Methods blind() and unblind() are removed.
* Methods can_sign() and can_encrypt() are removed.
* The 3 classes cannot be pickled anymore.
2014-06-16 22:00:03 +02:00
Legrandin
e61cb26e1e Failed signature verifications raise an exception.
Until now, the verify() method of a Crypto.Signature object returns
False if a signature is not authentic.

With this change set, verify() now raises a ValueError exception.
The return value of verify() must not be checked anymore.

NOTE: this change sets breaks compatibility with PyCrypto
2014-06-16 20:38:26 +02:00
Legrandin
d83380a048 Removed support for Python<2.4 2014-06-16 20:36:35 +02:00
W. Trevor King
860523d288 Sign the hash in the the PKCS1_PSS doctest, not the key
As it stood before this commit, the hash was never used in the signing
process.  It looks like the bug was introduced by e053629 (Restructure
both PKCS#1 signature schemes as objects, 2011-10-16), which changed:

-    >>> signature = PKCS1_PSS.sign(h, key)
+    >>> signer = PKCS1_PSS.new(key)
+    >>> signature = PKCS1_PSS.sign(key)
2013-12-23 16:23:32 -08:00
Dwayne Litzenberger
fd398a28e3 Hash: Speed up initialization by removing pure-Python wrappers
The pure Python wrappers around Crypto.Hash.* were convenient, but they
slowed down hash initialization by 4-7x.

There is a speed trade-off here: The MD5 and SHA1 objects are just
wrapped hashlib objects (or old-style md5/sha objects).  To maintain API
compatibility with the rest of PyCrypto, we still have to wrap them, so
they're slower to initialize than the rest of the hash functions.  If
hashlib ever adds a .new() method, we will automatically use hashlib
directly and gain the initialization speed-up.
2013-02-17 20:07:02 -08:00
Dwayne Litzenberger
755375bb7d Hash: Rename SHA->SHA1 and RIPEMD->RIPEMD160 (1/2)
These algorithm names were confusing, because there are actually
algorithms called "SHA" (a.k.a. SHA-0) and "RIPEMD" (the original
version).

This commit just renames the modules, with no backward-compatibility
support.
2013-02-16 16:20:23 -08:00
Dwayne C. Litzenberger
761eb61d2e Fix documentation (thanks John-Mark Gurney) 2012-05-24 18:52:43 -04:00
Legrandin
6f31263720 Fix documentation for PKCS#1 modules.
Objects used by PKCS#1 modules were treated as private,
and therefore ignored by epydoc.

Replaced SHA module with None as PBKDF1 default parameter value, because it was
not displayed nicely by epydoc. Default value is assigned in the body.
2012-04-19 22:40:39 +02:00
Legrandin
8390495a9d Further fixed for python 3 2011-10-19 23:02:58 +02:00
Legrandin
c22fa18c0d Merged from upstream (py3k support) and modified so that all unit tests pass. 2011-10-18 23:20:26 +02:00
Legrandin
e05362993e Restructure both PKCS#1 signature schemes as objects.
Fixed the can_sign() methods.
2011-10-16 18:29:56 +02:00
Legrandin
9cb1a2d35d To simplify, no RNG needs to be provided with PKCS1 encryption: the one belonging to each RSA key is reused.
Error detection is internally implemented in a simpler (and safer) way for PKCS1 OAEP decryption.
General fixes to documentation for PKCS1.
2011-10-02 22:37:36 +02:00
Legrandin
9620229917 Make PKCS#1 and its test cases work with Python 2.1 2011-02-07 23:16:07 +01:00
Legrandin
56d7e9fc8e Polish documentation of PKCS#1. Reuse strxor already available in Crypto.Util 2011-02-07 22:30:28 +01:00
Legrandin
6d7eb4f0f3 First fully tested version of Crypto.Signature.PKCS1_PSS 2011-02-06 23:07:58 +01:00