aboutsummaryrefslogtreecommitdiff
path: root/Types/Crypto.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-09-04 22:18:33 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-09-04 22:18:33 -0400
commit4c96f460a7ad615f344d1b2e88d037d7a0259776 (patch)
tree1c24b37d33946d6d5079156271c8ef8b5a3eb712 /Types/Crypto.hs
parent17a5f70ed26b14a15a50d237f47eb68eb9c2753d (diff)
replace an over-explained Bool with a data type
This also highlights several places where a Read/Show or similar for the new data type could avoid redundant strings.
Diffstat (limited to 'Types/Crypto.hs')
-rw-r--r--Types/Crypto.hs12
1 files changed, 4 insertions, 8 deletions
diff --git a/Types/Crypto.hs b/Types/Crypto.hs
index ee61d0863..8a15ead16 100644
--- a/Types/Crypto.hs
+++ b/Types/Crypto.hs
@@ -8,6 +8,7 @@
module Types.Crypto (
Cipher(..),
StorableCipher(..),
+ EncryptedCipherVariant(..),
KeyIds(..),
Mac(..),
readMac,
@@ -24,16 +25,11 @@ import Utility.Gpg (KeyIds(..))
-- XXX ideally, this would be a locked memory region
newtype Cipher = Cipher String
-data StorableCipher = EncryptedCipher String Bool KeyIds
- -- ^ The Boolean indicates whether the cipher is used
- -- both for symmetric encryption of file content and
- -- MAC'ing of file names (True), or only for MAC'ing,
- -- while file content is encrypted using public-key
- -- crypto (False). In the latter case the cipher is
- -- twice as short, but we don't want to rely on that
- -- only.
+data StorableCipher = EncryptedCipher String EncryptedCipherVariant KeyIds
| SharedCipher String
deriving (Ord, Eq)
+data EncryptedCipherVariant = HybridCipher | PubKeyCipher
+ deriving (Ord, Eq)
{- File names are (client-side) MAC'ed on special remotes.
- The chosen MAC algorithm needs to be same for all files stored on the