Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaner errors #22

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Cleaner errors #22

wants to merge 11 commits into from

Conversation

dkg
Copy link

@dkg dkg commented Sep 16, 2019

This series of changes does significantly more error checking, and tries to avoid arbitrary exceptions being thrown when handling malformed data.

It also permits the user to use the system logging module when parsing a stream of packets to log malformed packets rather than raising an exception during the generation.

Part of this cleanup also involves identifying new algorithms and packet types.

dkg added 11 commits March 2, 2018 09:38
If we're OK with "passing" on experimental algorithms, we should be ok
with passing on known algorithms that we know the name of but don't
implement.
The issuer fingerprint effectively supercedes issuer keyID as a more
robust signal of the issuer (though it's possible and in some cases
likely to include both in a signature, to ensure that it's understood
by old and new code).
Some malformed MPIs will cause a failure in packet parsing; this is an
OpenPGP formatting error, so we should raise it explicitly.

Below is an example packet (found on the SKS keyserver network) that
has a malformed MPI.

-----BEGIN PGP PUBLIC KEY BLOCK-----

mQGiBEhFwD0RBAC8mLriGM4hMjV4ePeBD+FoqB/ENCXbLgl1vAvB3ha/HxqVeH1o
w8HdYiSHykreflEqH31fxJv1xFgQ87sf21jv/8TeR0LeXnx7eEIF+uhDHWiZIr4q
+EfrzIkpC9+yyo5XaveqNqiSOcnBH2aq334L80/2LR++7J2ffZHgWVfKDtsofE6L
XfmOPAwT7R06+po2VnFjlwsD/jXgG6rkjwJZn/VhibcifIms66Fp/RYCXZp9mCeS
pADN7i+7VwwCjaME3ndQu/KMdMqSzfHsWJFJbycjN5MK49vxXZyz+cGblcKmZH3V
CKwC2iVVRP5FJe+ZLaqmEt/qbyjstXimWUYaJkQkD3lPz+7NfVhIXa0tlE2UcL+7
A5ghA/9+GZu0eFtV7OokUuyPHcfQDQWLh+nuJP7bVSepo9Gy4c0SCYyKlHf+e+A3
qIF76+1Gj7IvVEY8fcC0APzGad9Y0WELSTNcZ4+UqW3Ezag1k7Yq5F0VycZ2LTIC
9nF3UsjKgUxWehbkrNz9NRx9v7ktxS0f2N43dEQIffab3rPqMw==
=V948
-----END PGP PUBLIC KEY BLOCK-----

Signed-off-by: Daniel Kahn Gillmor <[email protected]>

fix up mpi error

Signed-off-by: Daniel Kahn Gillmor <[email protected]>
Each malformed packet skipped will generate a warning with the python
logging module, but the stream will continue to return any subsequent
well-formed packets as it is encountered.

Signed-off-by: Daniel Kahn Gillmor <[email protected]>
Signed-off-by: Daniel Kahn Gillmor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant