Skip to content
Open
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
23 changes: 12 additions & 11 deletions pgpdump/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class AlgoLookup(object):
19: "ECDSA",
20: "Formerly ElGamal Encrypt or Sign",
21: "Diffie-Hellman",
22: "EdDSA",
}

@classmethod
Expand Down Expand Up @@ -143,6 +144,7 @@ def __init__(self, raw, hashed, data):
30: "Features",
31: "Signature Target",
32: "Embedded Signature",
33: "Issuer Fingerprint",
}

@property
Expand Down Expand Up @@ -172,6 +174,8 @@ def __init__(self, *args, **kwargs):
self.raw_expiration_time = None
self.expiration_time = None
self.key_id = None
self.fingerprint = None
self.fingerprint_version = None
self.hash2 = None
self.subpackets = []
super(SignaturePacket, self).__init__(*args, **kwargs)
Expand Down Expand Up @@ -275,6 +279,9 @@ def parse_subpackets(self, outer_offset, outer_length, hashed=False):
self.raw_expiration_time = get_int4(subpacket.data, 0)
elif subpacket.subtype == 16:
self.key_id = get_key_id(subpacket.data, 0)
elif subpacket.subtype == 33:
self.fingerprint_version = int(subpacket.data[0])
self.fingerprint = get_hex_data(subpacket.data, 1, len(subpacket.data))
offset += sub_len
self.subpackets.append(subpacket)

Expand Down Expand Up @@ -420,12 +427,9 @@ def parse_key_material(self, offset):
self.prime, offset = get_mpi(self.data, offset)
self.group_gen, offset = get_mpi(self.data, offset)
self.key_value, offset = get_mpi(self.data, offset)
elif 100 <= self.raw_pub_algorithm <= 110:
# Private/Experimental algorithms, just move on
pass
else:
raise PgpdumpException("Unsupported public key algorithm %d" %
self.raw_pub_algorithm)
# If we don't know how to handle the algorithm, just move on
pass

return offset

Expand Down Expand Up @@ -578,7 +582,7 @@ def parse(self):
"Unsupported GnuPG S2K extension, encountered mode %d" % mode)
else:
raise PgpdumpException(
"Unsupported public key algorithm %d" % s2k_type_id)
"Unsupported S2K algorithm %d" % s2k_type_id)

if s2k_length != (offset - offset_before_s2k):
raise PgpdumpException(
Expand Down Expand Up @@ -609,12 +613,9 @@ def parse_private_key_material(self, offset):
self.pub_algorithm_type = "elg"
# x
self.exponent_x, offset = get_mpi(self.data, offset)
elif 100 <= self.raw_pub_algorithm <= 110:
# Private/Experimental algorithms, just move on
pass
else:
raise PgpdumpException("Unsupported public key algorithm %d" %
self.raw_pub_algorithm)
# If we don't know how to handle the algorithm, just move on
pass

return offset

Expand Down