diff options
author | joe <joe@jerkface.net> | 2017-09-04 19:06:09 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-09-04 19:06:09 -0400 |
commit | 4f9ad88773271a46ed1df899ad9a360de6c09a4e (patch) | |
tree | 4126630dbfda2a87871db89006cd239cf91298e2 | |
parent | 279605e44d6078f4171e81f5a9539e414d1a3d25 (diff) |
Stubs for symmetric encryption.
-rw-r--r-- | ToxCrypto.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ToxCrypto.hs b/ToxCrypto.hs index 87f64c9a..9dea7477 100644 --- a/ToxCrypto.hs +++ b/ToxCrypto.hs | |||
@@ -39,6 +39,8 @@ module ToxCrypto | |||
39 | , State(..) | 39 | , State(..) |
40 | , zeros32 | 40 | , zeros32 |
41 | , zeros24 | 41 | , zeros24 |
42 | , decryptSymmetric | ||
43 | , encryptSymmetric | ||
42 | ) where | 44 | ) where |
43 | 45 | ||
44 | import qualified Crypto.Cipher.Salsa as Salsa | 46 | import qualified Crypto.Cipher.Salsa as Salsa |
@@ -162,6 +164,12 @@ storePlain a = Plain <$> BA.create (sizeOf a) (`poke` a) | |||
162 | retrievePlain :: Storable a => Plain Storable a -> IO a | 164 | retrievePlain :: Storable a => Plain Storable a -> IO a |
163 | retrievePlain (Plain bs) = BA.withByteArray bs peek | 165 | retrievePlain (Plain bs) = BA.withByteArray bs peek |
164 | 166 | ||
167 | decryptSymmetric :: SymmetricKey -> Nonce24 -> Encrypted a -> Either String (Plain s a) | ||
168 | decryptSymmetric sym nonce e = _todo | ||
169 | |||
170 | encryptSymmetric :: SymmetricKey -> Nonce24 -> Plain s x -> Encrypted x | ||
171 | encryptSymmetric = _todo | ||
172 | |||
165 | data State = State Poly1305.State XSalsa.State | 173 | data State = State Poly1305.State XSalsa.State |
166 | 174 | ||
167 | decrypt :: State -> Encrypted a -> Either String (Plain s a) | 175 | decrypt :: State -> Encrypted a -> Either String (Plain s a) |