-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Fast AES cipher implementation with advanced mode of operations
--
-- Fast AES cipher implementation with advanced mode of operations.
--
-- The modes of operations available are ECB (Electronic code book), CBC
-- (Cipher block chaining), CTR (Counter), XTS (XEX with ciphertext
-- stealing), GCM (Galois Counter Mode).
--
-- The AES implementation uses AES-NI when available (on x86 and x86-64
-- architecture), but fallback gracefully to a software C implementation.
--
-- The software implementation uses S-Boxes, which might suffer for cache
-- timing issues. However do notes that most other known software
-- implementations, including very popular one (openssl, gnutls) also
-- uses similar implementation. If it matters for your case, you should
-- make sure you have AES-NI available, or you'll need to use a different
-- implementation.
@package cipher-aes
@version 0.2.0
module Crypto.Cipher.AES
-- | AES Context (pre-processed key)
data AES
data AES128
data AES192
data AES256
-- | initialize key
--
-- rounds need to be 10 12 14. any other values will cause
-- undefined behavior
initAES :: Byteable b => b -> AES
-- | Deprecated: use initAES
initKey :: Byteable b => b -> AES
-- | generate a counter mode pad. this is generally xor-ed to an input to
-- make the standard counter mode block operations.
--
-- if the length requested is not a multiple of the block cipher size,
-- more data will be returned, so that the returned bytestring is a
-- multiple of the block cipher size.
genCTR :: Byteable iv => AES -> iv -> Int -> ByteString
-- | encrypt using Electronic Code Book (ECB)
encryptECB :: AES -> ByteString -> ByteString
-- | encrypt using Cipher Block Chaining (CBC)
encryptCBC :: Byteable iv => AES -> iv -> ByteString -> ByteString
-- | encrypt using Counter mode (CTR)
--
-- in CTR mode encryption and decryption is the same operation.
encryptCTR :: Byteable iv => AES -> iv -> ByteString -> ByteString
-- | encrypt using XTS
--
-- the first key is the normal block encryption key the second key is
-- used for the initial block tweak
encryptXTS :: Byteable iv => (AES, AES) -> iv -> Word32 -> ByteString -> ByteString
-- | encrypt using Galois counter mode (GCM) return the encrypted
-- bytestring and the tag associated
--
-- note: encrypted data is identical to CTR mode in GCM, however a tag is
-- also computed.
encryptGCM :: Byteable iv => AES -> iv -> ByteString -> ByteString -> (ByteString, AuthTag)
-- | decrypt using Electronic Code Book (ECB)
decryptECB :: AES -> ByteString -> ByteString
-- | decrypt using Cipher block chaining (CBC)
decryptCBC :: Byteable iv => AES -> iv -> ByteString -> ByteString
-- | decrypt using Counter mode (CTR).
--
-- in CTR mode encryption and decryption is the same operation.
decryptCTR :: Byteable iv => AES -> iv -> ByteString -> ByteString
-- | decrypt using XTS
decryptXTS :: Byteable iv => (AES, AES) -> iv -> Word32 -> ByteString -> ByteString
-- | decrypt using Galois Counter Mode (GCM)
decryptGCM :: Byteable iv => AES -> iv -> ByteString -> ByteString -> (ByteString, AuthTag)
instance AEADModeImpl AES256 GCM
instance BlockCipher AES256
instance AEADModeImpl AES192 GCM
instance BlockCipher AES192
instance AEADModeImpl AES128 GCM
instance BlockCipher AES128
instance Cipher AES256
instance Cipher AES192
instance Cipher AES128