diff options
Diffstat (limited to 'Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs')
-rw-r--r-- | Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs b/Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs index 99d4d54..28bb3e6 100644 --- a/Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs +++ b/Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs | |||
@@ -17,22 +17,22 @@ import Data.Serialize (put) | |||
17 | import Data.Serialize.Put (runPut, putWord32be) | 17 | import Data.Serialize.Put (runPut, putWord32be) |
18 | import Data.String (IsString, fromString) | 18 | import Data.String (IsString, fromString) |
19 | 19 | ||
20 | encode :: (Integral a, Show a) => [Armor a] -> ByteString | 20 | encode :: [Armor] -> ByteString |
21 | encode = B.concat . map armor | 21 | encode = B.concat . map armor |
22 | 22 | ||
23 | armor :: (Integral a, Show a) => Armor a -> ByteString | 23 | armor :: Armor -> ByteString |
24 | armor (Armor atype ahs bs) = beginLine atype `B.append` armorHeaders ahs `B.append` blankLine `B.append` armorData bs `B.append` armorChecksum bs `B.append` endLine atype | 24 | armor (Armor atype ahs bs) = beginLine atype `B.append` armorHeaders ahs `B.append` blankLine `B.append` armorData bs `B.append` armorChecksum bs `B.append` endLine atype |
25 | 25 | ||
26 | blankLine :: ByteString | 26 | blankLine :: ByteString |
27 | blankLine = BC8.singleton '\n' | 27 | blankLine = BC8.singleton '\n' |
28 | 28 | ||
29 | beginLine :: (Integral a, Show a) => ArmorType a -> ByteString | 29 | beginLine :: ArmorType -> ByteString |
30 | beginLine atype = BC8.pack "-----BEGIN PGP " `B.append` aType atype `B.append` BC8.pack "-----\n" | 30 | beginLine atype = BC8.pack "-----BEGIN PGP " `B.append` aType atype `B.append` BC8.pack "-----\n" |
31 | 31 | ||
32 | endLine :: (Integral a, Show a) => ArmorType a -> ByteString | 32 | endLine :: ArmorType -> ByteString |
33 | endLine atype = BC8.pack "-----END PGP " `B.append` aType atype `B.append` BC8.pack "-----\n" | 33 | endLine atype = BC8.pack "-----END PGP " `B.append` aType atype `B.append` BC8.pack "-----\n" |
34 | 34 | ||
35 | aType :: (Integral a, Show a) => ArmorType a -> ByteString | 35 | aType :: ArmorType -> ByteString |
36 | aType (ArmorMessage) = BC8.pack "MESSAGE" | 36 | aType (ArmorMessage) = BC8.pack "MESSAGE" |
37 | aType (ArmorPublicKeyBlock) = BC8.pack "PUBLIC KEY BLOCK" | 37 | aType (ArmorPublicKeyBlock) = BC8.pack "PUBLIC KEY BLOCK" |
38 | aType (ArmorPrivateKeyBlock) = BC8.pack "PRIVATE KEY BLOCK" | 38 | aType (ArmorPrivateKeyBlock) = BC8.pack "PRIVATE KEY BLOCK" |