Check the secret key checksum in PGPPacket._parse_generic_secret_key_packet
authorW. Trevor King <wking@tremily.us>
Sat, 21 Dec 2013 02:34:41 +0000 (18:34 -0800)
committerW. Trevor King <wking@tremily.us>
Mon, 23 Dec 2013 02:32:15 +0000 (18:32 -0800)
commit9a03857e0eee9568be70dd7e18dea0aeddb17a01
treebe0d3134560f38e8c0024400333674d2df2c62f1
parent856e518e7b540ad2f8ca42c9a8a013586d26a1a9
Check the secret key checksum in PGPPacket._parse_generic_secret_key_packet

From RFC 4880 [1]:

  - If the string-to-key usage octet is zero or 255, then a two-octet
    checksum of the plaintext of the algorithm-specific portion (sum
    of all octets, mod 65536).  If the string-to-key usage octet was
    254, then a 20-octet SHA-1 hash of the plaintext of the
    algorithm-specific portion.  This checksum or hash is encrypted
    together with the algorithm-specific fields (if string-to-key
    usage octet is not zero).  Note that for all other values, a
    two-octet checksum is required.

[1]: section 5.5.3
gpg-migrate.py