summaryrefslogtreecommitdiff
path: root/Data
diff options
context:
space:
mode:
authorStephen Paul Weber <singpolyma@singpolyma.net>2012-04-30 08:50:45 -0500
committerStephen Paul Weber <singpolyma@singpolyma.net>2012-04-30 08:50:45 -0500
commit0850e09ef537bc5ba883df371e5f6c68e573b2a2 (patch)
tree09f6f5d8c1c00ed863a0e190afcd5b93d7d79d44 /Data
parent8e71ed177f024c0f3019853ba79a1cf8c3efa5c3 (diff)
FeaturesPacket
Diffstat (limited to 'Data')
-rw-r--r--Data/OpenPGP.hs10
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)
841put_signature_subpacket (ReasonForRevocationPacket code string) = 842put_signature_subpacket (ReasonForRevocationPacket code string) =
842 (B.concat [encode code, B.fromString string], 29) 843 (B.concat [encode code, B.fromString string], 29)
844put_signature_subpacket (FeaturesPacket supports_mdc) =
845 (B.singleton $ if supports_mdc then 0x01 else 0x00, 30)
843put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = 846put_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
943parse_signature_subpacket 29 = liftM2 ReasonForRevocationPacket get 946parse_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
949parse_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
946parse_signature_subpacket tag = 956parse_signature_subpacket tag =
947 fmap (UnsupportedSignatureSubpacket tag) getRemainingByteString 957 fmap (UnsupportedSignatureSubpacket tag) getRemainingByteString