From 4a0bb47803be6be43b8bb5c62f302019a25f9fd1 Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Wed, 25 Apr 2012 19:26:58 -0400 Subject: Encode multiple Armors into one ByteString. --- Codec/Encryption/OpenPGP/ASCIIArmor.hs | 4 ++-- Codec/Encryption/OpenPGP/ASCIIArmor/Encode.hs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'Codec') 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 @@ -- (See the LICENSE file). module Codec.Encryption.OpenPGP.ASCIIArmor ( - armor + encode , decode , parseArmor ) where -import Codec.Encryption.OpenPGP.ASCIIArmor.Encode (armor) +import Codec.Encryption.OpenPGP.ASCIIArmor.Encode (encode) import 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 @@ -- (See the LICENSE file). module Codec.Encryption.OpenPGP.ASCIIArmor.Encode ( - armor + encode ) where import Codec.Encryption.OpenPGP.ASCIIArmor.Types @@ -17,6 +17,9 @@ import Data.Serialize (put) import Data.Serialize.Put (runPut, putWord32be) import Data.String (IsString, fromString) +encode :: (Integral a, Show a) => [Armor a] -> ByteString +encode = B.concat . map armor + armor :: (Integral a, Show a) => Armor a -> ByteString 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 -- cgit v1.2.3