399 Commits

Author SHA1 Message Date
Michael Greene
f8347d3e39 some unit test updates 2016-04-18 19:13:57 -07:00
Michael Greene
c635147e38 whoops - wrong class 2016-04-18 19:02:32 -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
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
9fb619067e expanded PGPMessage testing somewhat and organized the literal data files a bit better
[skip ci]
2016-02-26 16:20:43 -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
a1d9f1cf08 fixed a typo
[skip ci]
2016-02-15 23:10:02 -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
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
bbddeb7fcf Just because it's in PATH, doesn't mean it exists 2015-06-02 16:14:44 -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
bd5a0f081e bah 2015-06-01 18:38:33 -07:00
Michael Greene
b227af0490 regression test for #140 2015-06-01 18:21:47 -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
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
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
21102f9aae Documentation extravaganza!
[skip ci]
2014-10-14 14:41:24 -07:00
Michael Greene
6fbe57bb96 some minor inspection fixes; documentation 2014-10-14 13:12:04 -07:00
Michael Greene
737b265452 changed instances of __add__ to __or__ -- closes #133 2014-10-14 12:05:11 -07:00
Michael Greene
73111e505b whoops, forgot os.pardir 2014-10-10 10:45:54 -07:00
Michael Greene
579ffbf153 this should fix a problem that appears when trying to run the test suite if the project root is named something other than 'PGPy' 2014-10-10 10:37:41 -07:00
Michael Greene
3f45f05ddf whoops 2014-10-07 17:02:09 -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
c98dad8537 removed unused argument, message
[skip ci]
2014-10-07 11:57:55 -07:00
Michael Greene
9b59b8bc07 standalone signature support edge case 2014-10-07 11:53:12 -07:00
Michael Greene
2a7051ed79 implemented PGPKeyring.unload and unit test - closes #78 2014-10-06 14:54:43 -07:00
Michael Greene
9233b9fa1f coverage 2014-10-06 13:25:45 -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
851f645cdd 100% test coverage - closes #115 2014-09-30 18:38:10 -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
Michael Greene
ef1decb445 second verse, same as the first 2014-09-30 13:41:05 -07:00
Michael Greene
368382356f coverage stuff 2014-09-30 13:32:15 -07:00
Michael Greene
0a887b3e56 added new exception class, PGPEncryptionError; added some additional test coverage for exception raising scenarios 2014-09-29 17:07:56 -07:00
Michael Greene
45afe9946f decrypting messages encrypted with multiple passphrases now works reliably; the MDC packet is now actually checked (using a constant time comparison function) after decryption 2014-09-29 15:21:17 -07:00
Michael Greene
d00010ef04 primary/subkey binding now fully works - closes #104; removed FileLoader class; renamed Exportable to Armorable; removed requests from requirements.txt; updated README.rst - closes #127; progress 2014-09-29 13:36:52 -07:00
Michael Greene
6ce75c6669 subkey binding now works - #104 2014-09-27 19:40:39 -07:00
Michael Greene
61487e536b added a test to directly sign a subkey 2014-09-26 19:45:07 -07:00
Michael Greene
a1f5f1df3e better checking of possible subject/signature type combinations; (sub)key revocation signature generation - #104 2014-09-26 19:14:45 -07:00