diff options
author | Stephen Paul Weber <singpolyma@singpolyma.net> | 2012-04-27 14:42:24 -0500 |
---|---|---|
committer | Stephen Paul Weber <singpolyma@singpolyma.net> | 2012-04-27 14:42:24 -0500 |
commit | bca49f3b15fcb8d52fe9d67cd96d702fe06741b5 (patch) | |
tree | c216ccbc0855808bf3f80674a67cc395b04de942 | |
parent | 1a1258ace5b9ae959972c18184566bb689bd8575 (diff) |
TrustSignaturePacket
-rw-r--r-- | Arbitrary.patch | 12 | ||||
-rw-r--r-- | Data/OpenPGP.hs | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/Arbitrary.patch b/Arbitrary.patch index 28bd37e..e82de3d 100644 --- a/Arbitrary.patch +++ b/Arbitrary.patch | |||
@@ -19,14 +19,14 @@ | |||
19 | return (MPI x1) | 19 | return (MPI x1) |
20 | 20 | ||
21 | 21 | ||
22 | @@ -133,9 +132,8 @@ | 22 | @@ -135,9 +134,8 @@ |
23 | 3 -> do x1 <- arbitrary | ||
24 | x2 <- arbitrary | ||
25 | return (TrustSignaturePacket x1 x2) | 23 | return (TrustSignaturePacket x1 x2) |
26 | - 4 -> do x1 <- arbitrary | 24 | 4 -> do x1 <- arbitrary |
27 | + 4 -> do x1 <- fmap (map toUpper . (`showHex` "")) (arbitrary :: Gen Word64) | 25 | return (RegularExpressionPacket x1) |
26 | - 5 -> do x1 <- arbitrary | ||
27 | + 5 -> do x1 <- fmap (map toUpper . (`showHex` "")) (arbitrary :: Gen Word64) | ||
28 | return (IssuerPacket x1) | 28 | return (IssuerPacket x1) |
29 | 5 -> do x1 <- arbitrary | 29 | 6 -> do x1 <- arbitrary |
30 | - x2 <- arbitrary | 30 | - x2 <- arbitrary |
31 | - return (UnsupportedSignatureSubpacket x1 x2) | 31 | - return (UnsupportedSignatureSubpacket x1 x2) |
32 | + return (UnsupportedSignatureSubpacket 105 x1) | 32 | + return (UnsupportedSignatureSubpacket 105 x1) |
diff --git a/Data/OpenPGP.hs b/Data/OpenPGP.hs index 63d4dc1..1fc3192 100644 --- a/Data/OpenPGP.hs +++ b/Data/OpenPGP.hs | |||
@@ -658,6 +658,7 @@ data SignatureSubpacket = | |||
658 | SignatureExpirationTimePacket Word32 | -- seconds after CreationTime | 658 | SignatureExpirationTimePacket Word32 | -- seconds after CreationTime |
659 | ExportableCertificationPacket Bool | | 659 | ExportableCertificationPacket Bool | |
660 | TrustSignaturePacket {depth::Word8, trust::Word8} | | 660 | TrustSignaturePacket {depth::Word8, trust::Word8} | |
661 | RegularExpressionPacket String | | ||
661 | IssuerPacket String | | 662 | IssuerPacket String | |
662 | UnsupportedSignatureSubpacket Word8 B.ByteString | 663 | UnsupportedSignatureSubpacket Word8 B.ByteString |
663 | deriving (Show, Read, Eq) | 664 | deriving (Show, Read, Eq) |
@@ -699,6 +700,8 @@ put_signature_subpacket (ExportableCertificationPacket exportable) = | |||
699 | (encode $ enum_to_word8 exportable, 4) | 700 | (encode $ enum_to_word8 exportable, 4) |
700 | put_signature_subpacket (TrustSignaturePacket depth trust) = | 701 | put_signature_subpacket (TrustSignaturePacket depth trust) = |
701 | (B.concat [encode depth, encode trust], 5) | 702 | (B.concat [encode depth, encode trust], 5) |
703 | put_signature_subpacket (RegularExpressionPacket regex) = | ||
704 | (B.concat [B.fromString regex, B.singleton 0], 6) | ||
702 | put_signature_subpacket (IssuerPacket keyid) = | 705 | put_signature_subpacket (IssuerPacket keyid) = |
703 | (encode (fst $ head $ readHex keyid :: Word64), 16) | 706 | (encode (fst $ head $ readHex keyid :: Word64), 16) |
704 | put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = | 707 | put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = |
@@ -715,6 +718,9 @@ parse_signature_subpacket 4 = | |||
715 | -- TrustSignaturePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.13 | 718 | -- TrustSignaturePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.13 |
716 | parse_signature_subpacket 5 = | 719 | parse_signature_subpacket 5 = |
717 | liftM2 TrustSignaturePacket get get | 720 | liftM2 TrustSignaturePacket get get |
721 | -- TrustSignaturePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.14 | ||
722 | parse_signature_subpacket 6 = fmap | ||
723 | (RegularExpressionPacket . B.toString . B.init) getRemainingByteString | ||
718 | -- IssuerPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.5 | 724 | -- IssuerPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.5 |
719 | parse_signature_subpacket 16 = do | 725 | parse_signature_subpacket 16 = do |
720 | keyid <- get :: Get Word64 | 726 | keyid <- get :: Get Word64 |