module Crypto.Cipher.Types.Base
( KeySizeSpecifier(..)
, Cipher(..)
, AuthTag(..)
, AEADMode(..)
, DataUnitOffset
) where
import Data.Word
import Crypto.Internal.ByteArray (Bytes, ByteArrayAccess, ByteArray)
import qualified Crypto.Internal.ByteArray as B
import Crypto.Error
data KeySizeSpecifier =
KeySizeRange Int Int
| KeySizeEnum [Int]
| KeySizeFixed Int
deriving (Show,Eq)
type DataUnitOffset = Word32
newtype AuthTag = AuthTag { unAuthTag :: Bytes }
deriving (Show, ByteArrayAccess)
instance Eq AuthTag where
(AuthTag a) == (AuthTag b) = B.constEq a b
data AEADMode =
AEAD_OCB
| AEAD_CCM
| AEAD_EAX
| AEAD_CWC
| AEAD_GCM
deriving (Show,Eq)
class Cipher cipher where
cipherInit :: ByteArray key => key -> CryptoFailable cipher
cipherName :: cipher -> String
cipherKeySize :: cipher -> KeySizeSpecifier