From 3791e352ecf87c88ecad105fd6322d92aa45fe68 Mon Sep 17 00:00:00 2001 From: "rmlibre@riseup.net" Date: Wed, 18 Dec 2019 23:38:48 -0500 Subject: [PATCH] v0.5.1 update - fixed packet parser bug that ignored legacy keys --- tiny_gnupg/tiny_gnupg.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tiny_gnupg/tiny_gnupg.py b/tiny_gnupg/tiny_gnupg.py index c30df3a..8379b80 100644 --- a/tiny_gnupg/tiny_gnupg.py +++ b/tiny_gnupg/tiny_gnupg.py @@ -351,14 +351,17 @@ def packet_fingerprint(self, target=""): gpg message, key or signature. """ try: - size = slice(-41, -1) - sentinel = "(issuer fpr v4" - packets = self.raw_packets(target).split("\n\t") + packets = self.raw_packets(target).replace(")", "") except KeyError as exception: + packets = exception.output.replace(")", "") + packets = packets.replace("key ID", "keyid") + if "issuer fpr" in packets: + size = slice(-40, None) + sentinel = "(issuer fpr " + else: sentinel = "keyid " size = slice(-16, None) - packets = exception.output.split("\n\t") - for packet in packets: + for packet in packets.split("\n\t"): if sentinel in packet: return packet[size]