make everything build again after ByteString Key changes

This commit is contained in:
Joey Hess 2019-01-11 16:34:04 -04:00
parent 151562b537
commit 727767e1e2
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
23 changed files with 79 additions and 72 deletions

View file

@ -9,6 +9,7 @@
-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE Rank2Types #-}
module Crypto (
@ -33,6 +34,7 @@ module Crypto (
prop_HmacSha1WithCipher_sane
) where
import qualified Data.ByteString as S
import qualified Data.ByteString.Lazy as L
import Data.ByteString.UTF8 (fromString)
import qualified Data.Map as M
@ -159,16 +161,17 @@ type EncKey = Key -> Key
- on content. It does need to be repeatable. -}
encryptKey :: Mac -> Cipher -> EncKey
encryptKey mac c k = stubKey
{ keyName = macWithCipher mac c (key2file k)
, keyVariety = OtherKey (encryptedBackendNamePrefix ++ showMac mac)
{ keyName = encodeBS (macWithCipher mac c (key2file k))
, keyVariety = OtherKey $
encryptedBackendNamePrefix <> encodeBS (showMac mac)
}
encryptedBackendNamePrefix :: String
encryptedBackendNamePrefix :: S.ByteString
encryptedBackendNamePrefix = "GPG"
isEncKey :: Key -> Bool
isEncKey k = case keyVariety k of
OtherKey s -> encryptedBackendNamePrefix `isPrefixOf` s
OtherKey s -> encryptedBackendNamePrefix `S.isPrefixOf` s
_ -> False
type Feeder = Handle -> IO ()