-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Fast AES encryption/decryption for bytestrings -- -- A zero-copy binding to Brian Gladman's AES implementation, including a -- copy of that implementation @package AES @version 0.0.2 -- | Primitive (in IO) AES operations module Codec.Crypto.AES.IO -- | Create an encryption/decryption context for incremental -- encryption/decryption -- -- You may create an ECB context this way, in which case you may pass -- undefined for the IV newCtx :: Mode -> ByteString -> ByteString -> Direction -> IO AESCtx -- | Create a context for ECB, which doesn't need an IV newECBCtx :: ByteString -> Direction -> IO AESCtx data Direction Encrypt :: Direction Decrypt :: Direction -- | Modes ECB and CBC can only handle full 16-byte frames. This means the -- length of every strict bytestring passed in must be a multiple of 16; -- when using lazy bytestrings, its component strict bytestrings -- must all satisfy this. -- -- Other modes can handle bytestrings of any length, by storing overflow -- for later. However, the total length of bytestrings passed in must -- still be a multiple of 16, or the overflow will be lost. -- -- In addition to the existing modes, a small amount of extra code could -- add support for CTR data Mode ECB :: Mode CBC :: Mode CFB :: Mode data AESCtx -- | Incrementally encrypt/decrypt bytestrings -- -- crypt is definitely not thread-safe. Don't even think about it. crypt :: AESCtx -> ByteString -> IO ByteString instance Show AESKey instance Storable DecryptCtxStruct instance Storable EncryptCtxStruct -- | A pure interface to AES, in the lazy ST monad. module Codec.Crypto.AES.ST type AES s a = ReaderT AESCtx (WriterT ByteString (ST s)) a -- | Modes ECB and CBC can only handle full 16-byte frames. This means the -- length of every strict bytestring passed in must be a multiple of 16; -- when using lazy bytestrings, its component strict bytestrings -- must all satisfy this. -- -- Other modes can handle bytestrings of any length, by storing overflow -- for later. However, the total length of bytestrings passed in must -- still be a multiple of 16, or the overflow will be lost. -- -- In addition to the existing modes, a small amount of extra code could -- add support for CTR data Mode ECB :: Mode CBC :: Mode CFB :: Mode data Direction Encrypt :: Direction Decrypt :: Direction -- | A class of things that can be crypted -- -- The crypt function returns incremental results as well as appending -- them to the result bytestring. class Cryptable a crypt :: (Cryptable a) => a -> AES s a -- | Compute an AES computation, discarding the ST return value execAES :: Mode -> ByteString -> ByteString -> Direction -> (forall s. AES s a) -> ByteString -- | Compute an AES computation, returning the ST return value along with -- the crypted data runAES :: Mode -> ByteString -> ByteString -> Direction -> (forall s. AES s a) -> (a, ByteString) -- | Before you use this, recall that AES uses the lazy ST monad. liftST :: ST s a -> AES s a instance Cryptable ByteString instance Cryptable ByteString -- | A pure interface to AES module Codec.Crypto.AES -- | Modes ECB and CBC can only handle full 16-byte frames. This means the -- length of every strict bytestring passed in must be a multiple of 16; -- when using lazy bytestrings, its component strict bytestrings -- must all satisfy this. -- -- Other modes can handle bytestrings of any length, by storing overflow -- for later. However, the total length of bytestrings passed in must -- still be a multiple of 16, or the overflow will be lost. -- -- In addition to the existing modes, a small amount of extra code could -- add support for CTR data Mode ECB :: Mode CBC :: Mode CFB :: Mode data Direction Encrypt :: Direction Decrypt :: Direction -- | Encryption/decryption for lazy bytestrings crypt :: Mode -> ByteString -> ByteString -> Direction -> ByteString -> ByteString -- | Encryption/decryption for strict bytestrings crypt' :: Mode -> ByteString -> ByteString -> Direction -> ByteString -> ByteString