Commit graph

25 commits

Author SHA1 Message Date
Helder Eijs
ca975e96ad First version of bcrypt 2019-08-16 22:17:19 +02:00
Helder Eijs
fa933ab29e Make mypy test pass
In the process, refactor Crypto.Math to make use of inheritance.
2018-11-23 23:07:14 +01:00
Helder Eijs
39626a5b01 Move functions to get buffer information into Util._raw_api 2018-11-04 22:05:09 +01:00
Helder Eijs
cd7f0128b6 Make code base suitable for Python 2 and 3 - stop using 2to3 2018-11-04 15:04:23 +01:00
Helder Eijs
96517333f4 Remove Crypto.Util.py3compat.unhexlify and hexlify 2018-09-25 22:57:32 +02:00
Hugo
5d8b7513a7 Drop support for EOL Python 3.0-3.3 2018-09-24 11:29:20 +03:00
Helder Eijs
ec4084eaaf Support for memoryviews in CCM 2018-04-02 20:59:03 +02:00
Helder Eijs
1a56f87afe Support for memoryview in CBC/OFB/CFB mode 2018-04-02 20:59:03 +02:00
Helder Eijs
10fc1cc816 memoryview support for HMAC 2018-04-01 10:51:20 +02:00
Legrandin
65117b9562 Fix Crypto.Util.py3compay.tobytes 2015-11-12 16:19:56 -05:00
Legrandin
46f525e316 Add hexlify/unhexlify to Crypto.Util.py3compat 2015-11-08 13:15:41 +01:00
Legrandin
7f6c129451 Remove Python 2.1 compatibility code 2015-11-08 13:15:41 +01:00
Legrandin
08baea4cb4 Break up block_template.c (AES only) 2015-01-05 23:06:21 +01:00
Legrandin
e6771764de Add is_divisible_by_ulong method to Integer 2014-12-06 12:04:11 +01:00
Legrandin
10832de028 Merge branch 'kill-catchalls-1178485' of https://github.com/mitchellrj/pycrypto 2014-05-11 15:57:31 +02:00
Legrandin
79c8a18bbd Replace test vectors with FIPS 202 suite 2014-05-11 12:44:18 +02:00
Richard Mitchell
6faf860f7e Get rid of catch-all exceptions. LP#1178485. 2014-04-29 14:55:26 +01: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
Legrandin
5a0ee14e99 Refactoring of the asn1 module
The following changes are included:

- Decoding is a much simpler operation. The internal
  logic is based on stream of binary data, and not
  on string indexing anymore. Additionally,
  decoding used to look like this:

     bitmap = DerObject()
     bitmap.decode(input_buffer, True)
     if bitmap.isType('BIT STRING'):
        ... proceed with parsing ...
     else:
        ... error ...

  Whereas now, it is cleaner and more compact:

     bitmap = DerBitString()
     bitmap.decode(input_buffer)

  Any error condition will lead to an exception.

- isType() method has been removed because of the above.
- Added examples and documentation
- Added support IMPLICIT tags
- Added support for negative INTEGERs
- Added DerSetOf ASN.1 class
- DerObjectID can be initialized from the dotted representation of
  the Object ID.
- DerBitString has a new member 'value' to hold the binary
  string. The member 'payload' should not be accessed anymore.
- DerObjectID has a new member 'value' to hold the dotted representation
  of the Object ID string. The member 'payload' should not be accessed
  anymore.
- Added operator += to DER SEQUENCE. Now it is possible to do:

      my_str = DerOctetString(b'ZYZ')
      seq = DerSequence()
      seq += 0
      seq += my_str.encode()
- Update to test cases
2013-07-14 21:16:46 -07:00
Legrandin
b29a859ba5 Added description of what string helper functions in py3compat.py do. 2011-12-22 14:57:45 +01: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
Thorsten Behrens
4082de9a48 Add Ron Rivet Test
o Add Ron Rivet DES test to test_DES.py
o Started on API documentation for 3.x
2010-12-30 07:15:35 -05:00
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