Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions gnupg/_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,9 @@ def key(self, args):
pub = sec = key

def fpr(self, args):
if self.curuid == None:
return

self.curkey['fingerprint'] = args[9]
self.fingerprints.append(args[9])

Expand All @@ -1014,6 +1017,9 @@ def uid(self, args):
self.uids.append(uid)

def sig(self, args):
if self.curuid == None:
return

vars = ("""
type trust length algo keyid date expires dummy ownertrust uid
""").split()
Expand All @@ -1027,6 +1033,9 @@ def sub(self, args):
subkey = [args[4], args[11]]
self.curkey['subkeys'].append(subkey)

def rvk(self, args):
self.curuid == None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this revocation key packet in your error example at #158.

Why are you reseting the curuid when you find a revocation key?

Copy link
Owner

@isislovecruft isislovecruft Dec 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the revocation packet is on a different UID, at the very end:

rev:::1:C0A2586F09D77C82:1471422777::::heartsucker <heartsucker@autistici.org>:28x:::::10:

But I still don't understand why one would reset curuid…

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My assumption is that this line is a typo, it should be

 if self.curuid == None:
            return

like in the other lines.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember why I reset curuid, but that fixed the problem at the time. I'm trying to get back and understand what I did and why.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isislovecruft @meskio Ok, I remember what happened here. In the original issue, I posted the output of what I thought was the key that was causing the problem.

However, the problem (I think) was that the key before the one that was erring out had either a) no subkeys and one revocation cert or b) the last key was revoked. This did something like causing the next key to be parsed to attempt to access a dict member that was based off a key that didn't exist.

Because this was something I was doing at an old job, I don't have access to the key in question to share the output (and it may have changed since then anyway).


def _handle_status(self, key, value):
pass

Expand Down
2 changes: 1 addition & 1 deletion gnupg/gnupg.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def list_sigs(self, *keyids):
def _parse_keys(self, result):
lines = result.data.decode(self._encoding,
self._decode_errors).splitlines()
valid_keywords = 'pub uid sec fpr sub sig'.split()
valid_keywords = 'pub uid sec fpr sub sig rvk'.split()
for line in lines:
if self.verbose:
print(line)
Expand Down