diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-11 15:52:50 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-11 15:52:50 -0400 |
commit | 5decbad3eb779b1bbe11245cbde84701909e9c68 (patch) | |
tree | 79e28c04d76ee8e225ee344b9d8c07a922728002 /Types.hs | |
parent | 90b7c385f4e2f293502f9aca38aaa041b7b2f486 (diff) | |
download | keysafe-5decbad3eb779b1bbe11245cbde84701909e9c68.tar.gz |
nearly able to generate shards now
Diffstat (limited to 'Types.hs')
-rw-r--r-- | Types.hs | 25 |
1 files changed, 15 insertions, 10 deletions
@@ -20,6 +20,11 @@ instance Bruteforceable EncryptedSecretKey UnknownPassword where -- | Objects stored on a keysafe server are (probably) a shard of an -- encrypted secret key. newtype StorableObject = StorableObject { fromStorableObject :: BL.ByteString } + deriving (Show) + +-- | An identifier for a StorableObject +newtype StorableObjectIdent = StorableObjectIdent B.ByteString + deriving (Show) -- | A password used to encrypt a key stored in keysafe. newtype Password = Password B.ByteString @@ -36,6 +41,11 @@ passwordEntropy (Password p) = Entropy $ floor $ totalEntropy p newtype Name = Name B.ByteString deriving (Show) +-- | Very naive calculation of the entropy of a name. +-- Assumes that the attacker is not targeting a particular list of names. +nameEntropy :: Name -> Entropy UnknownName +nameEntropy (Name n) = Entropy $ floor $ totalEntropy n + -- | The type of the key that is stored in keysafe. newtype KeyType = KeyType B.ByteString deriving (Show) @@ -43,16 +53,11 @@ newtype KeyType = KeyType B.ByteString gpgKey :: KeyType gpgKey = KeyType "gpg" --- | Enough information to uniquely identify a key stored in keysafe. -data KeyIdent = KeyIdent KeyType Name - deriving (Show) - -newtype ShardNum = ShardNum Int - deriving (Show) - --- | Enough information to uniquely identify an object stored on a keysafe --- server for a key. -data ObjectIdent = ObjectIdent ShardNum KeyIdent +-- | The keyid is any value that is unique to a private key, and can be +-- looked up somehow without knowing the private key. +-- +-- A gpg keyid is the obvious example. +data KeyId = KeyId KeyType B.ByteString deriving (Show) data Benchmark t = Benchmark { expectedBenchmark :: t, actualBenchmark :: t } |