646 Commits

Author SHA1 Message Date
Michael Greene
2b4e94c17f removed useless if
[skip ci]
2016-04-18 19:13:45 -07:00
Michael Greene
cd60dfe7b6 update six and change uses of six.reraise to six.raise_from 2016-04-18 18:59:39 -07:00
Michael Greene
ab038c68a5 - added setter for PGPKey.pubkey
- syntaxy fix to some sync logic
2016-04-18 18:58:53 -07:00
Michael Greene
137c5d4df4 - fixed improper munging of non-unicode inputs - #154
- added additional unicode tests - #153
 - fixed mixin/base class ordering of PGPObject subclasses
2016-02-26 16:23:02 -08:00
Michael Greene
bf86d8137b PEP 8
[skip ci]
2016-02-26 16:22:05 -08:00
Michael Greene
a7742540ec - started adding memoryview stuff for further reducing parsing IO [#145]
added a memoryview wrapper for python 2 to make this usage more uniform
 - started implementing __copy__ methods to make copying PGP* objects less useless
 - added an initial set of copy tests
 - moved _parent stuff to a new mixin class ParentRef to reduce code duplication
   this also wraps _parent references in weakrefs to help reduce cycles
 - implemented recovering a public key from a private key [closes #92]
   added a test for this as well
2016-02-19 20:54:18 -08:00
Michael Greene
3cbad620e1 - generalized/refactored away some repeated code in MPIs subclasses
- updated __all__ in a few places
- improved test_exports
- pep8
2016-02-16 21:05:21 -08:00
Michael Greene
e8326b4771 - correctly deriving the KEK length now for KDF
- added missing OIDs for EllipticCurveOID enum members
 - expanded test of expected key generation failures to test all ECC OIDs that aren't implemented yet
 - some minor code cleanups
2016-02-16 16:23:13 -08:00
Michael Greene
13e8d27f8e implemented Marker packet 2016-02-16 16:19:58 -08:00
Michael Greene
f31a802c73 - Implemented proper parsing of ECDH keys - closes #110
- Additional code needed to generate ECDH keys also added
 - Encrypt/decrypt using ECDH also works
 - Added some code to the test harness to start making it work with gpg 2.1
 - Fixed key generation tests to test generating keys using all possible algorithms
 - Updated documentation sources to reflect these changes
2016-02-15 22:48:01 -08:00
Michael Greene
3d5f878b08 - String2Key count is a single octet, so the
value must be constrained to the range
  0-255 inclusive
- reversed six.PY2/3 checks so six.PY2 is the special case
- singledispatch import now tries the one in functools if singledispatch is not installed
2016-01-12 14:22:41 -08:00
Michael Greene
95e60a433e - changed PGPSignature.expires_at to return None instead of False to be consistent with PGPKey.expires_at
- #151:
   - fixed an issue with PGPKey.is_expired where the resulting value was inverted if the key has an expiration date set
   - added junk key testdata/blocks/expyro.asc and amended test_03_armor to include it for the purposes of exercising the is_expired property
 - #95:
  - added initial parsing of partial-lengths
  - added some initial test data to work with; testing with that test data is skipped for the moment since it is guaranteed to fail
2015-07-29 13:38:22 -07:00
Michael Greene
9c6d9636b4 - implemented key protection such that unprotected private keys can be protected with passphrases, and already-protected passphrases can be re-protected with a new passphrase, and unit tests for these two scenarios - closes #149
- updated CI configs so that Python 3.2 can actually finish running the test suite without crashing since it is stuck on an older version of Cryptography
- added additional tests to test setup.py on all versions of Python after I noticed that a recent change would have made it break on Python 3.2
- enum34 should no longer be installed needlessly on Python 3.4 or newer
- added --no-cache-dir to tox's call to pip to install dependencies needed for testing
2015-06-11 19:55:07 -07:00
Michael Greene
c76ba55ee5 - Implemented proper parsing of ECDSA keys - closes #109
- Added ECDSA signing and verification - closes #111
 - ECDSA key generation is also supported
 - refactored some of the signing/verification machinery to simplify code in PGPKey._sign and PGPKey.verify
 - fixed a bug with Signature subpacket ByteFlags where the byte output was not being properly null-padded to the length of the subpacket when necessary, which led to the potential for key outputs that would fail to parse properly if update_hlen was not called (which is silly)
 - fixed string formatting UserID packets when the comment and/or email address are missing - closes #142
 - implemented OpaquePubKey and OpaquePrivKey so that keys using unimplemented formats can still be loaded without error, even if they can't be used
 - enabled initial key action testing using ecc.1.pub.asc and ecc.1.sec.asc (which also required copying the two signatures from ecc.1.pub.asc to ecc.1.sec.asc)
 - improved test output for some tests with auto-ids that were formed in an unfortunate manner
2015-06-10 22:39:21 -07:00
Michael Greene
f3300d3895 - fixed __all__ in each __init__.py (elements should be strings, not class references); added __all__ where appropriate to other files
- added preliminary test data for ecdh/ecdsa keys [obtained from https://sites.google.com/site/brainhub/pgpecckeys#TOC-ECC-NIST-P-256-key-no-passphrase]
   - also added logic to skip actually testing against that test data as it doesn't work yet
 - updated need.txt
[skip ci]
2015-06-05 20:10:04 -07:00
Michael Greene
eb8b5de76d - stupid test fix to explicitly use gpg2 if both gpg and gpg2 are available, as their --list-packets format is slightly different
- fixed a stupid thing with struct.unpack on Py2 not working on bytearrays
2015-06-02 15:25:32 -07:00
Michael Greene
84567e085f - PEP8
- modified tox.ini so that py32 can continue to be tested even though cryptography no longer supports it
 - Key Generation - #147 :
   - implemented new API method
   - added unit tests for generating keys, adding user ids, and adding new subkeys
   - added unit tests to test basic expected exception raising when trying to use incomplete keys
   - added a very basic key-completeness test to the @KeyAction decorator
 - added __contains__ to SignatureVerification
2015-06-01 17:45:41 -07:00
Michael Greene
f05e9e9a37 - bumped version to 0.4.0 (forgot to do this earlier)
- Key generation - #147 :
   - backend implementation for generating RSA and DSA keys is complete
   - first pass of making the API accomodate it appropriately
   - generating subkeys is not worked into the API yet
   - unit tests are not written yet
2015-05-29 18:38:05 -07:00
Michael Greene
6d3e4ab6f6 abstracted the serialization of PGP objects into binary form into new __bytearray__ methods to reduce IO and defer conversion to an immutable bytes/str object until the entire serialization task is complete 2015-04-12 18:58:13 -07:00
Michael Greene
cb91a8056d ran into some trouble verifying some DSA signatures due to incorrect asn.1 encoding of signature components that are 256 bits long - resolved by finally just using pyasn1 instead of the mini encoder I had written before 2015-04-12 18:46:41 -07:00
Michael Greene
275d51791f bump cryptography version to 0.8; this also requires a few changes in how keys are interfaced with 2015-04-12 18:43:50 -07:00
Michael Greene
8ee07a2ef8 - renamed PGPSignature.expired to PGPSignature.is_expired for consistency
- renamed PGPSignature.expires to PGPSignature.expires_at for consistency
 - added missing property PGPKey.expires_at
 - added documentation to PGPUID's class docstring to indicate that it implements __format__ for GnuPG-like formatting of User IDs.
2014-10-17 14:44:57 -07:00
Michael Greene
6d4b953f22 now all exceptions raised during parsing get reraised as a PGPError to indicate that it failed. Updated documentation to indicate possible exceptions to be raised on from_blob and from_file. Indicated the existence of implemented __str__ and __bytes__ methods on exportable PGP* objects to show which ones can be exported to those formats. 2014-10-15 15:10:28 -07:00
Michael Greene
123874aac4 fixed a potential inconsistency between a successful PGPKey.unlock and one that warns that the operation did nothing if it is invoked with an "as ..." clause; updated relevant tests to check that 2014-10-15 12:05:48 -07:00
Michael Greene
d02a7f7595 CSS change for documentation to make the content area a bit wider relative to the window; PEP 8 2014-10-14 15:39:35 -07:00
Michael Greene
67c8935b49 PGPKey.unlock now yields self, so that with key.unlock() as ... now behaves as would be expected 2014-10-14 15:25:53 -07:00
Michael Greene
2ed206d0a4 changed progress bar colors; more documentation
[skip ci]
2014-10-14 14:47:51 -07:00
Michael Greene
21102f9aae Documentation extravaganza!
[skip ci]
2014-10-14 14:41:24 -07:00
Michael Greene
f2eb21887f more documentation
[skip ci]
2014-10-14 13:28:47 -07:00
Michael Greene
6fbe57bb96 some minor inspection fixes; documentation 2014-10-14 13:12:04 -07:00
Michael Greene
5c291e4a8c TypeError: next() takes no keyword arguments 2014-10-14 12:26:20 -07:00
Michael Greene
90534d50a2 #134 2014-10-14 12:08:55 -07:00
Michael Greene
737b265452 changed instances of __add__ to __or__ -- closes #133 2014-10-14 12:05:11 -07:00
Michael Greene
a36a776079 documentation updates and a minor API change to PGPUID.new 2014-10-07 16:32:20 -07:00
Michael Greene
9b59b8bc07 standalone signature support edge case 2014-10-07 11:53:12 -07:00
Michael Greene
8f7ff3421b some more documentation
[skip ci]
2014-10-06 17:02:03 -07:00
Michael Greene
2a7051ed79 implemented PGPKeyring.unload and unit test - closes #78 2014-10-06 14:54:43 -07:00
Michael Greene
7ba92299c8 PEP 8 2014-10-06 13:14:38 -07:00
Michael Greene
accac2f702 - Selection of signing/encrypting user id is now possible; closes #121
- Forced ByteFlag subpackets to take/return sets now instead of lists
 - removed some properties from PGPKey
 - added new classmethod `from_blob` to Armorable
 - made some modifications to the unit tests to work with this stuff
2014-10-06 13:12:32 -07:00
Michael Greene
008c911877 fixed some unicode stuff and some encoding stuff; added more thorough unicode testing; moved deque sorting functions into a new subclass of deque; fixed some broken tests 2014-10-02 19:11:23 -07:00
Michael Greene
5ee67cbcba closes #130 2014-10-02 11:02:18 -07:00
Michael Greene
c8a34762bd Python 2.x fix 2014-10-02 10:50:26 -07:00
Michael Greene
e600be8921 some documentation; overhauled PGPKey.sign by splitting it into multiple methods; reimplemented almost all of TestPGPKey in test_05_actions 2014-10-01 21:47:31 -07:00
Michael Greene
f8ec3055ed PEP 8 2014-10-01 11:04:01 -07:00
Michael Greene
92e02291ee fixed some property setter method names 2014-10-01 10:54:31 -07:00
Michael Greene
e24c0d439d made crc24 static 2014-10-01 10:54:19 -07:00
Michael Greene
851f645cdd 100% test coverage - closes #115 2014-09-30 18:38:10 -07:00
Michael Greene
70038ef002 fixed a null-byte padding issue with decryption using RSA 2014-09-30 15:58:45 -07:00
Michael Greene
b1204fb5ac more coverage 2014-09-30 15:27:14 -07:00
Michael Greene
e52d130704 more coverage 2014-09-30 14:24:52 -07:00