diff options
author | Stephen Paul Weber <singpolyma@singpolyma.net> | 2012-04-27 16:13:41 -0500 |
---|---|---|
committer | Stephen Paul Weber <singpolyma@singpolyma.net> | 2012-04-27 16:13:41 -0500 |
commit | ca2ff90effdda221e16a201071d5fef0110596be (patch) | |
tree | 1b48be19d521eef85eaf554e93d817be65dca768 /Data | |
parent | d0cbb7b8d6525466edcfeebe8fc06e69f1fbcf1b (diff) |
pad keyids with 0 on the left
Diffstat (limited to 'Data')
-rw-r--r-- | Data/OpenPGP.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Data/OpenPGP.hs b/Data/OpenPGP.hs index 3534ccf..90450f5 100644 --- a/Data/OpenPGP.hs +++ b/Data/OpenPGP.hs | |||
@@ -419,9 +419,11 @@ parse_packet 4 = do | |||
419 | signature_type = signature_type, | 419 | signature_type = signature_type, |
420 | hash_algorithm = hash_algo, | 420 | hash_algorithm = hash_algo, |
421 | key_algorithm = key_algo, | 421 | key_algorithm = key_algo, |
422 | key_id = map toUpper $ showHex key_id "", | 422 | key_id = pad $ map toUpper $ showHex key_id "", |
423 | nested = nested | 423 | nested = nested |
424 | } | 424 | } |
425 | where | ||
426 | pad s = replicate (16 - length s) '0' ++ s | ||
425 | -- SecretKeyPacket, http://tools.ietf.org/html/rfc4880#section-5.5.3 | 427 | -- SecretKeyPacket, http://tools.ietf.org/html/rfc4880#section-5.5.3 |
426 | parse_packet 5 = do | 428 | parse_packet 5 = do |
427 | -- Parse PublicKey part | 429 | -- Parse PublicKey part |
@@ -770,7 +772,9 @@ parse_signature_subpacket 11 = | |||
770 | -- IssuerPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.5 | 772 | -- IssuerPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.5 |
771 | parse_signature_subpacket 16 = do | 773 | parse_signature_subpacket 16 = do |
772 | keyid <- get :: Get Word64 | 774 | keyid <- get :: Get Word64 |
773 | return $ IssuerPacket (map toUpper $ showHex keyid "") | 775 | return $ IssuerPacket (pad $ map toUpper $ showHex keyid "") |
776 | where | ||
777 | pad s = replicate (16 - length s) '0' ++ s | ||
774 | -- Represent unsupported packets as their tag and literal bytes | 778 | -- Represent unsupported packets as their tag and literal bytes |
775 | parse_signature_subpacket tag = | 779 | parse_signature_subpacket tag = |
776 | fmap (UnsupportedSignatureSubpacket tag) getRemainingByteString | 780 | fmap (UnsupportedSignatureSubpacket tag) getRemainingByteString |