diff options
author | guilhem <guilhem@fripost.org> | 2013-03-11 02:33:13 +0100 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-03-11 09:48:38 -0400 |
commit | 7fa1e498de9cbb84b23f90b17c66d755292ae716 (patch) | |
tree | dc1f5127473d3450b138b4aedfe43a5248d42939 /Remote | |
parent | f2292dc3b494dbed517a48ab2876594f5ace0179 (diff) |
GnuPG options for symmetric encryption.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Bup.hs | 2 | ||||
-rw-r--r-- | Remote/Directory.hs | 8 | ||||
-rw-r--r-- | Remote/Glacier.hs | 2 | ||||
-rw-r--r-- | Remote/Hook.hs | 8 | ||||
-rw-r--r-- | Remote/Rsync.hs | 8 | ||||
-rw-r--r-- | Remote/S3.hs | 2 | ||||
-rw-r--r-- | Remote/WebDAV.hs | 3 |
7 files changed, 17 insertions, 16 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs index f81751f82..a598e5599 100644 --- a/Remote/Bup.hs +++ b/Remote/Bup.hs @@ -130,7 +130,7 @@ storeEncrypted r buprepo (cipher, enck) k _p = sendAnnex k (rollback enck buprepo) $ \src -> do params <- bupSplitParams r buprepo enck [] liftIO $ catchBoolIO $ - encrypt cipher (feedFile src) $ \h -> + encrypt (getGpgOpts r) cipher (feedFile src) $ \h -> pipeBup params (Just h) Nothing retrieve :: BupRepo -> Key -> AssociatedFile -> FilePath -> Annex Bool diff --git a/Remote/Directory.hs b/Remote/Directory.hs index 3070a530b..141586938 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -38,7 +38,7 @@ gen r u c gc = do cst <- remoteCost gc cheapRemoteCost let chunksize = chunkSize c return $ encryptableRemote c - (storeEncrypted dir chunksize) + (storeEncrypted dir (getGpgOpts gc) chunksize) (retrieveEncrypted dir chunksize) Remote { uuid = u, @@ -124,11 +124,11 @@ store d chunksize k _f p = sendAnnex k (void $ remove d k) $ \src -> storeSplit meterupdate chunksize dests =<< L.readFile src -storeEncrypted :: FilePath -> ChunkSize -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool -storeEncrypted d chunksize (cipher, enck) k p = sendAnnex k (void $ remove d enck) $ \src -> +storeEncrypted :: FilePath -> GpgOpts -> ChunkSize -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool +storeEncrypted d gpgOpts chunksize (cipher, enck) k p = sendAnnex k (void $ remove d enck) $ \src -> metered (Just p) k $ \meterupdate -> storeHelper d chunksize enck $ \dests -> - encrypt cipher (feedFile src) $ readBytes $ \b -> + encrypt gpgOpts cipher (feedFile src) $ readBytes $ \b -> case chunksize of Nothing -> do let dest = Prelude.head dests diff --git a/Remote/Glacier.hs b/Remote/Glacier.hs index 173e366d2..bd2f0a179 100644 --- a/Remote/Glacier.hs +++ b/Remote/Glacier.hs @@ -93,7 +93,7 @@ storeEncrypted :: Remote -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool storeEncrypted r (cipher, enck) k m = sendAnnex k (void $ remove r enck) $ \src -> do metered (Just m) k $ \meterupdate -> storeHelper r enck $ \h -> - encrypt cipher (feedFile src) + encrypt (getGpgOpts r) cipher (feedFile src) (readBytes $ meteredWrite meterupdate h) retrieve :: Remote -> Key -> AssociatedFile -> FilePath -> Annex Bool diff --git a/Remote/Hook.hs b/Remote/Hook.hs index 8b0231203..9fbd632d6 100644 --- a/Remote/Hook.hs +++ b/Remote/Hook.hs @@ -33,7 +33,7 @@ gen :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> Annex Remote gen r u c gc = do cst <- remoteCost gc expensiveRemoteCost return $ encryptableRemote c - (storeEncrypted hooktype) + (storeEncrypted hooktype $ getGpgOpts gc) (retrieveEncrypted hooktype) Remote { uuid = u, @@ -106,10 +106,10 @@ store :: String -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool store h k _f _p = sendAnnex k (void $ remove h k) $ \src -> runHook h "store" k (Just src) $ return True -storeEncrypted :: String -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool -storeEncrypted h (cipher, enck) k _p = withTmp enck $ \tmp -> +storeEncrypted :: String -> GpgOpts -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool +storeEncrypted h gpgOpts (cipher, enck) k _p = withTmp enck $ \tmp -> sendAnnex k (void $ remove h enck) $ \src -> do - liftIO $ encrypt cipher (feedFile src) $ + liftIO $ encrypt gpgOpts cipher (feedFile src) $ readBytes $ L.writeFile tmp runHook h "store" enck (Just tmp) $ return True diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs index 21a4d4324..a7a830ef9 100644 --- a/Remote/Rsync.hs +++ b/Remote/Rsync.hs @@ -43,7 +43,7 @@ gen :: Git.Repo -> UUID -> RemoteConfig -> RemoteGitConfig -> Annex Remote gen r u c gc = do cst <- remoteCost gc expensiveRemoteCost return $ encryptableRemote c - (storeEncrypted o) + (storeEncrypted o $ getGpgOpts gc) (retrieveEncrypted o) Remote { uuid = u @@ -104,10 +104,10 @@ rsyncUrls o k = map use annexHashes store :: RsyncOpts -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool store o k _f p = sendAnnex k (void $ remove o k) $ rsyncSend o p k False -storeEncrypted :: RsyncOpts -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool -storeEncrypted o (cipher, enck) k p = withTmp enck $ \tmp -> +storeEncrypted :: RsyncOpts -> GpgOpts -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool +storeEncrypted o gpgOpts (cipher, enck) k p = withTmp enck $ \tmp -> sendAnnex k (void $ remove o enck) $ \src -> do - liftIO $ encrypt cipher (feedFile src) $ + liftIO $ encrypt gpgOpts cipher (feedFile src) $ readBytes $ L.writeFile tmp rsyncSend o p enck True tmp diff --git a/Remote/S3.hs b/Remote/S3.hs index 1d24c4938..164e384f5 100644 --- a/Remote/S3.hs +++ b/Remote/S3.hs @@ -122,7 +122,7 @@ storeEncrypted r (cipher, enck) k p = s3Action r False $ \(conn, bucket) -> -- To get file size of the encrypted content, have to use a temp file. -- (An alternative would be chunking to to a constant size.) withTmp enck $ \tmp -> sendAnnex k (void $ remove r enck) $ \src -> do - liftIO $ encrypt cipher (feedFile src) $ + liftIO $ encrypt (getGpgOpts r) cipher (feedFile src) $ readBytes $ L.writeFile tmp res <- storeHelper (conn, bucket) r enck p tmp s3Bool res diff --git a/Remote/WebDAV.hs b/Remote/WebDAV.hs index 84c30774a..b1c2ee4a8 100644 --- a/Remote/WebDAV.hs +++ b/Remote/WebDAV.hs @@ -92,7 +92,8 @@ storeEncrypted :: Remote -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool storeEncrypted r (cipher, enck) k p = metered (Just p) k $ \meterupdate -> davAction r False $ \(baseurl, user, pass) -> sendAnnex k (void $ remove r enck) $ \src -> - liftIO $ encrypt cipher (streamMeteredFile src meterupdate) $ + liftIO $ encrypt (getGpgOpts r) cipher + (streamMeteredFile src meterupdate) $ readBytes $ storeHelper r enck baseurl user pass storeHelper :: Remote -> Key -> DavUrl -> DavUser -> DavPass -> L.ByteString -> IO Bool |