summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Paul Weber <singpolyma@singpolyma.net>2012-04-27 15:24:07 -0500
committerStephen Paul Weber <singpolyma@singpolyma.net>2012-04-27 15:24:07 -0500
commitd0cbb7b8d6525466edcfeebe8fc06e69f1fbcf1b (patch)
tree8f80a8e30dae6fab67417611eebcbfd262a6b1e9
parent26f1db51b6146ee09a119113506dc8f58559fbcf (diff)
PreferredSymmetricAlgorithmsPacket
-rw-r--r--Arbitrary.patch4
-rw-r--r--Data/OpenPGP.hs6
2 files changed, 8 insertions, 2 deletions
diff --git a/Arbitrary.patch b/Arbitrary.patch
index 6d855f1..8de13ad 100644
--- a/Arbitrary.patch
+++ b/Arbitrary.patch
@@ -30,8 +30,8 @@
30 30
31 _ -> error "FATAL ERROR: Arbitrary instance, logic bug" 31 _ -> error "FATAL ERROR: Arbitrary instance, logic bug"
32@@ -140 +139 @@ 32@@ -140 +139 @@
33- 7 -> do x1 <- arbitrary 33- 8 -> do x1 <- arbitrary
34+ 7 -> do x1 <- fmap (map toUpper . (`showHex` "")) (arbitrary :: Gen Word64) 34+ 8 -> do x1 <- fmap (map toUpper . (`showHex` "")) (arbitrary :: Gen Word64)
35@@ -143,2 +142 @@ 35@@ -143,2 +142 @@
36- x2 <- arbitrary 36- x2 <- arbitrary
37- return (UnsupportedSignatureSubpacket x1 x2) 37- return (UnsupportedSignatureSubpacket x1 x2)
diff --git a/Data/OpenPGP.hs b/Data/OpenPGP.hs
index 878fb99..3534ccf 100644
--- a/Data/OpenPGP.hs
+++ b/Data/OpenPGP.hs
@@ -691,6 +691,7 @@ data SignatureSubpacket =
691 RegularExpressionPacket String | 691 RegularExpressionPacket String |
692 RevocablePacket Bool | 692 RevocablePacket Bool |
693 KeyExpirationTimePacket Word32 | -- seconds after key CreationTime 693 KeyExpirationTimePacket Word32 | -- seconds after key CreationTime
694 PreferredSymmetricAlgorithmsPacket [SymmetricAlgorithm] |
694 IssuerPacket String | 695 IssuerPacket String |
695 UnsupportedSignatureSubpacket Word8 B.ByteString 696 UnsupportedSignatureSubpacket Word8 B.ByteString
696 deriving (Show, Read, Eq) 697 deriving (Show, Read, Eq)
@@ -738,6 +739,8 @@ put_signature_subpacket (RevocablePacket exportable) =
738 (encode $ enum_to_word8 exportable, 7) 739 (encode $ enum_to_word8 exportable, 7)
739put_signature_subpacket (KeyExpirationTimePacket time) = 740put_signature_subpacket (KeyExpirationTimePacket time) =
740 (encode time, 9) 741 (encode time, 9)
742put_signature_subpacket (PreferredSymmetricAlgorithmsPacket algos) =
743 (B.concat $ map encode algos, 11)
741put_signature_subpacket (IssuerPacket keyid) = 744put_signature_subpacket (IssuerPacket keyid) =
742 (encode (fst $ head $ readHex keyid :: Word64), 16) 745 (encode (fst $ head $ readHex keyid :: Word64), 16)
743put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = 746put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) =
@@ -761,6 +764,9 @@ parse_signature_subpacket 7 =
761 fmap (RevocablePacket . enum_from_word8) get 764 fmap (RevocablePacket . enum_from_word8) get
762-- KeyExpirationTimePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.6 765-- KeyExpirationTimePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.6
763parse_signature_subpacket 9 = fmap KeyExpirationTimePacket get 766parse_signature_subpacket 9 = fmap KeyExpirationTimePacket get
767-- KeyExpirationTimePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.6
768parse_signature_subpacket 11 =
769 fmap PreferredSymmetricAlgorithmsPacket listUntilEnd
764-- IssuerPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.5 770-- IssuerPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.5
765parse_signature_subpacket 16 = do 771parse_signature_subpacket 16 = do
766 keyid <- get :: Get Word64 772 keyid <- get :: Get Word64