cipher-aes128-0.7.0.6: AES and common modes using AES-NI when available.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.Cipher.AES128

Synopsis

Key types with crypto-api instances

data AESKey128 Source #

Instances

Instances details
Serialize AESKey128 Source # 
Instance details

Defined in Crypto.Cipher.AES128

AES_GCM AESKey128 Source # 
Instance details

Defined in Crypto.Cipher.AES128

GetExpanded AESKey128 Source # 
Instance details

Defined in Crypto.Cipher.AES128.Internal

Methods

expandedKey :: AESKey128 -> ForeignPtr AESKeyStruct

BlockCipher AESKey128 Source # 
Instance details

Defined in Crypto.Cipher.AES128

Methods

blockSize :: Tagged AESKey128 BitLength Source #

encryptBlock :: AESKey128 -> ByteString -> ByteString Source #

decryptBlock :: AESKey128 -> ByteString -> ByteString Source #

buildKey :: ByteString -> Maybe AESKey128 Source #

keyLength :: Tagged AESKey128 BitLength Source #

ecb :: AESKey128 -> ByteString -> ByteString Source #

unEcb :: AESKey128 -> ByteString -> ByteString Source #

cbc :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCbc :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

ctr :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCtr :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

ctrLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCtrLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

cfb :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCfb :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

ofb :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unOfb :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

cbcLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCbcLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

sivLazy :: AESKey128 -> AESKey128 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSivLazy :: AESKey128 -> AESKey128 -> [ByteString] -> ByteString -> Maybe ByteString Source #

siv :: AESKey128 -> AESKey128 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSiv :: AESKey128 -> AESKey128 -> [ByteString] -> ByteString -> Maybe ByteString Source #

ecbLazy :: AESKey128 -> ByteString -> ByteString Source #

unEcbLazy :: AESKey128 -> ByteString -> ByteString Source #

cfbLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCfbLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

ofbLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unOfbLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

data AESKey192 Source #

Instances

Instances details
Serialize AESKey192 Source # 
Instance details

Defined in Crypto.Cipher.AES128

AES_GCM AESKey192 Source # 
Instance details

Defined in Crypto.Cipher.AES128

GetExpanded AESKey192 Source # 
Instance details

Defined in Crypto.Cipher.AES128.Internal

Methods

expandedKey :: AESKey192 -> ForeignPtr AESKeyStruct

BlockCipher AESKey192 Source # 
Instance details

Defined in Crypto.Cipher.AES128

Methods

blockSize :: Tagged AESKey192 BitLength Source #

encryptBlock :: AESKey192 -> ByteString -> ByteString Source #

decryptBlock :: AESKey192 -> ByteString -> ByteString Source #

buildKey :: ByteString -> Maybe AESKey192 Source #

keyLength :: Tagged AESKey192 BitLength Source #

ecb :: AESKey192 -> ByteString -> ByteString Source #

unEcb :: AESKey192 -> ByteString -> ByteString Source #

cbc :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCbc :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

ctr :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCtr :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

ctrLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCtrLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

cfb :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCfb :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

ofb :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unOfb :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

cbcLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCbcLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

sivLazy :: AESKey192 -> AESKey192 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSivLazy :: AESKey192 -> AESKey192 -> [ByteString] -> ByteString -> Maybe ByteString Source #

siv :: AESKey192 -> AESKey192 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSiv :: AESKey192 -> AESKey192 -> [ByteString] -> ByteString -> Maybe ByteString Source #

ecbLazy :: AESKey192 -> ByteString -> ByteString Source #

unEcbLazy :: AESKey192 -> ByteString -> ByteString Source #

cfbLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCfbLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

ofbLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unOfbLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

data AESKey256 Source #

Instances

Instances details
Serialize AESKey256 Source # 
Instance details

Defined in Crypto.Cipher.AES128

AES_GCM AESKey256 Source # 
Instance details

Defined in Crypto.Cipher.AES128

GetExpanded AESKey256 Source # 
Instance details

Defined in Crypto.Cipher.AES128.Internal

Methods

expandedKey :: AESKey256 -> ForeignPtr AESKeyStruct

BlockCipher AESKey256 Source # 
Instance details

Defined in Crypto.Cipher.AES128

Methods

blockSize :: Tagged AESKey256 BitLength Source #

encryptBlock :: AESKey256 -> ByteString -> ByteString Source #

decryptBlock :: AESKey256 -> ByteString -> ByteString Source #

buildKey :: ByteString -> Maybe AESKey256 Source #

keyLength :: Tagged AESKey256 BitLength Source #

ecb :: AESKey256 -> ByteString -> ByteString Source #

unEcb :: AESKey256 -> ByteString -> ByteString Source #

