Crypto.Cipher.AES

cryptocipher-0.2.8: Symmetrical Block, Stream and PubKey Ciphers

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | Good
Safe Haskell | None
Language | Haskell98

Crypto.Cipher.AES

Contents

- Basic encryption and decryption
- CBC encryption and decryption
- key building mechanism
- Wrappers for "crypto-api" instances

Description

Synopsis

- data Key
- type IV = ByteString
- encrypt :: Key -> ByteString -> ByteString
- decrypt :: Key -> ByteString -> ByteString
- encryptCBC :: Key -> IV -> ByteString -> ByteString
- decryptCBC :: Key -> IV -> ByteString -> ByteString
- initKey128 :: ByteString -> Either String Key
- initKey192 :: ByteString -> Either String Key
- initKey256 :: ByteString -> Either String Key
- data AES128
- data AES192
- data AES256

# Documentation

data Key

Instances

Eq Key |
Show Key |

type IV = ByteString

# Basic encryption and decryption

encrypt :: Key -> ByteString -> ByteString

encrypt using simple EBC mode

decrypt :: Key -> ByteString -> ByteString

decrypt using simple EBC mode

# CBC encryption and decryption

encryptCBC :: Key -> IV -> ByteString -> ByteString

encrypt using CBC mode - IV need to be 16 bytes and the data to encrypt a multiple of 16 bytes

decryptCBC :: Key -> IV -> ByteString -> ByteString

decrypt using CBC mode - IV need to be 16 bytes and the data to decrypt a multiple of 16 bytes

# key building mechanism

initKey128 :: ByteString -> Either String Key

initKey192 :: ByteString -> Either String Key

initKey256 :: ByteString -> Either String Key

# Wrappers for "crypto-api" instances

data AES128

Instances

Serialize AES128 |
BlockCipher AES128 |

data AES192

Instances

Serialize AES192 |
BlockCipher AES192 |

data AES256

Instances

Serialize AES256 |
BlockCipher AES256 |