module Crypto.TripleSec.Types where
import Control.Exception
import Data.Typeable
import Crypto.Cipher.Twofish (Twofish256)
import Crypto.Cipher.AES (AES256)
data TripleSec ba = TripleSec { passwordSalt :: ba
, hmacKeccak512 :: ba -> ba
, hmacSHA512 :: ba -> ba
, aes :: AES256
, twoFish :: Twofish256
, xSalsa :: ba }
data TripleSecException = CipherInitException CipherInitFailure
| EncryptionException EncryptionFailure
| DecryptionException DecryptionFailure
deriving (Show, Eq, Typeable)
instance Exception TripleSecException
data CipherInitFailure = ZeroLengthPassword
| InvalidSaltLength
deriving (Show, Eq)
data EncryptionFailure = ZeroLengthPlaintext
deriving (Show, Eq)
data DecryptionFailure = InvalidCipherTextLength
| InvalidMagicBytes
| InvalidVersion
| InvalidSha512Hmac
| InvalidKeccakHmac
| MisMatchedCipherSalt
deriving (Show, Eq)