diff options
author | Stephen Paul Weber <singpolyma@singpolyma.net> | 2012-04-30 08:50:45 -0500 |
---|---|---|
committer | Stephen Paul Weber <singpolyma@singpolyma.net> | 2012-04-30 08:50:45 -0500 |
commit | 0850e09ef537bc5ba883df371e5f6c68e573b2a2 (patch) | |
tree | 09f6f5d8c1c00ed863a0e190afcd5b93d7d79d44 /Data | |
parent | 8e71ed177f024c0f3019853ba79a1cf8c3efa5c3 (diff) |
FeaturesPacket
Diffstat (limited to 'Data')
-rw-r--r-- | Data/OpenPGP.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Data/OpenPGP.hs b/Data/OpenPGP.hs index 4bbaf84..e83d874 100644 --- a/Data/OpenPGP.hs +++ b/Data/OpenPGP.hs | |||
@@ -743,6 +743,7 @@ data SignatureSubpacket = | |||
743 | } | | 743 | } | |
744 | SignerUserIDPacket String | | 744 | SignerUserIDPacket String | |
745 | ReasonForRevocationPacket RevocationCode String | | 745 | ReasonForRevocationPacket RevocationCode String | |
746 | FeaturesPacket {supports_mdc::Bool} | | ||
746 | UnsupportedSignatureSubpacket Word8 B.ByteString | 747 | UnsupportedSignatureSubpacket Word8 B.ByteString |
747 | deriving (Show, Read, Eq) | 748 | deriving (Show, Read, Eq) |
748 | 749 | ||
@@ -840,6 +841,8 @@ put_signature_subpacket (SignerUserIDPacket userid) = | |||
840 | (B.fromString userid, 28) | 841 | (B.fromString userid, 28) |
841 | put_signature_subpacket (ReasonForRevocationPacket code string) = | 842 | put_signature_subpacket (ReasonForRevocationPacket code string) = |
842 | (B.concat [encode code, B.fromString string], 29) | 843 | (B.concat [encode code, B.fromString string], 29) |
844 | put_signature_subpacket (FeaturesPacket supports_mdc) = | ||
845 | (B.singleton $ if supports_mdc then 0x01 else 0x00, 30) | ||
843 | put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = | 846 | put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = |
844 | (bytes, tag) | 847 | (bytes, tag) |
845 | 848 | ||
@@ -942,6 +945,13 @@ parse_signature_subpacket 28 = | |||
942 | -- ReasonForRevocationPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.23 | 945 | -- ReasonForRevocationPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.23 |
943 | parse_signature_subpacket 29 = liftM2 ReasonForRevocationPacket get | 946 | parse_signature_subpacket 29 = liftM2 ReasonForRevocationPacket get |
944 | (fmap B.toString getRemainingByteString) | 947 | (fmap B.toString getRemainingByteString) |
948 | -- FeaturesPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.24 | ||
949 | parse_signature_subpacket 30 = do | ||
950 | empty <- isEmpty | ||
951 | flag1 <- if empty then return 0 else get :: Get Word8 | ||
952 | return $ FeaturesPacket { | ||
953 | supports_mdc = flag1 .&. 0x01 == 0x01 | ||
954 | } | ||
945 | -- Represent unsupported packets as their tag and literal bytes | 955 | -- Represent unsupported packets as their tag and literal bytes |
946 | parse_signature_subpacket tag = | 956 | parse_signature_subpacket tag = |
947 | fmap (UnsupportedSignatureSubpacket tag) getRemainingByteString | 957 | fmap (UnsupportedSignatureSubpacket tag) getRemainingByteString |