summaryrefslogtreecommitdiff
path: root/Crypto.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-08-03 16:54:57 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-08-03 16:54:57 -0400
commit70cdd7366a5eb0fd232089a1472245c834fa5639 (patch)
tree451c6169b51504e1e28593b7ba6b965766253465 /Crypto.hs
parentb01ed93441e81a9dbd17c9974fe683101f879f2a (diff)
finish making rsync support chunking
This breaks gcrypt, which relies on some internals of the rsync remote. To fix next..
Diffstat (limited to 'Crypto.hs')
-rw-r--r--Crypto.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Crypto.hs b/Crypto.hs
index dcefc2959..10d6e5cef 100644
--- a/Crypto.hs
+++ b/Crypto.hs
@@ -22,6 +22,7 @@ module Crypto (
describeCipher,
decryptCipher,
encryptKey,
+ isEncKey,
feedFile,
feedBytes,
readBytes,
@@ -150,9 +151,15 @@ type EncKey = Key -> Key
encryptKey :: Mac -> Cipher -> EncKey
encryptKey mac c k = stubKey
{ keyName = macWithCipher mac c (key2file k)
- , keyBackendName = "GPG" ++ showMac mac
+ , keyBackendName = encryptedBackendNamePrefix ++ showMac mac
}
+encryptedBackendNamePrefix :: String
+encryptedBackendNamePrefix = "GPG"
+
+isEncKey :: Key -> Bool
+isEncKey k = encryptedBackendNamePrefix `isPrefixOf` keyBackendName k
+
type Feeder = Handle -> IO ()
type Reader m a = Handle -> m a