cbc :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCbc :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

ctr :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCtr :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

ctrLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCtrLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

cfb :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCfb :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

ofb :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unOfb :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

cbcLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCbcLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

sivLazy :: AESKey256 -> AESKey256 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSivLazy :: AESKey256 -> AESKey256 -> [ByteString] -> ByteString -> Maybe ByteString Source #

siv :: AESKey256 -> AESKey256 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSiv :: AESKey256 -> AESKey256 -> [ByteString] -> ByteString -> Maybe ByteString Source #

ecbLazy :: AESKey256 -> ByteString -> ByteString Source #

unEcbLazy :: AESKey256 -> ByteString -> ByteString Source #

cfbLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCfbLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

ofbLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unOfbLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

class Serialize k => BlockCipher k where Source #

The BlockCipher class is intended as the generic interface targeted by maintainers of Haskell cipher implementations.

Minimum complete definition: blockSize, encryptBlock, decryptBlock, buildKey, and keyLength.

Instances must handle unaligned data

Minimal complete definition

blockSize, encryptBlock, decryptBlock, buildKey, keyLength

Methods

blockSize Source #

Arguments

:: Tagged k BitLength

The size of a single block; the smallest unit on which the cipher operates.

encryptBlock Source #

Arguments

:: k 
-> ByteString 
-> ByteString

encrypt data of size n*blockSize where n elem [0..] (ecb encryption)

decryptBlock Source #

Arguments

:: k 
-> ByteString 
-> ByteString

decrypt data of size n*blockSize where n elem [0..] (ecb decryption)

buildKey Source #

Arguments

:: ByteString 
-> Maybe k

smart constructor for keys from a bytestring.

keyLength Source #

Arguments

:: Tagged k BitLength

length of the cryptographic key

ecb :: k -> ByteString -> ByteString Source #

Electronic Cookbook (encryption)

unEcb :: k -> ByteString -> ByteString Source #

Electronic Cookbook (decryption)

cbc :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Cipherblock Chaining (encryption)

unCbc :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Cipherblock Chaining (decryption)

ctr :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Counter (encryption)

unCtr :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Counter (decryption)

ctrLazy :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Counter (encryption)

unCtrLazy :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Counter (decryption)

cfb :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Ciphertext feedback (encryption)

unCfb :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Ciphertext feedback (decryption)

ofb :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Output feedback (encryption)

unOfb :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Output feedback (decryption)

cbcLazy :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Cipher block chaining encryption for lazy bytestrings

unCbcLazy :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Cipher block chaining decryption for lazy bytestrings

sivLazy :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString Source #

SIV (Synthetic IV) mode for lazy bytestrings. The third argument is the optional list of bytestrings to be authenticated but not encrypted As required by the specification this algorithm may return nothing when certain constraints aren't met.

unSivLazy :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString Source #

SIV (Synthetic IV) for lazy bytestrings. The third argument is the optional list of bytestrings to be authenticated but not encrypted. As required by the specification this algorithm may return nothing when authentication fails.

siv :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString Source #

SIV (Synthetic IV) mode for strict bytestrings. First argument is the optional list of bytestrings to be authenticated but not encrypted. As required by the specification this algorithm may return nothing when certain constraints aren't met.

unSiv :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString Source #

SIV (Synthetic IV) for strict bytestrings First argument is the optional list of bytestrings to be authenticated but not encrypted As required by the specification this algorithm may return nothing when authentication fails.

ecbLazy :: k -> ByteString -> ByteString Source #

Cook book mode - not really a mode at all. If you don't know what you're doing, don't use this mode^H^H^H^H library.

unEcbLazy :: k -> ByteString -> ByteString Source #

ECB decrypt, complementary to ecb.

cfbLazy :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

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

unCfbLazy :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

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

ofbLazy :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Output feedback mode for lazy bytestrings

unOfbLazy :: k -> IV k -> ByteString -> (ByteString, IV k) Source #

Output feedback mode for lazy bytestrings

Instances

Instances details
BlockCipher AESKey128 Source # 
Instance details

Defined in Crypto.Cipher.AES128

Methods

blockSize :: Tagged AESKey128 BitLength Source #

encryptBlock :: AESKey128 -> ByteString -> ByteString Source #

decryptBlock :: AESKey128 -> ByteString -> ByteString Source #

buildKey :: ByteString -> Maybe AESKey128 Source #

keyLength :: Tagged AESKey128 BitLength Source #

ecb :: AESKey128 -> ByteString -> ByteString Source #

unEcb :: AESKey128 -> ByteString -> ByteString Source #

cbc :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCbc :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

ctr :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCtr :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

ctrLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCtrLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

cfb :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCfb :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

ofb :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unOfb :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

cbcLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCbcLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

sivLazy :: AESKey128 -> AESKey128 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSivLazy :: AESKey128 -> AESKey128 -> [ByteString] -> ByteString -> Maybe ByteString Source #

siv :: AESKey128 -> AESKey128 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSiv :: AESKey128 -> AESKey128 -> [ByteString] -> ByteString -> Maybe ByteString Source #

ecbLazy :: AESKey128 -> ByteString -> ByteString Source #

unEcbLazy :: AESKey128 -> ByteString -> ByteString Source #

cfbLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCfbLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

ofbLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unOfbLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

BlockCipher AESKey192 Source # 
Instance details

Defined in Crypto.Cipher.AES128

Methods

blockSize :: Tagged AESKey192 BitLength Source #

encryptBlock :: AESKey192 -> ByteString -> ByteString Source #

decryptBlock :: AESKey192 -> ByteString -> ByteString Source #

buildKey :: ByteString -> Maybe AESKey192 Source #

keyLength :: Tagged AESKey192 BitLength Source #

ecb :: AESKey192 -> ByteString -> ByteString Source #

unEcb :: AESKey192 -> ByteString -> ByteString Source #

cbc :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCbc :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

ctr :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCtr :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

ctrLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCtrLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

cfb :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCfb :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

ofb :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unOfb :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

cbcLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCbcLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

sivLazy :: AESKey192 -> AESKey192 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSivLazy :: AESKey192 -> AESKey192 -> [ByteString] -> ByteString -> Maybe ByteString Source #

siv :: AESKey192 -> AESKey192 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSiv :: AESKey192 -> AESKey192 -> [ByteString] -> ByteString -> Maybe ByteString Source #

ecbLazy :: AESKey192 -> ByteString -> ByteString Source #

unEcbLazy :: AESKey192 -> ByteString -> ByteString Source #

cfbLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCfbLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

ofbLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unOfbLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

BlockCipher AESKey256 Source # 
Instance details

Defined in Crypto.Cipher.AES128

Methods

blockSize :: Tagged AESKey256 BitLength Source #

encryptBlock :: AESKey256 -> ByteString -> ByteString Source #

decryptBlock :: AESKey256 -> ByteString -> ByteString Source #

buildKey :: ByteString -> Maybe AESKey256 Source #

keyLength :: Tagged AESKey256 BitLength Source #

ecb :: AESKey256 -> ByteString -> ByteString Source #

unEcb :: AESKey256 -> ByteString -> ByteString Source #

cbc :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCbc :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

ctr :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCtr :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

ctrLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCtrLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

cfb :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCfb :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

ofb :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unOfb :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

cbcLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCbcLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

sivLazy :: AESKey256 -> AESKey256 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSivLazy :: AESKey256 -> AESKey256 -> [ByteString] -> ByteString -> Maybe ByteString Source #

siv :: AESKey256 -> AESKey256 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSiv :: AESKey256 -> AESKey256 -> [ByteString] -> ByteString -> Maybe ByteString Source #

ecbLazy :: AESKey256 -> ByteString -> ByteString Source #

unEcbLazy :: AESKey256 -> ByteString -> ByteString Source #

cfbLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCfbLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

ofbLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unOfbLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

buildKeyIO :: BlockCipher k => IO k Source #

Build a symmetric key using the system entropy (see Entropy)

zeroIV :: BlockCipher k => IV k Source #

Obtain an IV made only of zeroes

GCM Operations

makeGCMCtx :: AES_GCM k => ByteString -> Maybe (GCMCtx k) Source #

Given key material produce a context useful for GCM operations

aesKeyToGCM :: AES_GCM k => k -> GCMCtx k Source #

Given an AESKey produce a GCM Context.

data GCMCtx k Source #

A tuple of key and precomputed data for use by GCM

data AuthTag Source #

Constructors

AuthTag 

Instances

Instances details
Eq AuthTag Source # 
Instance details

Defined in Crypto.Cipher.AES128

class (BlockCipher k, GetExpanded k) => AES_GCM k Source #

Instances

Instances details
AES_GCM AESKey128 Source # 
Instance details

Defined in Crypto.Cipher.AES128

AES_GCM AESKey192 Source # 
Instance details

Defined in Crypto.Cipher.AES128

AES_GCM AESKey256 Source # 
Instance details

Defined in Crypto.Cipher.AES128

encryptGCM Source #

Arguments

:: AES_GCM k 
=> GCMCtx k 
-> ByteString

IV

-> ByteString

Plaintext

-> ByteString

AAD

-> (ByteString, AuthTag) 

Encrypts multiple-of-block-sized input, returning a bytestring and tag.

decryptGCM Source #

Arguments

