Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data AESKey128
- data AESKey192
- data AESKey256
- class Serialize k => BlockCipher k where
- blockSize :: Tagged k BitLength
- encryptBlock :: k -> ByteString -> ByteString
- decryptBlock :: k -> ByteString -> ByteString
- buildKey :: ByteString -> Maybe k
- keyLength :: Tagged k BitLength
- ecb :: k -> ByteString -> ByteString
- unEcb :: k -> ByteString -> ByteString
- cbc :: k -> IV k -> ByteString -> (ByteString, IV k)
- unCbc :: k -> IV k -> ByteString -> (ByteString, IV k)
- ctr :: k -> IV k -> ByteString -> (ByteString, IV k)
- unCtr :: k -> IV k -> ByteString -> (ByteString, IV k)
- ctrLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- unCtrLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- cfb :: k -> IV k -> ByteString -> (ByteString, IV k)
- unCfb :: k -> IV k -> ByteString -> (ByteString, IV k)
- ofb :: k -> IV k -> ByteString -> (ByteString, IV k)
- unOfb :: k -> IV k -> ByteString -> (ByteString, IV k)
- cbcLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- unCbcLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- sivLazy :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString
- unSivLazy :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString
- siv :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString
- unSiv :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString
- ecbLazy :: k -> ByteString -> ByteString
- unEcbLazy :: k -> ByteString -> ByteString
- cfbLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- unCfbLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- ofbLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- unOfbLazy :: k -> IV k -> ByteString -> (ByteString, IV k)
- buildKeyIO :: BlockCipher k => IO k
- zeroIV :: BlockCipher k => IV k
- makeGCMCtx :: AES_GCM k => ByteString -> Maybe (GCMCtx k)
- aesKeyToGCM :: AES_GCM k => k -> GCMCtx k
- data GCMCtx k
- data AuthTag = AuthTag {}
- class (BlockCipher k, GetExpanded k) => AES_GCM k
- encryptGCM :: AES_GCM k => GCMCtx k -> ByteString -> ByteString -> ByteString -> (ByteString, AuthTag)
- decryptGCM :: AES_GCM k => GCMCtx k -> ByteString -> ByteString -> ByteString -> (ByteString, AuthTag)
Key types with crypto-api instances
Instances
Instances
Instances
class Serialize k => BlockCipher k where #
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
:: k | |
-> ByteString | |
-> ByteString | encrypt data of size |
:: k | |
-> ByteString | |
-> ByteString | decrypt data of size |
:: ByteString | |
-> Maybe k | smart constructor for keys from a bytestring. |
ecb :: k -> ByteString -> ByteString #
Electronic Cookbook (encryption)
unEcb :: k -> ByteString -> ByteString #
Electronic Cookbook (decryption)
cbc :: k -> IV k -> ByteString -> (ByteString, IV k) #
Cipherblock Chaining (encryption)
unCbc :: k -> IV k -> ByteString -> (ByteString, IV k) #
Cipherblock Chaining (decryption)
ctr :: k -> IV k -> ByteString -> (ByteString, IV k) #
Counter (encryption)
unCtr :: k -> IV k -> ByteString -> (ByteString, IV k) #
Counter (decryption)
ctrLazy :: k -> IV k -> ByteString -> (ByteString, IV k) #
Counter (encryption)
unCtrLazy :: k -> IV k -> ByteString -> (ByteString, IV k) #
Counter (decryption)
cfb :: k -> IV k -> ByteString -> (ByteString, IV k) #
Ciphertext feedback (encryption)
unCfb :: k -> IV k -> ByteString -> (ByteString, IV k) #
Ciphertext feedback (decryption)
ofb :: k -> IV k -> ByteString -> (ByteString, IV k) #
Output feedback (encryption)
unOfb :: k -> IV k -> ByteString -> (ByteString, IV k) #
Output feedback (decryption)
cbcLazy :: k -> IV k -> ByteString -> (ByteString, IV k) #
Cipher block chaining encryption for lazy bytestrings
unCbcLazy :: k -> IV k -> ByteString -> (ByteString, IV k) #
Cipher block chaining decryption for lazy bytestrings
sivLazy :: k -> k -> [ByteString] -> ByteString -> Maybe ByteString #
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 #
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 #
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 #
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 #
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 #
ECB decrypt, complementary to ecb
.
cfbLazy :: k -> IV k -> ByteString -> (ByteString, IV k) #
Ciphertext feed-back encryption mode for lazy bytestrings (with s == blockSize)
unCfbLazy :: k -> IV k -> ByteString -> (ByteString, IV k) #
Ciphertext feed-back decryption mode for lazy bytestrings (with s == blockSize)
ofbLazy :: k -> IV k -> ByteString -> (ByteString, IV k) #
Output feedback mode for lazy bytestrings
unOfbLazy :: k -> IV k -> ByteString -> (ByteString, IV k) #
Output feedback mode for lazy bytestrings
Instances
buildKeyIO :: BlockCipher k => IO k #
Build a symmetric key using the system entropy (see Entropy
)
zeroIV :: BlockCipher k => IV k #
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.
class (BlockCipher k, GetExpanded k) => AES_GCM k Source #
Instances
AES_GCM AESKey256 Source # | |
Defined in Crypto.Cipher.AES128 | |
AES_GCM AESKey192 Source # | |
Defined in Crypto.Cipher.AES128 | |
AES_GCM AESKey128 Source # | |
Defined in Crypto.Cipher.AES128 |
:: AES_GCM k | |
=> GCMCtx k | |
-> ByteString | IV |
-> ByteString | Plaintext |
-> ByteString | AAD |
-> (ByteString, AuthTag) |
Encrypts multiple-of-block-sized input, returning a bytestring and tag.
:: 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].