646 Commits

Author SHA1 Message Date
rot42
d601655c27 support for Ed25519 signatures
This increases the versioned dependency on the cryptography module to
2.6, since that is the version that provides the necessary ed25519
functionality.

We also add a "pure" 25519 OpenPGP certificate for testing purposes.

Closes #221, #222, #247

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-08-01 15:57:48 -04:00
rot42
53c6c3ba94 support for ECDH encryption using Curve25519 (cv25519)
This increases the minimum versioned dependency on the cryptography
module to 2.5, where the necessary features are exposed.

We also add a mixed RSA + ECDH OepnPGP certificate for testing
purposes.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-08-01 15:54:06 -04:00
rot42
8cc340d781 Use dedicated exception class when ECPointFormat is wrong
This makes it easier to catch these specific types of errors if the
user wants to, and makes it clearer what is happening.
2019-08-01 14:18:33 -04:00
Daniel Kahn Gillmor
c82492b8b0 fall back to SHA256 if no hashprefs are available
All modern OpenPGP clients support SHA256, and it is still believed to
be cryptographically strong.

In the event that PGPy encounters a situation where it cannot
determine the correct hash algorithm to use, it was previously
throwing surprising exceptions.

With these changes, it should fall back instead to SHA-256.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-08-01 13:54:53 -04:00
rot42
a993f4c335 ensure that ECPoint copy works for native points 2019-08-01 13:28:49 -04:00
Michael Greene
9c52dc7b2b Merge pull request #227 from anarcat/revocation_keys
add convenience accessor for revocation keys
2019-07-31 09:33:12 -07:00
Michael Greene
c740bc8453 Merge pull request #253 from rot42/ft-s2k-gnu-extensions
Support for S2K GNU extensions
2019-07-31 09:31:03 -07:00
Michael Greene
084bfe655e Merge pull request #262 from dkg/set-creation
Set creation times
2019-07-31 09:28:51 -07:00
Michael Greene
35d73ba88c Merge pull request #260 from dkg/fix-255
PGPKey.pubkey() should return self if it is already a public key
2019-07-31 09:21:58 -07:00
Michael Greene
67895dd704 Merge pull request #266 from dkg/elliptic-curve-point-cleanup
add ECPoint class
2019-07-31 09:18:09 -07:00
Michael Greene
fbd2796863 Merge pull request #259 from dkg/cryptography-1.5
move to python-cryptography v1.5
2019-07-31 09:08:40 -07:00
Daniel Kahn Gillmor
93a1ba3b6c add ECPoint class
Handling Elliptic Curve points in OpenPGP is weird enough that we
should try to encapsulate it.

Much of this code was borrowed from work done by rot42
<rot42@protonmail.com>

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-07-17 05:29:40 -04:00
Daniel Kahn Gillmor
d281d6ec17 move to python-cryptography v1.5
version 1.5 (released nearly 3 years ago, on 2016-08-26) introduced
sign() and verify() for all asymmetric algorithms.

Without this change, with modern versions of python-cryptography, we
see warnings like:

/usr/lib/python3/dist-packages/pgpy/packet/fields.py:1177: CryptographyDeprecationWarning: signer and verifier have been deprecated. Please use sign and verify instead.

The version of python-cryptography in debian stretch (oldstable) is
1.7.1, for point of reference.
2019-07-17 04:41:27 -04:00
Daniel Kahn Gillmor
148fbf6948 Avoid warnings about bad escape characters
Python strings don't use \ to escape either * or !.  So the
declarations here were adding to the list of warnings during the run
of the test suite.

Declaring them as raw (unescaped) strings keeps the warnings more quiet.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-07-17 02:58:47 -04:00
Daniel Kahn Gillmor
9f37b19230 Add optional created= argument to PGPKey.new() 2019-07-17 01:58:30 -04:00
Daniel Kahn Gillmor
5eb84e128c allow the creation of signatures with a specific timestamp 2019-07-17 01:57:16 -04:00
Daniel Kahn Gillmor
fd6cc59173 PGPKey.pubkey() should return self if it is already a public key
This makes it easier to use PGPy to work with OpenPGP certificates
where we don't have the secret part corresponding to some of the
public keys (e.g. stripped subkeys, subkeys on smartcards, etc).

