aboutsummaryrefslogtreecommitdiff
path: root/Crypto.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-05-01 14:27:40 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-05-01 14:27:40 -0400
commit2ddade8132169ea751628f72ae5b03c5921abafc (patch)
tree35e4eaf5b70577e2b13e3e1f42a5ba6ed5c5c9a1 /Crypto.hs
parent3095e1631180d87cba112c210dfdfeee9b57ef54 (diff)
factor out base64 code
Diffstat (limited to 'Crypto.hs')
-rw-r--r--Crypto.hs14
1 files changed, 1 insertions, 13 deletions
diff --git a/Crypto.hs b/Crypto.hs
index 2f544f21f..53cd48dd5 100644
--- a/Crypto.hs
+++ b/Crypto.hs
@@ -22,21 +22,17 @@ module Crypto (
withDecryptedHandle,
withEncryptedContent,
withDecryptedContent,
- toB64,
- fromB64,
prop_hmacWithCipher_sane
) where
import qualified Data.ByteString.Lazy.Char8 as L
import qualified Data.Map as M
-import qualified Codec.Binary.Base64 as B64
import Data.ByteString.Lazy.UTF8 (fromString)
import Data.Digest.Pure.SHA
import System.Cmd.Utils
import Data.String.Utils
import Data.List
-import Data.Bits.Utils
import System.IO
import System.Posix.IO
import System.Posix.Types
@@ -50,6 +46,7 @@ import Types
import Key
import RemoteClass
import Utility
+import Base64
import CryptoTypes
{- The first half of a Cipher is used for HMAC; the remainder
@@ -246,15 +243,6 @@ configGet c key =
Just v -> v
Nothing -> error $ "missing " ++ key ++ " in remote config"
-toB64 :: String -> String
-toB64 = B64.encode . s2w8
-
-fromB64 :: String -> String
-fromB64 s =
- case B64.decode s of
- Nothing -> error "bad base64 encoded data"
- Just ws -> w82s ws
-
hmacWithCipher :: Cipher -> String -> String
hmacWithCipher c = hmacWithCipher' (cipherHmac c)
hmacWithCipher' :: String -> String -> String