summaryrefslogtreecommitdiff
path: root/Codec
diff options
context:
space:
mode:
authorClint Adams <clint@debian.org>2012-04-25 19:26:58 -0400
committerClint Adams <clint@debian.org>2012-04-25 19:27:26 -0400
commit4a0bb47803be6be43b8bb5c62f302019a25f9fd1 (patch)
tree53c0f2ae494136395401d6dc73f4409cba4f0637 /Codec
parentf06c3f713f99c9ea09a76728ffce2c6e1c957070 (diff)
Encode multiple Armors into one ByteString.
Diffstat (limited to 'Codec')
-rw-r--r--Codec/Encryption/OpenPGP/ASCIIArmor.hs4
-rw-r--r--Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs5
2 files changed, 6 insertions, 3 deletions
diff --git a/Codec/Encryption/OpenPGP/ASCIIArmor.hs b/Codec/Encryption/OpenPGP/ASCIIArmor.hs
index 075a481..26d58dd 100644
--- a/Codec/Encryption/OpenPGP/ASCIIArmor.hs
+++ b/Codec/Encryption/OpenPGP/ASCIIArmor.hs
@@ -4,10 +4,10 @@
4-- (See the LICENSE file). 4-- (See the LICENSE file).
5 5
6module Codec.Encryption.OpenPGP.ASCIIArmor ( 6module Codec.Encryption.OpenPGP.ASCIIArmor (
7 armor 7 encode
8 , decode 8 , decode
9 , parseArmor 9 , parseArmor
10) where 10) where
11 11
12import Codec.Encryption.OpenPGP.ASCIIArmor.Encode (armor) 12import Codec.Encryption.OpenPGP.ASCIIArmor.Encode (encode)
13import Codec.Encryption.OpenPGP.ASCIIArmor.Decode (decode, parseArmor) 13import Codec.Encryption.OpenPGP.ASCIIArmor.Decode (decode, parseArmor)
diff --git a/Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs b/Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs
index 8853be3..99d4d54 100644
--- a/Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs
+++ b/Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs
@@ -4,7 +4,7 @@
4-- (See the LICENSE file). 4-- (See the LICENSE file).
5 5
6module Codec.Encryption.OpenPGP.ASCIIArmor.Encode ( 6module Codec.Encryption.OpenPGP.ASCIIArmor.Encode (
7 armor 7 encode
8) where 8) where
9 9
10import Codec.Encryption.OpenPGP.ASCIIArmor.Types 10import Codec.Encryption.OpenPGP.ASCIIArmor.Types
@@ -17,6 +17,9 @@ import Data.Serialize (put)
17import Data.Serialize.Put (runPut, putWord32be) 17import Data.Serialize.Put (runPut, putWord32be)
18import Data.String (IsString, fromString) 18import Data.String (IsString, fromString)
19 19
20encode :: (Integral a, Show a) => [Armor a] -> ByteString
21encode = B.concat . map armor
22
20armor :: (Integral a, Show a) => Armor a -> ByteString 23armor :: (Integral a, Show a) => Armor a -> ByteString
21armor (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 24armor (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
22 25