diff options
author | Stephen Paul Weber <singpolyma@singpolyma.net> | 2012-04-27 15:01:47 -0500 |
---|---|---|
committer | Stephen Paul Weber <singpolyma@singpolyma.net> | 2012-04-27 15:01:47 -0500 |
commit | bb537f6275d9c83ed11ab477eefdb33ccb38428f (patch) | |
tree | eae6168c91510cbda9ec281f64631d8299b579df | |
parent | cb2a5013f8c831591841404cb4a7c8201c522ad2 (diff) |
RevocablePacket
-rw-r--r-- | Arbitrary.patch | 14 | ||||
-rw-r--r-- | Data/OpenPGP.hs | 6 |
2 files changed, 11 insertions, 9 deletions
diff --git a/Arbitrary.patch b/Arbitrary.patch index e82de3d..b003906 100644 --- a/Arbitrary.patch +++ b/Arbitrary.patch | |||
@@ -19,15 +19,11 @@ | |||
19 | return (MPI x1) | 19 | return (MPI x1) |
20 | 20 | ||
21 | 21 | ||
22 | @@ -135,9 +134,8 @@ | 22 | _ -> error "FATAL ERROR: Arbitrary instance, logic bug" |
23 | return (TrustSignaturePacket x1 x2) | 23 | @@ -140 +139 @@ |
24 | 4 -> do x1 <- arbitrary | 24 | - 6 -> do x1 <- arbitrary |
25 | return (RegularExpressionPacket x1) | 25 | + 6 -> do x1 <- fmap (map toUpper . (`showHex` "")) (arbitrary :: Gen Word64) |
26 | - 5 -> do x1 <- arbitrary | 26 | @@ -143,2 +142 @@ |
27 | + 5 -> do x1 <- fmap (map toUpper . (`showHex` "")) (arbitrary :: Gen Word64) | ||
28 | return (IssuerPacket x1) | ||
29 | 6 -> do x1 <- arbitrary | ||
30 | - x2 <- arbitrary | 27 | - x2 <- arbitrary |
31 | - return (UnsupportedSignatureSubpacket x1 x2) | 28 | - return (UnsupportedSignatureSubpacket x1 x2) |
32 | + return (UnsupportedSignatureSubpacket 105 x1) | 29 | + return (UnsupportedSignatureSubpacket 105 x1) |
33 | _ -> error "FATAL ERROR: Arbitrary instance, logic bug" | ||
diff --git a/Data/OpenPGP.hs b/Data/OpenPGP.hs index 68c3d51..b9a4836 100644 --- a/Data/OpenPGP.hs +++ b/Data/OpenPGP.hs | |||
@@ -659,6 +659,7 @@ data SignatureSubpacket = | |||
659 | ExportableCertificationPacket Bool | | 659 | ExportableCertificationPacket Bool | |
660 | TrustSignaturePacket {depth::Word8, trust::Word8} | | 660 | TrustSignaturePacket {depth::Word8, trust::Word8} | |
661 | RegularExpressionPacket String | | 661 | RegularExpressionPacket String | |
662 | RevocablePacket Bool | | ||
662 | IssuerPacket String | | 663 | IssuerPacket String | |
663 | UnsupportedSignatureSubpacket Word8 B.ByteString | 664 | UnsupportedSignatureSubpacket Word8 B.ByteString |
664 | deriving (Show, Read, Eq) | 665 | deriving (Show, Read, Eq) |
@@ -702,6 +703,8 @@ put_signature_subpacket (TrustSignaturePacket depth trust) = | |||
702 | (B.concat [encode depth, encode trust], 5) | 703 | (B.concat [encode depth, encode trust], 5) |
703 | put_signature_subpacket (RegularExpressionPacket regex) = | 704 | put_signature_subpacket (RegularExpressionPacket regex) = |
704 | (B.concat [B.fromString regex, B.singleton 0], 6) | 705 | (B.concat [B.fromString regex, B.singleton 0], 6) |
706 | put_signature_subpacket (RevocablePacket exportable) = | ||
707 | (encode $ enum_to_word8 exportable, 7) | ||
705 | put_signature_subpacket (IssuerPacket keyid) = | 708 | put_signature_subpacket (IssuerPacket keyid) = |
706 | (encode (fst $ head $ readHex keyid :: Word64), 16) | 709 | (encode (fst $ head $ readHex keyid :: Word64), 16) |
707 | put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = | 710 | put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = |
@@ -720,6 +723,9 @@ parse_signature_subpacket 5 = liftM2 TrustSignaturePacket get get | |||
720 | -- TrustSignaturePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.14 | 723 | -- TrustSignaturePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.14 |
721 | parse_signature_subpacket 6 = fmap | 724 | parse_signature_subpacket 6 = fmap |
722 | (RegularExpressionPacket . B.toString . B.init) getRemainingByteString | 725 | (RegularExpressionPacket . B.toString . B.init) getRemainingByteString |
726 | -- RevocablePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.12 | ||
727 | parse_signature_subpacket 7 = | ||
728 | fmap (RevocablePacket . enum_from_word8) get | ||
723 | -- IssuerPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.5 | 729 | -- IssuerPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.5 |
724 | parse_signature_subpacket 16 = do | 730 | parse_signature_subpacket 16 = do |
725 | keyid <- get :: Get Word64 | 731 | keyid <- get :: Get Word64 |