From 7fa1e498de9cbb84b23f90b17c66d755292ae716 Mon Sep 17 00:00:00 2001 From: guilhem Date: Mon, 11 Mar 2013 02:33:13 +0100 Subject: GnuPG options for symmetric encryption. --- Crypto.hs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Crypto.hs') diff --git a/Crypto.hs b/Crypto.hs index ed489cdbc..21a35ad0b 100644 --- a/Crypto.hs +++ b/Crypto.hs @@ -23,6 +23,8 @@ module Crypto ( readBytes, encrypt, decrypt, + GpgOpts(..), + getGpgOpts, prop_hmacWithCipher_sane ) where @@ -34,6 +36,7 @@ import Control.Applicative import Common.Annex import qualified Utility.Gpg as Gpg +import Utility.Gpg.Types import Types.Key import Types.Crypto @@ -131,10 +134,12 @@ feedBytes = flip L.hPut readBytes :: (L.ByteString -> IO a) -> Reader a readBytes a h = L.hGetContents h >>= a -{- Runs a Feeder action, that generates content that is encrypted with the - - Cipher, and read by the Reader action. -} -encrypt :: Cipher -> Feeder -> Reader a -> IO a -encrypt = Gpg.feedRead [Params "--symmetric --force-mdc"] . cipherPassphrase +{- Runs a Feeder action, that generates content that is symmetrically encrypted + - with the Cipher using the given GnuPG options, and then read by the Reader + - action. -} +encrypt :: GpgOpts -> Cipher -> Feeder -> Reader a -> IO a +encrypt opts = Gpg.feedRead ( Params "--symmetric --force-mdc" : toParams opts ) + . cipherPassphrase {- Runs a Feeder action, that generates content that is decrypted with the - Cipher, and read by the Reader action. -} -- cgit v1.2.3