summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar guilhem <guilhem@fripost.org>2013-09-05 01:09:56 +0200
committerGravatar Joey Hess <joey@kitenet.net>2013-09-04 21:34:33 -0400
commitd37f6b5def1a9e75da44df46df4e9b5cd2af4962 (patch)
treec7ea3e7baaeef6c885c6109b34257d0d9d51120f /Remote
parentcffc483f9fb2a0b7529e3b80adb766cbf907becc (diff)
Encryption defaults to 'hybrid'
When a keyid= is specified while encryption= is absent.
Diffstat (limited to 'Remote')
-rw-r--r--Remote/Helper/Encryptable.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/Remote/Helper/Encryptable.hs b/Remote/Helper/Encryptable.hs
index 2f72fb417..13e8a6b77 100644
--- a/Remote/Helper/Encryptable.hs
+++ b/Remote/Helper/Encryptable.hs
@@ -33,15 +33,16 @@ encryptionSetup c = maybe genCipher updateCipher $ extractCipher c
Just "none" -> return c
Just "shared" -> use "encryption setup" . genSharedCipher
=<< highRandomQuality
- -- hybrid encryption by default
- _ | maybe True (== "hybrid") encryption ->
+ -- hybrid encryption is the default when a keyid is
+ -- specified but no encryption
+ _ | maybe (M.member "keyid" c) (== "hybrid") encryption ->
use "encryption setup" . genEncryptedCipher key True
=<< highRandomQuality
Just "pubkey" -> use "encryption setup" . genEncryptedCipher key False
=<< highRandomQuality
_ -> error $ "Specify " ++ intercalate " or "
(map ("encryption=" ++)
- ["none","shared","hybrid (default)","pubkey"])
+ ["none","shared","hybrid","pubkey"])
++ "."
key = fromMaybe (error "Specifiy keyid=...") $ M.lookup "keyid" c
newkeys = maybe [] (\k -> [(True,k)]) (M.lookup "keyid+" c) ++