summaryrefslogtreecommitdiff
path: root/Data
diff options
context:
space:
mode:
authorStephen Paul Weber <singpolyma@singpolyma.net>2012-04-30 08:50:57 -0500
committerStephen Paul Weber <singpolyma@singpolyma.net>2012-04-30 08:50:57 -0500
commit7f3399b05626d1e7fb35a615702810e37781f83b (patch)
treeefc2213e1c881d26305b8dfe4002d8b5a184b339 /Data
parent0850e09ef537bc5ba883df371e5f6c68e573b2a2 (diff)
SignatureTargetPacket
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 e83d874..ea0d19f 100644
--- a/Data/OpenPGP.hs
+++ b/Data/OpenPGP.hs
@@ -744,6 +744,11 @@ data SignatureSubpacket =
744 SignerUserIDPacket String | 744 SignerUserIDPacket String |
745 ReasonForRevocationPacket RevocationCode String | 745 ReasonForRevocationPacket RevocationCode String |
746 FeaturesPacket {supports_mdc::Bool} | 746 FeaturesPacket {supports_mdc::Bool} |
747 SignatureTargetPacket {
748 target_key_algorithm::KeyAlgorithm,
749 target_hash_algorithm::HashAlgorithm,
750 hash::B.ByteString
751 } |
747 UnsupportedSignatureSubpacket Word8 B.ByteString 752 UnsupportedSignatureSubpacket Word8 B.ByteString
748 deriving (Show, Read, Eq) 753 deriving (Show, Read, Eq)
749 754
@@ -843,6 +848,8 @@ put_signature_subpacket (ReasonForRevocationPacket code string) =
843 (B.concat [encode code, B.fromString string], 29) 848 (B.concat [encode code, B.fromString string], 29)
844put_signature_subpacket (FeaturesPacket supports_mdc) = 849put_signature_subpacket (FeaturesPacket supports_mdc) =
845 (B.singleton $ if supports_mdc then 0x01 else 0x00, 30) 850 (B.singleton $ if supports_mdc then 0x01 else 0x00, 30)
851put_signature_subpacket (SignatureTargetPacket kalgo halgo hash) =
852 (B.concat [encode kalgo, encode halgo, hash], 31)
846put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = 853put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) =
847 (bytes, tag) 854 (bytes, tag)
848 855
@@ -952,6 +959,9 @@ parse_signature_subpacket 30 = do
952 return $ FeaturesPacket { 959 return $ FeaturesPacket {
953 supports_mdc = flag1 .&. 0x01 == 0x01 960 supports_mdc = flag1 .&. 0x01 == 0x01
954 } 961 }
962-- SignatureTargetPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.25
963parse_signature_subpacket 31 =
964 liftM3 SignatureTargetPacket get get getRemainingByteString
955-- Represent unsupported packets as their tag and literal bytes 965-- Represent unsupported packets as their tag and literal bytes
956parse_signature_subpacket tag = 966parse_signature_subpacket tag =
957 fmap (UnsupportedSignatureSubpacket tag) getRemainingByteString 967 fmap (UnsupportedSignatureSubpacket tag) getRemainingByteString