crypto-api-0.1.2.1: A generic interface for cryptographic operations

Portabilityportable
Stabilitybeta
MaintainerThomas.DuBuisson@gmail.com

Crypto.Modes

Description

Generic mode implementations useable by any correct BlockCipher instance

Be aware there are no tests for CFB mode yet. See Test.Crypto.

Synopsis

Documentation

cbc :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source

Cipher block chaining encryption for lazy bytestrings

unCbc :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source

Cipher block chaining decryption for lazy bytestrings

cfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source

Ciphertext feed-back encryption mode for lazy bytestrings (with s == blockSize)

unCfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source

Ciphertext feed-back decryption mode for lazy bytestrings (with s == blockSize)

ofb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source

Output feedback mode for lazy bytestrings

unOfb :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source

Output feedback mode for lazy bytestrings

cbc' :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source

zipWith xor + Pack This is written intentionally to take advantage of the bytestring libraries zipWith' rewrite rule but at the extra cost of the resulting lazy bytestring being more fragmented than either of the two inputs.

zipWith xor + Pack As a result of rewrite rules, this should automatically be optimized (at compile time) to use the bytestring libraries zipWith' function.

Cipher block chaining encryption mode on strict bytestrings

unCbc' :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source

Cipher block chaining decryption for strict bytestrings

cfb' :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source

Ciphertext feed-back encryption mode for strict bytestrings (with s == blockSize)

unCfb' :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source

Ciphertext feed-back decryption mode for strict bytestrings (with s == blockSize)

ofb' :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source

Output feedback mode for strict bytestrings

unOfb' :: BlockCipher k => k -> IV k -> ByteString -> (ByteString, IV k)Source

Output feedback mode for strict bytestrings

data IV k Source

Initilization Vectors for BlockCipher implementations (IV k) are used for various modes and guarrenteed to be blockSize bits long.

Instances

Eq (IV k) 
Ord (IV k) 
Show (IV k) 
BlockCipher k => Serialize (IV k) 

getIV :: (BlockCipher k, CryptoRandomGen g) => g -> Either GenError (IV k, g)Source

Obtain an IV using the provided CryptoRandomGenerator.

getIVIO :: BlockCipher k => IO (IV k)Source

Obtain an IV using the system entropy (see System.Crypto.Random)