:: AES_GCM k 
=> GCMCtx k 
-> ByteString

IV

-> ByteString

Ciphertext

-> ByteString

AAD

-> (ByteString, AuthTag)

Plaintext and incremented context (or an error)

Decrypts multiple-of-block-sized input, returing a bytestring of the [ctr, ct, tag].

Orphan instances

Serialize AESKey128 Source # 
Instance details

Serialize AESKey192 Source # 
Instance details

Serialize AESKey256 Source # 
Instance details

BlockCipher AESKey128 Source # 
Instance details

Methods

blockSize :: Tagged AESKey128 BitLength Source #

encryptBlock :: AESKey128 -> ByteString -> ByteString Source #

decryptBlock :: AESKey128 -> ByteString -> ByteString Source #

buildKey :: ByteString -> Maybe AESKey128 Source #

keyLength :: Tagged AESKey128 BitLength Source #

ecb :: AESKey128 -> ByteString -> ByteString Source #

unEcb :: AESKey128 -> ByteString -> ByteString Source #

cbc :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCbc :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

ctr :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCtr :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

ctrLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCtrLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

cfb :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCfb :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

ofb :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unOfb :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

cbcLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCbcLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

sivLazy :: AESKey128 -> AESKey128 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSivLazy :: AESKey128 -> AESKey128 -> [ByteString] -> ByteString -> Maybe ByteString Source #

siv :: AESKey128 -> AESKey128 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSiv :: AESKey128 -> AESKey128 -> [ByteString] -> ByteString -> Maybe ByteString Source #

ecbLazy :: AESKey128 -> ByteString -> ByteString Source #

unEcbLazy :: AESKey128 -> ByteString -> ByteString Source #

cfbLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unCfbLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

ofbLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

unOfbLazy :: AESKey128 -> IV AESKey128 -> ByteString -> (ByteString, IV AESKey128) Source #

BlockCipher AESKey192 Source # 
Instance details

Methods

blockSize :: Tagged AESKey192 BitLength Source #

encryptBlock :: AESKey192 -> ByteString -> ByteString Source #

decryptBlock :: AESKey192 -> ByteString -> ByteString Source #

buildKey :: ByteString -> Maybe AESKey192 Source #

keyLength :: Tagged AESKey192 BitLength Source #

ecb :: AESKey192 -> ByteString -> ByteString Source #

unEcb :: AESKey192 -> ByteString -> ByteString Source #

cbc :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCbc :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

ctr :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCtr :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

ctrLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCtrLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

cfb :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCfb :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

ofb :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unOfb :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

cbcLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCbcLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

sivLazy :: AESKey192 -> AESKey192 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSivLazy :: AESKey192 -> AESKey192 -> [ByteString] -> ByteString -> Maybe ByteString Source #

siv :: AESKey192 -> AESKey192 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSiv :: AESKey192 -> AESKey192 -> [ByteString] -> ByteString -> Maybe ByteString Source #

ecbLazy :: AESKey192 -> ByteString -> ByteString Source #

unEcbLazy :: AESKey192 -> ByteString -> ByteString Source #

cfbLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unCfbLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

ofbLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

unOfbLazy :: AESKey192 -> IV AESKey192 -> ByteString -> (ByteString, IV AESKey192) Source #

BlockCipher AESKey256 Source # 
Instance details

Methods

blockSize :: Tagged AESKey256 BitLength Source #

encryptBlock :: AESKey256 -> ByteString -> ByteString Source #

decryptBlock :: AESKey256 -> ByteString -> ByteString Source #

buildKey :: ByteString -> Maybe AESKey256 Source #

keyLength :: Tagged AESKey256 BitLength Source #

ecb :: AESKey256 -> ByteString -> ByteString Source #

unEcb :: AESKey256 -> ByteString -> ByteString Source #

cbc :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCbc :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

ctr :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCtr :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

ctrLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCtrLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

cfb :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCfb :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

ofb :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unOfb :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

cbcLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCbcLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

sivLazy :: AESKey256 -> AESKey256 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSivLazy :: AESKey256 -> AESKey256 -> [ByteString] -> ByteString -> Maybe ByteString Source #

siv :: AESKey256 -> AESKey256 -> [ByteString] -> ByteString -> Maybe ByteString Source #

unSiv :: AESKey256 -> AESKey256 -> [ByteString] -> ByteString -> Maybe ByteString Source #

ecbLazy :: AESKey256 -> ByteString -> ByteString Source #

unEcbLazy :: AESKey256 -> ByteString -> ByteString Source #

cfbLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unCfbLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

ofbLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #

unOfbLazy :: AESKey256 -> IV AESKey256 -> ByteString -> (ByteString, IV AESKey256) Source #