summaryrefslogtreecommitdiff
path: root/Crypto.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Crypto.hs')
-rw-r--r--Crypto.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Crypto.hs b/Crypto.hs
index dc1d2e6d2..a37528619 100644
--- a/Crypto.hs
+++ b/Crypto.hs
@@ -42,6 +42,7 @@ import Annex.Common
import qualified Utility.Gpg as Gpg
import Types.Crypto
import Types.Remote
+import Types.Key
{- The beginning of a Cipher is used for MAC'ing; the remainder is used
- as the GPG symmetric encryption passphrase when using the hybrid
@@ -159,14 +160,16 @@ type EncKey = Key -> Key
encryptKey :: Mac -> Cipher -> EncKey
encryptKey mac c k = stubKey
{ keyName = macWithCipher mac c (key2file k)
- , keyBackendName = encryptedBackendNamePrefix ++ showMac mac
+ , keyVariety = OtherKey (encryptedBackendNamePrefix ++ showMac mac)
}
encryptedBackendNamePrefix :: String
encryptedBackendNamePrefix = "GPG"
isEncKey :: Key -> Bool
-isEncKey k = encryptedBackendNamePrefix `isPrefixOf` keyBackendName k
+isEncKey k = case keyVariety k of
+ OtherKey s -> encryptedBackendNamePrefix `isPrefixOf` s
+ _ -> False
type Feeder = Handle -> IO ()
type Reader m a = Handle -> m a