From: W. Trevor King Date: Fri, 20 Dec 2013 22:02:51 +0000 (-0800) Subject: Add preferred hash algorithm signature subpacket parsing to PGPPacket X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=380989d61a8de9505cd8f0818f88fb9075129042;p=gpg-migrate.git Add preferred hash algorithm signature subpacket parsing to PGPPacket From RFC 4880 [1]: (array of one-octet values) Message digest algorithm numbers that indicate which algorithms the key holder prefers to receive. Like the preferred symmetric algorithms, the list is ordered. Algorithm numbers are in Section 9. This is only found on a self-signature. [1]: http://tools.ietf.org/search/rfc4880#section-5.2.3.8 --- diff --git a/gpg-migrate.py b/gpg-migrate.py index a1dbb7a..782fa4e 100755 --- a/gpg-migrate.py +++ b/gpg-migrate.py @@ -297,6 +297,11 @@ class PGPPacket (dict): return ', '.join( algo for algo in subpacket['preferred-symmetric-algorithms']) + def _str_preferred_hash_algorithms_signature_subpacket( + self, subpacket): + return ', '.join( + algo for algo in subpacket['preferred-hash-algorithms']) + def _str_key_flags_signature_subpacket(self, subpacket): return ', '.join(x for x in sorted(subpacket['key-flags'])) @@ -561,6 +566,11 @@ class PGPPacket (dict): subpacket['preferred-symmetric-algorithms'] = [ self._symmetric_key_algorithms[d] for d in data] + def _parse_preferred_hash_algorithms_signature_subpacket( + self, data, subpacket): + subpacket['preferred-hash-algorithms'] = [ + self._hash_algorithms[d] for d in data] + def _parse_key_flags_signature_subpacket(self, data, subpacket): subpacket['key-flags'] = set() if data[0] & 0x1: