rename constructor for clariy
This commit is contained in:
parent
ac9807c887
commit
89eecd4b3b
4 changed files with 15 additions and 15 deletions
|
@ -36,9 +36,9 @@ encryptionSetup c = maybe genCipher updateCipher $ extractCipher c
|
|||
-- 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 HybridCipher
|
||||
use "encryption setup" . genEncryptedCipher key Hybrid
|
||||
=<< highRandomQuality
|
||||
Just "pubkey" -> use "encryption setup" . genEncryptedCipher key PubKeyCipher
|
||||
Just "pubkey" -> use "encryption setup" . genEncryptedCipher key PubKey
|
||||
=<< highRandomQuality
|
||||
_ -> error $ "Specify " ++ intercalate " or "
|
||||
(map ("encryption=" ++)
|
||||
|
@ -52,7 +52,7 @@ encryptionSetup c = maybe genCipher updateCipher $ extractCipher c
|
|||
updateCipher v = case v of
|
||||
SharedCipher _ | maybe True (== "shared") encryption -> return c'
|
||||
EncryptedCipher _ variant _
|
||||
| maybe True (== if variant == HybridCipher then "hybrid" else "pubkey") encryption ->
|
||||
| maybe True (== if variant == Hybrid then "hybrid" else "pubkey") encryption ->
|
||||
use "encryption update" $ updateEncryptedCipher newkeys v
|
||||
_ -> cannotchange
|
||||
use m a = do
|
||||
|
@ -154,9 +154,9 @@ extractCipher c = case (M.lookup "cipher" c,
|
|||
M.lookup "cipherkeys" c,
|
||||
M.lookup "encryption" c) of
|
||||
(Just t, Just ks, encryption) | maybe True (== "hybrid") encryption ->
|
||||
Just $ EncryptedCipher (fromB64 t) HybridCipher (readkeys ks)
|
||||
Just $ EncryptedCipher (fromB64 t) Hybrid (readkeys ks)
|
||||
(Just t, Just ks, Just "pubkey") ->
|
||||
Just $ EncryptedCipher (fromB64 t) PubKeyCipher (readkeys ks)
|
||||
Just $ EncryptedCipher (fromB64 t) PubKey (readkeys ks)
|
||||
(Just t, Nothing, encryption) | maybe True (== "shared") encryption ->
|
||||
Just $ SharedCipher (fromB64 t)
|
||||
_ -> Nothing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue