Commit graph

14 commits

Author SHA1 Message Date
Legrandin
12b75141c4 Minor simplification to DER decoding code 2015-03-18 08:42:04 +01:00
Legrandin
70c81e87d2 Fix P3 byte string for DerSequence 2014-07-15 23:01:34 +02:00
Legrandin
213c171550 Add EXTERNAL tags for INTEGERs 2014-07-15 23:01:34 +02:00
Legrandin
8675e6f03f Start licensing under BSD 2-Clause 2014-06-23 22:23:38 +02:00
Legrandin
d83380a048 Removed support for Python<2.4 2014-06-16 20:36:35 +02:00
Legrandin
7214ce9929 Removed most 'import *' statements
[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]
2013-10-20 13:30:21 -07:00
Legrandin
8766da37a2 whitespace changes (pre-AEAD)
[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
2013-10-20 13:30:21 -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
Sebastian Ramacher
fa930881d6 Reenable redefined tests.
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.
2012-05-28 11:46:35 +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
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
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