From 626f1e55a03bd05718bbd3189bafa51cfb7a5982 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Thu, 20 Mar 2014 10:30:53 +0200 Subject: [PATCH] Improvements based on feedback from @vincenthz --- mime-mail-ses/Network/Mail/Mime/SES.hs | 8 +++++--- mime-mail-ses/mime-mail-ses.cabal | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mime-mail-ses/Network/Mail/Mime/SES.hs b/mime-mail-ses/Network/Mail/Mime/SES.hs index d32bceb..3018922 100644 --- a/mime-mail-ses/Network/Mail/Mime/SES.hs +++ b/mime-mail-ses/Network/Mail/Mime/SES.hs @@ -8,8 +8,9 @@ module Network.Mail.Mime.SES import Control.Exception (Exception, throwIO) import Control.Monad.IO.Class (MonadIO, liftIO) -import qualified Crypto.Hash.SHA256 as SHA256 -import Crypto.MAC.HMAC (hmac) +import Crypto.Hash (Digest, SHA256, hmac, + hmacGetDigest) +import Data.Byteable (toBytes) import Data.ByteString (ByteString) import Data.ByteString.Base64 (encode) import qualified Data.ByteString.Char8 as S8 @@ -122,4 +123,5 @@ data SESException = SESException instance Exception SESException makeSig :: ByteString -> ByteString -> ByteString -makeSig payload key = encode $ hmac SHA256.hash 64 key payload +makeSig payload key = + encode $ toBytes (hmacGetDigest $ hmac key payload :: Digest SHA256) diff --git a/mime-mail-ses/mime-mail-ses.cabal b/mime-mail-ses/mime-mail-ses.cabal index eeb9be9..1f6295d 100644 --- a/mime-mail-ses/mime-mail-ses.cabal +++ b/mime-mail-ses/mime-mail-ses.cabal @@ -27,4 +27,5 @@ Library , text , conduit , cryptohash >= 0.7.3 + , byteable ghc-options: -Wall