summaryrefslogtreecommitdiff
path: root/Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs
diff options
context:
space:
mode:
authorClint Adams <clint@softwarefreedom.org>2012-04-04 10:59:00 -0400
committerClint Adams <clint@softwarefreedom.org>2012-04-04 10:59:00 -0400
commitf907d986330ac5f88f9e921bdd6c0572d4691003 (patch)
treef9b261cd77f03157f2a15bb8f2b1ac3abd15a2cb /Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs
parente4a8fe59707fc33ef26e1ca1dec4299a0d7ba6bf (diff)
Add newtype wrapper for lists for the purpose of avoiding the cereal instance.
Diffstat (limited to 'Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs')
-rw-r--r--Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs b/Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs
index 2383ff3..64f7236 100644
--- a/Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs
+++ b/Codec/Encryption/OpenPGP/ASCIIArmor/Decode.hs
@@ -9,7 +9,7 @@ module Codec.Encryption.OpenPGP.ASCIIArmor.Decode (
9 , decodeArmor 9 , decodeArmor
10) where 10) where
11 11
12import Codec.Encryption.OpenPGP.Serialize (getPackets) 12import Codec.Encryption.OpenPGP.Serialize ()
13import Codec.Encryption.OpenPGP.Types 13import Codec.Encryption.OpenPGP.Types
14import Control.Applicative (many, (<|>), (<$>)) 14import Control.Applicative (many, (<|>), (<$>))
15import Data.Attoparsec.ByteString (Parser, many1, string, inClass, notInClass, satisfy, word8, (<?>), parse, IResult(..)) 15import Data.Attoparsec.ByteString (Parser, many1, string, inClass, notInClass, satisfy, word8, (<?>), parse, IResult(..))
@@ -20,6 +20,7 @@ import qualified Data.ByteString as B
20import qualified Data.ByteString.Char8 as BC8 20import qualified Data.ByteString.Char8 as BC8
21import qualified Data.ByteString.Base64 as Base64 21import qualified Data.ByteString.Base64 as Base64
22import Data.Digest.CRC24 (crc24) 22import Data.Digest.CRC24 (crc24)
23import Data.Serialize (get)
23import Data.Serialize.Get (Get, runGet, getWord8) 24import Data.Serialize.Get (Get, runGet, getWord8)
24import Data.Serialize.Put (runPut, putWord32be) 25import Data.Serialize.Put (runPut, putWord32be)
25import Data.String (IsString, fromString) 26import Data.String (IsString, fromString)
@@ -38,9 +39,9 @@ parseArmor = do
38 blankishLine <?> "blank line" 39 blankishLine <?> "blank line"
39 payload <- base64Data <?> "base64 data" 40 payload <- base64Data <?> "base64 data"
40 endLine atype <?> "end line" 41 endLine atype <?> "end line"
41 case runGet getPackets payload of 42 case runGet get payload of
42 Left err -> fail err 43 Left err -> fail err
43 Right packets -> return $ Armor atype headers packets 44 Right packets -> return $ Armor atype headers (unBlock packets)
44 45
45beginLine :: (Integral a, Read a, Show a) => Parser (ArmorType a) 46beginLine :: (Integral a, Read a, Show a) => Parser (ArmorType a)
46beginLine = do 47beginLine = do