Commit Graph

28 Commits

Author SHA1 Message Date
KOLANICH
a23dccef97 Got rid of six. 2022-11-11 17:39:38 +03:00
Gabriel Cruz
50ef17a9b1 Feature:: Support for keys without usage flags (#371)
Co-authored-by: James Morris <jmorris@securityinnovation.com>
2021-07-08 15:52:09 -04:00
James Morris
a69158412e Remove stacklevel=4 from logging.debug in decorators.KeyAction
Fixes #368
2021-04-09 14:06:24 -04:00
Daniel Kahn Gillmor
6e34a00a50 Avoid noisy warnings when generating messages
Similar to the concerns in #297, there are noisy warnings produced
when encrypting data to or signing data with a primary key, if a
subkey is ultimately what ends up being used:

```
./generate-test-vectors:279: UserWarning: Key F231550C4F47E38E does not have the required usage flag EncryptStorage, EncryptCommunications; using subkey 4766F6B9D5F21EB6
  encmsg = alice_key.pubkey.encrypt(payloadmsg, cipher=cipher, sessionkey=sessionkey)
```

This change converts these warnings to debug information.

In #298, we just removed the noisy warnings on consuming data -- the
caller really has no choice in how to consume the data, so there's no
point in sending them alerts.  Either we can decrypt or verify with
the primary key or one of the subkeys, or we can't.

But in the situation where the caller is producing data -- signing or
encrypting -- we might want be a little bit noisier, because the user
really might have some obscure reason that they prefer to use a
specific subkey that the library isn't in a position to understand.
So giving the user a hint at debug-level about what's going on is
probably reasonable.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-11-01 16:46:03 -04:00
Michael Greene
2817059e8f unit test coverage and a couple of minor fixed bugs found from running those tests 2016-04-21 16:07:31 -07: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
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
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
6fbe57bb96 some minor inspection fixes; documentation 2014-10-14 13:12:04 -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
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
851f645cdd 100% test coverage - closes #115 2014-09-30 18:38:10 -07:00
Michael Greene
e52d130704 more coverage 2014-09-30 14:24:52 -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
ee261fe8be initial pass of direct-key signing (0x1f) plus tests - #104 2014-09-26 16:56:25 -07:00
Michael Greene
522ebcd535 added missing super calls to __init__ so multiple/diamond inheritance resolves correctly; removed some commented code that no longer needs to exist 2014-09-26 14:24:22 -07:00
Michael Greene
919c6357b2 replaced TypedProperty with sdproperty; replaced ClassProperty with classproperty 2014-09-24 15:55:42 -07:00
Michael Greene
2060dd886b PEP 8
[skip ci]
2014-09-23 16:04:03 -07:00
Michael Greene
7629bc79d0 api usability enhancements; more unit test stuff 2014-09-22 17:25:22 -07:00
Michael Greene
658450640f - abstracted symmetric decryption so the actual cipher object construction and ciphertext decryption happens in one place to make the code easier to maintain
- moved asymmetric decryption into PKESessionKey as it makes more sense to have it in the one place where asymmetric decryption is even used
2014-08-27 12:57:05 -07:00
Michael Greene
9a2c452f3c put the six.b in the wrong place; also removed Managed from decorators as it is no longer being used 2014-08-26 13:08:00 -07:00
Michael Greene
007aeffe91 PEP 8 2014-08-25 17:23:52 -07:00
Michael Greene
8542e63652 leveraging six a bit better now; also, py27 should not be broken now 2014-08-22 20:03:11 -07:00
Michael Greene
0415fd216f PEP 8 2014-08-10 03:14:07 -07:00
Michael Greene
943c39c0bb fixed Python 2.7 2014-08-10 02:34:35 -07:00
Michael Greene
5ba1095ec0 python 3.2 works now 2014-08-10 01:54:12 -07:00
Michael Greene
1be7a65d25 moved the Managed decorator to decorators.py; created new TypedDecorator for type-based dispatching of multiple property setters 2014-07-30 22:38:09 -07:00