Closes #255
2019-07-17 01:38:41 -04:00
rot42
4835fb7cd2 changes requested in pull request #253 2019-06-09 22:26:20 +02:00
Michael Greene
35d505c5f8 Merge pull request #244 from Wolf480pl/preference-list
#243 - Pick first _supported_ algorithm from preference list
2019-06-07 14:55:13 -07:00
Michael Greene
9caf462794 Merge pull request #241 from strayge/master
added resync IV during decrypt Symmetrically Encrypted Data Packet
2019-06-07 14:53:57 -07:00
Michael Greene
e6b62a5cc0 Merge pull request #239 from jethrogb/ec-pubkey-encoding
Correctly encode the Elliptic Curve public point MPI
2019-06-07 14:49:57 -07:00
Michael Greene
0dc35dfb29 Merge pull request #234 from sowbug/master
pubkey method copies parent to newly generated public key
2019-06-07 14:48:33 -07:00
Michael Greene
6db9de5671 Merge pull request #206 from J08nY/feature/reason-for-revocation
Add .revocation_reason property to PGPSignature.
2019-06-07 14:46:27 -07:00
Michael Greene
db7d00fc3f Merge pull request #207 from J08nY/feature/key-revocations
Add revocation_signatures property to PGPKey.
2019-06-07 14:45:42 -07:00
Michael Greene
d93ffe6de3 Merge pull request #215 from J08nY/fix/sigsubj-by
Fix sigsubj.by to be a pgpy.PGPKey instance. Fixes #214.
2019-06-07 14:39:55 -07:00
Michael Greene
77f3c20ebe Merge pull request #205 from J08nY/feature/issuer-fingerprint
Support IssuerFingerprint subpacket.
2019-06-07 14:35:58 -07:00
Michael Greene
c8ebbae059 Merge pull request #180 from J08nY/feature/keyring-add
Add PGPKeyring.load() for PGPKey instance param.
2019-06-07 14:33:46 -07:00
Cameron Hawkins
849f6f518f Changed ABC imports from collections
3.8 will no longer support collections.Sized etc, one must rather import
from collections.abc
2019-06-07 12:07:09 -07:00
rot42
e2b873c5ee support for S2K GNU extensions: no private part + smartcard 2019-04-23 00:55:54 +02:00
Wolf480pl
e77b41acea #243 - Pick first _supported_ algorithm from preference list
- Add a `is_supported` property to symmetric ciphers and hash algorithms
  in pgpy.constants.
  At the moment, a hash algorithm is always supported.
  A cipher algorithm is supported iff its .cipher is callable.

- When picking a preferred cipher from a preference list,
  pick the first _supported_ one, instead of the first one.

- Check for `alg.is_supported` instead of `callable(alg.cipher)`
  in pgpy.symenc._encrypt
2018-07-14 20:43:31 +02:00
strayge
7dcdcf5898 added resync IV during decrypt Symmetrically Encrypted Data Packet 2018-06-05 19:23:43 +06:00
Jethro Beekman
ac5847de0b Correctly encode the Elliptic Curve public point MPI 2018-05-23 18:22:52 -07:00
Mike Tsao
2898da50a6 weakref 2018-01-27 22:19:55 -08:00
Mike Tsao
6440523e45 pubkey method copies parent to newly generated public key 2018-01-22 20:50:50 -08:00
Michael Greene
51fe8f8864 #226 - fixed incomplete subkey revocation signature calculation 2017-11-14 14:06:04 -08:00
Michael Greene
72d9fcf9b0 - fixed parsing of User IDs that include multibyte utf-8 characters, with a more correct fallback codec 2017-11-09 08:53:59 -08:00
Michael Greene
9254da91d1 #228 - remove default armor header to avoid leaking unnecessary metadata 2017-11-09 08:48:21 -08:00
Antoine Beaupré
af3ef1aa69 add convenience accessor for revocation keys
It may not be obvious for users of the API that we can get the list of
revoker keys for a given key from the (private) _signature list, so
add a convenient accessor.

This is not really useful right now because it will raise a
NotImplementedError if any such signature is found, but will become
actually quite useful once #198 lands.

This is part of the process to make revocation checks easier in #225.
2017-11-08 18:16:48 -05:00
Michael Greene
d51063296f cleanup 2017-11-08 11:29:30 -08:00
Michael Greene
32d7e55641 Merge pull request #210 from J08nY/fix/key-copy-print
Fix bogus print in PGPKey.__copy__.
2017-11-08 11:27:48 -08:00
Michael Greene
80402eacc1 bump version for impending bugfix release 2017-11-07 17:52:53 -08:00
Michael Greene
ce1af91a34 #222 - added missing signature dispatch for EdDSA signatures
- added OpaqueSignature fallback
2017-11-07 17:51:16 -08:00
Michael Greene
3975f69aa7 #221 - added curve classes for X25519/Ed25519 so that PGPy can support it as soon as people obtain builds of OpenSSL that include support for them 2017-11-07 17:49:08 -08:00
Michael Greene
28920bc8b6 #217 - fix for six 1.11.0 2017-09-18 12:41:16 -07:00
J08nY
1525625ad1 Fix sigsubj.by to be a pgpy.PGPKey instance. Fixes #214. 2017-08-21 18:03:20 +02:00
Michael Greene
ca7ca6b24d bugfixen
- added missed call to _compute.chksum in ECDSAPriv
- replaced all gpg wrapper fixtures in the unit test suite with gpg package
- moved test suite gnupghome location to tests/gnupghome
2017-08-15 21:43:37 -07:00
Michael Greene
eb287e05c8 initial 0.5.0 version bump 2017-08-09 13:28:42 -07:00
J08nY
e9733da494 Add revocation_signatures property to PGPKey.
- Exposes the revocation signatures of the key(primary or sub).

> OpenPGP users may transfer public keys.  The essential elements of a
>   transferable public key are as follows:
>
>     - One Public-Key packet
>
>     - Zero or more revocation signatures
2017-08-07 17:13:36 +02:00
J08nY
2433d41add Add .revocation_reason attribute to PGPSignature. 2017-08-07 17:11:05 +02:00
J08nY
dd4eca7563 Add .signer_fingerprint property to PGPSignature.
- This returns the issuer fingerprint if the IssuerFingerprint
   subpacket is present, otherwise empty string.
2017-08-07 16:34:14 +02:00