From: W. Trevor King Date: Fri, 20 Dec 2013 18:09:23 +0000 (-0800) Subject: Add iterated and salted S2K parsing to _parse_string_to_key_specifier X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fdc688a4e3b58bad40a49ae03d116d681bc04b75;p=gpg-migrate.git Add iterated and salted S2K parsing to _parse_string_to_key_specifier From RFC 4880 [1]: Octet 0: 0x03 Octet 1: hash algorithm Octets 2-9: 8-octet salt value Octet 10: count, a one-octet, coded value [1]: http://tools.ietf.org/search/rfc4880#section-3.7.1.3 --- diff --git a/gpg-migrate.py b/gpg-migrate.py index 9be8e86..7fea58d 100755 --- a/gpg-migrate.py +++ b/gpg-migrate.py @@ -236,6 +236,14 @@ class PGPPacket (dict): offset += 1 self['string-to-key-salt'] = data[offset: offset + 8] offset += 8 + elif self['string-to-key-type'] == 'iterated and salted': + self['string-to-key-hash-algorithm'] = self._hash_algorithms[ + data[offset]] + offset += 1 + self['string-to-key-salt'] = data[offset: offset + 8] + offset += 8 + self['string-to-key-coded-count'] = data[offset] + offset += 1 else: raise NotImplementedError( 'string-to-key type {}'.format(self['string-to-key-type']))