Commit graph

24 commits

Author SHA1 Message Date
Legrandin
7073325ff7 Update to documentation 2015-07-19 19:12:47 +00:00
Legrandin
29302e0686 Fix missing module problem on Windows 2015-07-11 20:37:33 +00:00
Legrandin
c85dfa7953 Add Crypto.Signature.pkcs1_v1_5 module with NIST test vectors
Crypto.Signature.PKCS1_v1_5 is reverted to old behavior it
had in PyCrypto (verify raises no exception; it only returns
True or False).
2015-07-10 19:19:13 +00:00
Legrandin
0847391638 Revert verify method of PKCS1_v1_5 to old behavior (return True/False) 2015-07-01 20:12:54 +00:00
Legrandin
db6c6f8e5e Add support or BLAKE2s and BLAKE2b 2015-04-16 14:11:50 +02: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
a9df7886a9 Update epydoc configuration and remove warnings 2014-06-16 20:36:36 +02:00
Legrandin
d83380a048 Removed support for Python<2.4 2014-06-16 20:36:35 +02:00
Legrandin
be12a401f1 Merge branch 'sha3' of https://github.com/bluviolin/pycrypto 2014-05-05 21:31:19 +02:00
Dwayne Litzenberger
acbd4dedc8 More ValueError -> TypeError 2013-10-20 13:30:22 -07:00
Legrandin
546c192d61 Bugfix #1119552: PKCS#1v1.5 has to accept signatures without NULL parameters
The digest AlgorithmIdentifier has optional (NULL) parameters; the
verification function should not reject a signature if they are omitted.

With this fix, either case is acceptable (parameters present with value NULL
or not present).

As an exception, signatures based on old MD2/MD5 must always have NULL
parameters.

See Appendix B.1 of RFC 3447 and Section 2.1 of RFC 4055.

Closes: https://bugs.launchpad.net/pycrypto/+bug/1119552
[dlitz: Rebased and updated to use refactored asn1 API, text OIDs, & to fix Python 2.1.]
2013-07-14 23:07:48 -07:00
Legrandin
90d6d3dbcf Added support for PKCS#8-encrypted private keys.
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
2013-07-14 21:16:46 -07:00
Fabrizio Tarizzo
24df7d3c5d Merge with upstream updates 2013-04-28 12:06:18 +02:00
Dwayne Litzenberger
59018ff99c Hash: Remove "oid" attributes; add "name" attribute
In PyCrypto v2.5, the "oid" attribute was added to hash objects.  In
retrospect, this was not a good idea, since the OID is not really a
property of the hash algorithm, it's a protocol-specific identifer for
the hash functions.  PKCS#1 v1.5 uses it, but other protocols (e.g.
OpenPGP, DNSSEC, SSH, etc.) use different identifiers, and it doesn't make
sense to add these to Crypto.Hash.* every time a new algorithm is added.

This also has the benefit of being compatible with the Python standard
library's "hashlib" objects, which also have a name attribute.
2013-02-17 19:00:50 -08: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
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
69397b7d69 More precise computation of modulus size in bytes (only relevant if modulus size in bits is in the form n*8+1) 2011-02-14 23:52:01 +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
623c303c09 Add check for signature length in verify() 2011-02-03 19:34:06 +01:00
Legrandin
1166875eb3 The final, tested PKCS#1 v1.5 signature module 2011-02-03 01:35:59 +01:00
Legrandin
1a51197542 Add PKCS1_v_1_5 module 2011-02-02 20:14:04 +01:00