From 1e97c0b23cf96110e0c9ba3f9776dbb4b278bfd7 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Sat, 16 May 2020 08:18:11 -0400 Subject: Parse v5 signatures (draft-ietf-openpgp-rfc4880bis-09). --- Data/OpenPGP.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Data/OpenPGP.hs b/Data/OpenPGP.hs index 598fe75..a151e7b 100644 --- a/Data/OpenPGP.hs +++ b/Data/OpenPGP.hs @@ -696,7 +696,7 @@ parse_packet 2 = do signature = signature, trailer = B.concat [encode signature_type, encode creation_time] } - 4 -> do + x | x==4 || x==5 -> do signature_type <- get key_algorithm <- get hash_algorithm <- get @@ -724,8 +724,10 @@ parse_packet 2 = do , encode hash_algorithm , encode (fromIntegral hashed_size :: Word16) , hashed_data - , B.pack [4 , 0xff] - , encode ((6 + fromIntegral hashed_size) :: Word32)] + , B.pack [version , 0xff] + , if version==4 + then encode ((6 + fromIntegral hashed_size) :: Word32) + else encode ((6 + fromIntegral hashed_size) :: Word64)] } x -> fail $ "Unknown SignaturePacket version " ++ show x ++ "." -- SymmetricSessionKeyPacket, http://tools.ietf.org/html/rfc4880#section-5.3 -- cgit v1.2.3