-- 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.2.0 -- | 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. -- -- For OFB and CTR, Encrypt and Decrypt are the same operation. For CTR, -- the IV is the initial value of the counter. data Mode ECB :: Mode CBC :: Mode CFB :: Mode OFB :: Mode CTR :: 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 -- | Just like MonadIO, but codifying unsafe IO execution. Exists -- for safety. module Control.Monad.UnsafeIO class (Monad m) => MonadUnsafeIO m liftUnsafeIO :: (MonadUnsafeIO m) => IO a -> m a instance (Monoid w, MonadUnsafeIO m) => MonadUnsafeIO (WriterT w m) instance (MonadUnsafeIO m) => MonadUnsafeIO (ReaderT r m) instance MonadUnsafeIO (ST s) instance MonadUnsafeIO (ST s) instance MonadUnsafeIO IO -- | An occasionally pure, monadic interface to AES module Codec.Crypto.AES.Monad type AES s a = AEST (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. -- -- For OFB and CTR, Encrypt and Decrypt are the same operation. For CTR, -- the IV is the initial value of the counter. data Mode ECB :: Mode CBC :: Mode CFB :: Mode OFB :: Mode CTR :: 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 -- | Run an AES computation runAEST :: (MonadUnsafeIO m) => Mode -> ByteString -> ByteString -> Direction -> AEST m a -> m (a, ByteString) -- | Run an AES computation runAES :: Mode -> ByteString -> ByteString -> Direction -> (forall s. AES s a) -> (a, ByteString) 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. -- -- For OFB and CTR, Encrypt and Decrypt are the same operation. For CTR, -- the IV is the initial value of the counter. data Mode ECB :: Mode CBC :: Mode CFB :: Mode OFB :: Mode CTR :: 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