Encryption defaults to 'hybrid'

When a keyid= is specified while encryption= is absent.
This commit is contained in:
guilhem 2013-09-05 01:09:56 +02:00 committed by Joey Hess
parent b30a322093
commit 3999a860eb

View file

@ -33,15 +33,16 @@ encryptionSetup c = maybe genCipher updateCipher $ extractCipher c
Just "none" -> return c Just "none" -> return c
Just "shared" -> use "encryption setup" . genSharedCipher Just "shared" -> use "encryption setup" . genSharedCipher
=<< highRandomQuality =<< highRandomQuality
-- hybrid encryption by default -- hybrid encryption is the default when a keyid is
_ | maybe True (== "hybrid") encryption -> -- specified but no encryption
_ | maybe (M.member "keyid" c) (== "hybrid") encryption ->
use "encryption setup" . genEncryptedCipher key True use "encryption setup" . genEncryptedCipher key True
=<< highRandomQuality =<< highRandomQuality
Just "pubkey" -> use "encryption setup" . genEncryptedCipher key False Just "pubkey" -> use "encryption setup" . genEncryptedCipher key False
=<< highRandomQuality =<< highRandomQuality
_ -> error $ "Specify " ++ intercalate " or " _ -> error $ "Specify " ++ intercalate " or "
(map ("encryption=" ++) (map ("encryption=" ++)
["none","shared","hybrid (default)","pubkey"]) ["none","shared","hybrid","pubkey"])
++ "." ++ "."
key = fromMaybe (error "Specifiy keyid=...") $ M.lookup "keyid" c key = fromMaybe (error "Specifiy keyid=...") $ M.lookup "keyid" c
newkeys = maybe [] (\k -> [(True,k)]) (M.lookup "keyid+" c) ++ newkeys = maybe [] (\k -> [(True,k)]) (M.lookup "keyid+" c) ++