-- |
-- Module      : Network.TLS.Extra.Cipher
-- License     : BSD-style
-- Maintainer  : Vincent Hanquez <vincent@snarc.org>
-- Stability   : experimental
-- Portability : unknown
--
module Network.TLS.Extra.Cipher
    (
    -- * cipher suite
      ciphersuite_default
    , ciphersuite_all
    , ciphersuite_medium
    , ciphersuite_strong
    , ciphersuite_unencrypted
    , ciphersuite_dhe_rsa
    , ciphersuite_dhe_dss
    -- * individual ciphers
    , cipher_null_SHA1
    , cipher_AES128_SHA1
    , cipher_AES256_SHA1
    , cipher_AES128_SHA256
    , cipher_AES256_SHA256
    , cipher_AES128CCM_SHA256
    , cipher_AES128CCM8_SHA256
    , cipher_AES128GCM_SHA256
    , cipher_AES256CCM_SHA256
    , cipher_AES256CCM8_SHA256
    , cipher_AES256GCM_SHA384
    , cipher_DHE_RSA_AES128_SHA1
    , cipher_DHE_RSA_AES256_SHA1
    , cipher_DHE_RSA_AES128_SHA256
    , cipher_DHE_RSA_AES256_SHA256
    , cipher_DHE_DSS_AES128_SHA1
    , cipher_DHE_DSS_AES256_SHA1
    , cipher_DHE_RSA_AES128CCM_SHA256
    , cipher_DHE_RSA_AES128CCM8_SHA256
    , cipher_DHE_RSA_AES128GCM_SHA256
    , cipher_DHE_RSA_AES256CCM_SHA256
    , cipher_DHE_RSA_AES256CCM8_SHA256
    , cipher_DHE_RSA_AES256GCM_SHA384
    , cipher_DHE_RSA_CHACHA20POLY1305_SHA256
    , cipher_ECDHE_RSA_AES128GCM_SHA256
    , cipher_ECDHE_RSA_AES256GCM_SHA384
    , cipher_ECDHE_RSA_AES128CBC_SHA256
    , cipher_ECDHE_RSA_AES128CBC_SHA
    , cipher_ECDHE_RSA_AES256CBC_SHA
    , cipher_ECDHE_RSA_AES256CBC_SHA384
    , cipher_ECDHE_RSA_CHACHA20POLY1305_SHA256
    , cipher_ECDHE_ECDSA_AES128CBC_SHA
    , cipher_ECDHE_ECDSA_AES256CBC_SHA
    , cipher_ECDHE_ECDSA_AES128CBC_SHA256
    , cipher_ECDHE_ECDSA_AES256CBC_SHA384
    , cipher_ECDHE_ECDSA_AES128CCM_SHA256
    , cipher_ECDHE_ECDSA_AES128CCM8_SHA256
    , cipher_ECDHE_ECDSA_AES128GCM_SHA256
    , cipher_ECDHE_ECDSA_AES256CCM_SHA256
    , cipher_ECDHE_ECDSA_AES256CCM8_SHA256
    , cipher_ECDHE_ECDSA_AES256GCM_SHA384
    , cipher_ECDHE_ECDSA_CHACHA20POLY1305_SHA256
    -- TLS 1.3
    , cipher_TLS13_AES128GCM_SHA256
    , cipher_TLS13_AES256GCM_SHA384
    , cipher_TLS13_CHACHA20POLY1305_SHA256
    , cipher_TLS13_AES128CCM_SHA256
    , cipher_TLS13_AES128CCM8_SHA256
    -- * obsolete and non-standard ciphers
    , cipher_RSA_3DES_EDE_CBC_SHA1
    , cipher_RC4_128_MD5
    , cipher_RC4_128_SHA1
    , cipher_null_MD5
    , cipher_DHE_DSS_RC4_SHA1
    ) where

import qualified Data.ByteString as B

import Network.TLS.Types (Version(..))
import Network.TLS.Cipher
import Network.TLS.Imports
import Data.Tuple (swap)

import Crypto.Cipher.AES
import qualified Crypto.Cipher.ChaChaPoly1305 as ChaChaPoly1305
import qualified Crypto.Cipher.RC4 as RC4
import Crypto.Cipher.TripleDES
import Crypto.Cipher.Types hiding (Cipher, cipherName)
import Crypto.Error
import qualified Crypto.MAC.Poly1305 as Poly1305

takelast :: Int -> B.ByteString -> B.ByteString
takelast :: Int -> ByteString -> ByteString
takelast i :: Int
i b :: ByteString
b = Int -> ByteString -> ByteString
B.drop (ByteString -> Int
B.length ByteString
b Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
i) ByteString
b

aes128cbc :: BulkDirection -> BulkKey -> BulkBlock
aes128cbc :: BulkDirection -> ByteString -> BulkBlock
aes128cbc BulkEncrypt key :: ByteString
key =
    let ctx :: AES128
ctx = CryptoFailable AES128 -> AES128
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES128
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES128
     in (\iv :: ByteString
iv input :: ByteString
input -> let output :: ByteString
output = AES128 -> IV AES128 -> ByteString -> ByteString
forall cipher ba.
(BlockCipher cipher, ByteArray ba) =>
cipher -> IV cipher -> ba -> ba
cbcEncrypt AES128
ctx (ByteString -> IV AES128
forall a. BlockCipher a => ByteString -> IV a
makeIV_ ByteString
iv) ByteString
input in (ByteString
output, Int -> ByteString -> ByteString
takelast 16 ByteString
output))
aes128cbc BulkDecrypt key :: ByteString
key =
    let ctx :: AES128
ctx = CryptoFailable AES128 -> AES128
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES128
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES128
     in (\iv :: ByteString
iv input :: ByteString
input -> let output :: ByteString
output = AES128 -> IV AES128 -> ByteString -> ByteString
forall cipher ba.
(BlockCipher cipher, ByteArray ba) =>
cipher -> IV cipher -> ba -> ba
cbcDecrypt AES128
ctx (ByteString -> IV AES128
forall a. BlockCipher a => ByteString -> IV a
makeIV_ ByteString
iv) ByteString
input in (ByteString
output, Int -> ByteString -> ByteString
takelast 16 ByteString
input))

aes256cbc :: BulkDirection -> BulkKey -> BulkBlock
aes256cbc :: BulkDirection -> ByteString -> BulkBlock
aes256cbc BulkEncrypt key :: ByteString
key =
    let ctx :: AES256
ctx = CryptoFailable AES256 -> AES256
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES256
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES256
     in (\iv :: ByteString
iv input :: ByteString
input -> let output :: ByteString
output = AES256 -> IV AES256 -> ByteString -> ByteString
forall cipher ba.
(BlockCipher cipher, ByteArray ba) =>
cipher -> IV cipher -> ba -> ba
cbcEncrypt AES256
ctx (ByteString -> IV AES256
forall a. BlockCipher a => ByteString -> IV a
makeIV_ ByteString
iv) ByteString
input in (ByteString
output, Int -> ByteString -> ByteString
takelast 16 ByteString
output))
aes256cbc BulkDecrypt key :: ByteString
key =
    let ctx :: AES256
ctx = CryptoFailable AES256 -> AES256
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES256
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES256
     in (\iv :: ByteString
iv input :: ByteString
input -> let output :: ByteString
output = AES256 -> IV AES256 -> ByteString -> ByteString
forall cipher ba.
(BlockCipher cipher, ByteArray ba) =>
cipher -> IV cipher -> ba -> ba
cbcDecrypt AES256
ctx (ByteString -> IV AES256
forall a. BlockCipher a => ByteString -> IV a
makeIV_ ByteString
iv) ByteString
input in (ByteString
output, Int -> ByteString -> ByteString
takelast 16 ByteString
input))

aes128ccm :: BulkDirection -> BulkKey -> BulkAEAD
aes128ccm :: BulkDirection -> ByteString -> BulkAEAD
aes128ccm BulkEncrypt key :: ByteString
key =
    let ctx :: AES128
ctx = CryptoFailable AES128 -> AES128
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES128
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES128
     in (\nonce :: ByteString
nonce d :: ByteString
d ad :: ByteString
ad ->
            let mode :: AEADMode
mode = Int -> CCM_M -> CCM_L -> AEADMode
AEAD_CCM (ByteString -> Int
B.length ByteString
d) CCM_M
CCM_M16 CCM_L
CCM_L3
                aeadIni :: AEAD AES128
aeadIni = CryptoFailable (AEAD AES128) -> AEAD AES128
forall a. CryptoFailable a -> a
noFail (AEADMode -> AES128 -> ByteString -> CryptoFailable (AEAD AES128)
forall cipher iv.
(BlockCipher cipher, ByteArrayAccess iv) =>
AEADMode -> cipher -> iv -> CryptoFailable (AEAD cipher)
aeadInit AEADMode
mode AES128
ctx ByteString
nonce)
             in (AuthTag, ByteString) -> (ByteString, AuthTag)
forall a b. (a, b) -> (b, a)
swap ((AuthTag, ByteString) -> (ByteString, AuthTag))
-> (AuthTag, ByteString) -> (ByteString, AuthTag)
forall a b. (a -> b) -> a -> b
$ AEAD AES128
-> ByteString -> ByteString -> Int -> (AuthTag, ByteString)
forall aad ba a.
(ByteArrayAccess aad, ByteArray ba) =>
AEAD a -> aad -> ba -> Int -> (AuthTag, ba)
aeadSimpleEncrypt AEAD AES128
aeadIni ByteString
ad ByteString
d 16)
aes128ccm BulkDecrypt key :: ByteString
key =
    let ctx :: AES128
ctx = CryptoFailable AES128 -> AES128
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES128
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES128
     in (\nonce :: ByteString
nonce d :: ByteString
d ad :: ByteString
ad ->
            let mode :: AEADMode
mode = Int -> CCM_M -> CCM_L -> AEADMode
AEAD_CCM (ByteString -> Int
B.length ByteString
d) CCM_M
CCM_M16 CCM_L
CCM_L3
                aeadIni :: AEAD AES128
aeadIni = CryptoFailable (AEAD AES128) -> AEAD AES128
forall a. CryptoFailable a -> a
noFail (AEADMode -> AES128 -> ByteString -> CryptoFailable (AEAD AES128)
forall cipher iv.
(BlockCipher cipher, ByteArrayAccess iv) =>
AEADMode -> cipher -> iv -> CryptoFailable (AEAD cipher)
aeadInit AEADMode
mode AES128
ctx ByteString
nonce)
             in AEAD AES128
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
forall cipher.
AEAD cipher
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
simpleDecrypt AEAD AES128
aeadIni ByteString
ad ByteString
d 16)

aes128ccm8 :: BulkDirection -> BulkKey -> BulkAEAD
aes128ccm8 :: BulkDirection -> ByteString -> BulkAEAD
aes128ccm8 BulkEncrypt key :: ByteString
key =
    let ctx :: AES128
ctx = CryptoFailable AES128 -> AES128
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES128
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES128
     in (\nonce :: ByteString
nonce d :: ByteString
d ad :: ByteString
ad ->
            let mode :: AEADMode
mode = Int -> CCM_M -> CCM_L -> AEADMode
AEAD_CCM (ByteString -> Int
B.length ByteString
d) CCM_M
CCM_M8 CCM_L
CCM_L3
                aeadIni :: AEAD AES128
aeadIni = CryptoFailable (AEAD AES128) -> AEAD AES128
forall a. CryptoFailable a -> a
noFail (AEADMode -> AES128 -> ByteString -> CryptoFailable (AEAD AES128)
forall cipher iv.
(BlockCipher cipher, ByteArrayAccess iv) =>
AEADMode -> cipher -> iv -> CryptoFailable (AEAD cipher)
aeadInit AEADMode
mode AES128
ctx ByteString
nonce)
             in (AuthTag, ByteString) -> (ByteString, AuthTag)
forall a b. (a, b) -> (b, a)
swap ((AuthTag, ByteString) -> (ByteString, AuthTag))
-> (AuthTag, ByteString) -> (ByteString, AuthTag)
forall a b. (a -> b) -> a -> b
$ AEAD AES128
-> ByteString -> ByteString -> Int -> (AuthTag, ByteString)
forall aad ba a.
(ByteArrayAccess aad, ByteArray ba) =>
AEAD a -> aad -> ba -> Int -> (AuthTag, ba)
aeadSimpleEncrypt AEAD AES128
aeadIni ByteString
ad ByteString
d 8)
aes128ccm8 BulkDecrypt key :: ByteString
key =
    let ctx :: AES128
ctx = CryptoFailable AES128 -> AES128
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES128
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES128
     in (\nonce :: ByteString
nonce d :: ByteString
d ad :: ByteString
ad ->
            let mode :: AEADMode
mode = Int -> CCM_M -> CCM_L -> AEADMode
AEAD_CCM (ByteString -> Int
B.length ByteString
d) CCM_M
CCM_M8 CCM_L
CCM_L3
                aeadIni :: AEAD AES128
aeadIni = CryptoFailable (AEAD AES128) -> AEAD AES128
forall a. CryptoFailable a -> a
noFail (AEADMode -> AES128 -> ByteString -> CryptoFailable (AEAD AES128)
forall cipher iv.
(BlockCipher cipher, ByteArrayAccess iv) =>
AEADMode -> cipher -> iv -> CryptoFailable (AEAD cipher)
aeadInit AEADMode
mode AES128
ctx ByteString
nonce)
             in AEAD AES128
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
forall cipher.
AEAD cipher
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
simpleDecrypt AEAD AES128
aeadIni ByteString
ad ByteString
d 8)

aes128gcm :: BulkDirection -> BulkKey -> BulkAEAD
aes128gcm :: BulkDirection -> ByteString -> BulkAEAD
aes128gcm BulkEncrypt key :: ByteString
key =
    let ctx :: AES128
ctx = CryptoFailable AES128 -> AES128
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES128
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES128
     in (\nonce :: ByteString
nonce d :: ByteString
d ad :: ByteString
ad ->
            let aeadIni :: AEAD AES128
aeadIni = CryptoFailable (AEAD AES128) -> AEAD AES128
forall a. CryptoFailable a -> a
noFail (AEADMode -> AES128 -> ByteString -> CryptoFailable (AEAD AES128)
forall cipher iv.
(BlockCipher cipher, ByteArrayAccess iv) =>
AEADMode -> cipher -> iv -> CryptoFailable (AEAD cipher)
aeadInit AEADMode
AEAD_GCM AES128
ctx ByteString
nonce)
             in (AuthTag, ByteString) -> (ByteString, AuthTag)
forall a b. (a, b) -> (b, a)
swap ((AuthTag, ByteString) -> (ByteString, AuthTag))
-> (AuthTag, ByteString) -> (ByteString, AuthTag)
forall a b. (a -> b) -> a -> b
$ AEAD AES128
-> ByteString -> ByteString -> Int -> (AuthTag, ByteString)
forall aad ba a.
(ByteArrayAccess aad, ByteArray ba) =>
AEAD a -> aad -> ba -> Int -> (AuthTag, ba)
aeadSimpleEncrypt AEAD AES128
aeadIni ByteString
ad ByteString
d 16)
aes128gcm BulkDecrypt key :: ByteString
key =
    let ctx :: AES128
ctx = CryptoFailable AES128 -> AES128
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES128
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES128
     in (\nonce :: ByteString
nonce d :: ByteString
d ad :: ByteString
ad ->
            let aeadIni :: AEAD AES128
aeadIni = CryptoFailable (AEAD AES128) -> AEAD AES128
forall a. CryptoFailable a -> a
noFail (AEADMode -> AES128 -> ByteString -> CryptoFailable (AEAD AES128)
forall cipher iv.
(BlockCipher cipher, ByteArrayAccess iv) =>
AEADMode -> cipher -> iv -> CryptoFailable (AEAD cipher)
aeadInit AEADMode
AEAD_GCM AES128
ctx ByteString
nonce)
             in AEAD AES128
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
forall cipher.
AEAD cipher
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
simpleDecrypt AEAD AES128
aeadIni ByteString
ad ByteString
d 16)

aes256ccm :: BulkDirection -> BulkKey -> BulkAEAD
aes256ccm :: BulkDirection -> ByteString -> BulkAEAD
aes256ccm BulkEncrypt key :: ByteString
key =
    let ctx :: AES256
ctx = CryptoFailable AES256 -> AES256
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES256
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES256
     in (\nonce :: ByteString
nonce d :: ByteString
d ad :: ByteString
ad ->
            let mode :: AEADMode
mode = Int -> CCM_M -> CCM_L -> AEADMode
AEAD_CCM (ByteString -> Int
B.length ByteString
d) CCM_M
CCM_M16 CCM_L
CCM_L3
                aeadIni :: AEAD AES256
aeadIni = CryptoFailable (AEAD AES256) -> AEAD AES256
forall a. CryptoFailable a -> a
noFail (AEADMode -> AES256 -> ByteString -> CryptoFailable (AEAD AES256)
forall cipher iv.
(BlockCipher cipher, ByteArrayAccess iv) =>
AEADMode -> cipher -> iv -> CryptoFailable (AEAD cipher)
aeadInit AEADMode
mode AES256
ctx ByteString
nonce)
             in (AuthTag, ByteString) -> (ByteString, AuthTag)
forall a b. (a, b) -> (b, a)
swap ((AuthTag, ByteString) -> (ByteString, AuthTag))
-> (AuthTag, ByteString) -> (ByteString, AuthTag)
forall a b. (a -> b) -> a -> b
$ AEAD AES256
-> ByteString -> ByteString -> Int -> (AuthTag, ByteString)
forall aad ba a.
(ByteArrayAccess aad, ByteArray ba) =>
AEAD a -> aad -> ba -> Int -> (AuthTag, ba)
aeadSimpleEncrypt AEAD AES256
aeadIni ByteString
ad ByteString
d 16)
aes256ccm BulkDecrypt key :: ByteString
key =
    let ctx :: AES256
ctx = CryptoFailable AES256 -> AES256
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES256
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES256
     in (\nonce :: ByteString
nonce d :: ByteString
d ad :: ByteString
ad ->
            let mode :: AEADMode
mode = Int -> CCM_M -> CCM_L -> AEADMode
AEAD_CCM (ByteString -> Int
B.length ByteString
d) CCM_M
CCM_M16 CCM_L
CCM_L3
                aeadIni :: AEAD AES256
aeadIni = CryptoFailable (AEAD AES256) -> AEAD AES256
forall a. CryptoFailable a -> a
noFail (AEADMode -> AES256 -> ByteString -> CryptoFailable (AEAD AES256)
forall cipher iv.
(BlockCipher cipher, ByteArrayAccess iv) =>
AEADMode -> cipher -> iv -> CryptoFailable (AEAD cipher)
aeadInit AEADMode
mode AES256
ctx ByteString
nonce)
             in AEAD AES256
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
forall cipher.
AEAD cipher
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
simpleDecrypt AEAD AES256
aeadIni ByteString
ad ByteString
d 16)

aes256ccm8 :: BulkDirection -> BulkKey -> BulkAEAD
aes256ccm8 :: BulkDirection -> ByteString -> BulkAEAD
aes256ccm8 BulkEncrypt key :: ByteString
key =
    let ctx :: AES256
ctx = CryptoFailable AES256 -> AES256
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES256
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES256
     in (\nonce :: ByteString
nonce d :: ByteString
d ad :: ByteString
ad ->
            let mode :: AEADMode
mode = Int -> CCM_M -> CCM_L -> AEADMode
AEAD_CCM (ByteString -> Int
B.length ByteString
d) CCM_M
CCM_M8 CCM_L
CCM_L3
                aeadIni :: AEAD AES256
aeadIni = CryptoFailable (AEAD AES256) -> AEAD AES256
forall a. CryptoFailable a -> a
noFail (AEADMode -> AES256 -> ByteString -> CryptoFailable (AEAD AES256)
forall cipher iv.
(BlockCipher cipher, ByteArrayAccess iv) =>
AEADMode -> cipher -> iv -> CryptoFailable (AEAD cipher)
aeadInit AEADMode
mode AES256
ctx ByteString
nonce)
             in (AuthTag, ByteString) -> (ByteString, AuthTag)
forall a b. (a, b) -> (b, a)
swap ((AuthTag, ByteString) -> (ByteString, AuthTag))
-> (AuthTag, ByteString) -> (ByteString, AuthTag)
forall a b. (a -> b) -> a -> b
$ AEAD AES256
-> ByteString -> ByteString -> Int -> (AuthTag, ByteString)
forall aad ba a.
(ByteArrayAccess aad, ByteArray ba) =>
AEAD a -> aad -> ba -> Int -> (AuthTag, ba)
aeadSimpleEncrypt AEAD AES256
aeadIni ByteString
ad ByteString
d 8)
aes256ccm8 BulkDecrypt key :: ByteString
key =
    let ctx :: AES256
ctx = CryptoFailable AES256 -> AES256
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES256
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES256
     in (\nonce :: ByteString
nonce d :: ByteString
d ad :: ByteString
ad ->
            let mode :: AEADMode
mode = Int -> CCM_M -> CCM_L -> AEADMode
AEAD_CCM (ByteString -> Int
B.length ByteString
d) CCM_M
CCM_M8 CCM_L
CCM_L3
                aeadIni :: AEAD AES256
aeadIni = CryptoFailable (AEAD AES256) -> AEAD AES256
forall a. CryptoFailable a -> a
noFail (AEADMode -> AES256 -> ByteString -> CryptoFailable (AEAD AES256)
forall cipher iv.
(BlockCipher cipher, ByteArrayAccess iv) =>
AEADMode -> cipher -> iv -> CryptoFailable (AEAD cipher)
aeadInit AEADMode
mode AES256
ctx ByteString
nonce)
             in AEAD AES256
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
forall cipher.
AEAD cipher
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
simpleDecrypt AEAD AES256
aeadIni ByteString
ad ByteString
d 8)

aes256gcm :: BulkDirection -> BulkKey -> BulkAEAD
aes256gcm :: BulkDirection -> ByteString -> BulkAEAD
aes256gcm BulkEncrypt key :: ByteString
key =
    let ctx :: AES256
ctx = CryptoFailable AES256 -> AES256
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES256
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES256
     in (\nonce :: ByteString
nonce d :: ByteString
d ad :: ByteString
ad ->
            let aeadIni :: AEAD AES256
aeadIni = CryptoFailable (AEAD AES256) -> AEAD AES256
forall a. CryptoFailable a -> a
noFail (AEADMode -> AES256 -> ByteString -> CryptoFailable (AEAD AES256)
forall cipher iv.
(BlockCipher cipher, ByteArrayAccess iv) =>
AEADMode -> cipher -> iv -> CryptoFailable (AEAD cipher)
aeadInit AEADMode
AEAD_GCM AES256
ctx ByteString
nonce)
             in (AuthTag, ByteString) -> (ByteString, AuthTag)
forall a b. (a, b) -> (b, a)
swap ((AuthTag, ByteString) -> (ByteString, AuthTag))
-> (AuthTag, ByteString) -> (ByteString, AuthTag)
forall a b. (a -> b) -> a -> b
$ AEAD AES256
-> ByteString -> ByteString -> Int -> (AuthTag, ByteString)
forall aad ba a.
(ByteArrayAccess aad, ByteArray ba) =>
AEAD a -> aad -> ba -> Int -> (AuthTag, ba)
aeadSimpleEncrypt AEAD AES256
aeadIni ByteString
ad ByteString
d 16)
aes256gcm BulkDecrypt key :: ByteString
key =
    let ctx :: AES256
ctx = CryptoFailable AES256 -> AES256
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable AES256
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key) :: AES256
     in (\nonce :: ByteString
nonce d :: ByteString
d ad :: ByteString
ad ->
            let aeadIni :: AEAD AES256
aeadIni = CryptoFailable (AEAD AES256) -> AEAD AES256
forall a. CryptoFailable a -> a
noFail (AEADMode -> AES256 -> ByteString -> CryptoFailable (AEAD AES256)
forall cipher iv.
(BlockCipher cipher, ByteArrayAccess iv) =>
AEADMode -> cipher -> iv -> CryptoFailable (AEAD cipher)
aeadInit AEADMode
AEAD_GCM AES256
ctx ByteString
nonce)
             in AEAD AES256
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
forall cipher.
AEAD cipher
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
simpleDecrypt AEAD AES256
aeadIni ByteString
ad ByteString
d 16)

simpleDecrypt :: AEAD cipher -> B.ByteString -> B.ByteString -> Int -> (B.ByteString, AuthTag)
simpleDecrypt :: AEAD cipher
-> ByteString -> ByteString -> Int -> (ByteString, AuthTag)
simpleDecrypt aeadIni :: AEAD cipher
aeadIni header :: ByteString
header input :: ByteString
input taglen :: Int
taglen = (ByteString
output, AuthTag
tag)
  where
        aead :: AEAD cipher
aead                = AEAD cipher -> ByteString -> AEAD cipher
forall aad cipher.
ByteArrayAccess aad =>
AEAD cipher -> aad -> AEAD cipher
aeadAppendHeader AEAD cipher
aeadIni ByteString
header
        (output :: ByteString
output, aeadFinal :: AEAD cipher
aeadFinal) = AEAD cipher -> ByteString -> (ByteString, AEAD cipher)
forall ba cipher.
ByteArray ba =>
AEAD cipher -> ba -> (ba, AEAD cipher)
aeadDecrypt AEAD cipher
aead ByteString
input
        tag :: AuthTag
tag                 = AEAD cipher -> Int -> AuthTag
forall cipher. AEAD cipher -> Int -> AuthTag
aeadFinalize AEAD cipher
aeadFinal Int
taglen

noFail :: CryptoFailable a -> a
noFail :: CryptoFailable a -> a
noFail = CryptoFailable a -> a
forall a. CryptoFailable a -> a
throwCryptoError

makeIV_ :: BlockCipher a => B.ByteString -> IV a
makeIV_ :: ByteString -> IV a
makeIV_ = IV a -> Maybe (IV a) -> IV a
forall a. a -> Maybe a -> a
fromMaybe ([Char] -> IV a
forall a. HasCallStack => [Char] -> a
error "makeIV_") (Maybe (IV a) -> IV a)
-> (ByteString -> Maybe (IV a)) -> ByteString -> IV a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Maybe (IV a)
forall b c. (ByteArrayAccess b, BlockCipher c) => b -> Maybe (IV c)
makeIV

tripledes_ede :: BulkDirection -> BulkKey -> BulkBlock
tripledes_ede :: BulkDirection -> ByteString -> BulkBlock
tripledes_ede BulkEncrypt key :: ByteString
key =
    let ctx :: DES_EDE3
ctx = CryptoFailable DES_EDE3 -> DES_EDE3
forall a. CryptoFailable a -> a
noFail (CryptoFailable DES_EDE3 -> DES_EDE3)
-> CryptoFailable DES_EDE3 -> DES_EDE3
forall a b. (a -> b) -> a -> b
$ ByteString -> CryptoFailable DES_EDE3
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key
     in (\iv :: ByteString
iv input :: ByteString
input -> let output :: ByteString
output = DES_EDE3 -> IV DES_EDE3 -> ByteString -> ByteString
forall cipher ba.
(BlockCipher cipher, ByteArray ba) =>
cipher -> IV cipher -> ba -> ba
cbcEncrypt DES_EDE3
ctx (ByteString -> IV DES_EDE3
tripledes_iv ByteString
iv) ByteString
input in (ByteString
output, Int -> ByteString -> ByteString
takelast 8 ByteString
output))
tripledes_ede BulkDecrypt key :: ByteString
key =
    let ctx :: DES_EDE3
ctx = CryptoFailable DES_EDE3 -> DES_EDE3
forall a. CryptoFailable a -> a
noFail (CryptoFailable DES_EDE3 -> DES_EDE3)
-> CryptoFailable DES_EDE3 -> DES_EDE3
forall a b. (a -> b) -> a -> b
$ ByteString -> CryptoFailable DES_EDE3
forall cipher key.
(Cipher cipher, ByteArray key) =>
key -> CryptoFailable cipher
cipherInit ByteString
key
     in (\iv :: ByteString
iv input :: ByteString
input -> let output :: ByteString
output = DES_EDE3 -> IV DES_EDE3 -> ByteString -> ByteString
forall cipher ba.
(BlockCipher cipher, ByteArray ba) =>
cipher -> IV cipher -> ba -> ba
cbcDecrypt DES_EDE3
ctx (ByteString -> IV DES_EDE3
tripledes_iv ByteString
iv) ByteString
input in (ByteString
output, Int -> ByteString -> ByteString
takelast 8 ByteString
input))

tripledes_iv :: BulkIV -> IV DES_EDE3
tripledes_iv :: ByteString -> IV DES_EDE3
tripledes_iv iv :: ByteString
iv = IV DES_EDE3 -> Maybe (IV DES_EDE3) -> IV DES_EDE3
forall a. a -> Maybe a -> a
fromMaybe ([Char] -> IV DES_EDE3
forall a. HasCallStack => [Char] -> a
error "tripledes cipher iv internal error") (Maybe (IV DES_EDE3) -> IV DES_EDE3)
-> Maybe (IV DES_EDE3) -> IV DES_EDE3
forall a b. (a -> b) -> a -> b
$ ByteString -> Maybe (IV DES_EDE3)
forall b c. (ByteArrayAccess b, BlockCipher c) => b -> Maybe (IV c)
makeIV ByteString
iv

rc4 :: BulkDirection -> BulkKey -> BulkStream
rc4 :: BulkDirection -> ByteString -> BulkStream
rc4 _ bulkKey :: ByteString
bulkKey = (ByteString -> (ByteString, BulkStream)) -> BulkStream
BulkStream (State -> ByteString -> (ByteString, BulkStream)
combineRC4 (State -> ByteString -> (ByteString, BulkStream))
-> State -> ByteString -> (ByteString, BulkStream)
forall a b. (a -> b) -> a -> b
$ ByteString -> State
forall key. ByteArrayAccess key => key -> State
RC4.initialize ByteString
bulkKey)
  where
    combineRC4 :: State -> ByteString -> (ByteString, BulkStream)
combineRC4 ctx :: State
ctx input :: ByteString
input =
        let (ctx' :: State
ctx', output :: ByteString
output) = State -> ByteString -> (State, ByteString)
forall ba. ByteArray ba => State -> ba -> (State, ba)
RC4.combine State
ctx ByteString
input
         in (ByteString
output, (ByteString -> (ByteString, BulkStream)) -> BulkStream
BulkStream (State -> ByteString -> (ByteString, BulkStream)
combineRC4 State
ctx'))

chacha20poly1305 :: BulkDirection -> BulkKey -> BulkAEAD
chacha20poly1305 :: BulkDirection -> ByteString -> BulkAEAD
chacha20poly1305 BulkEncrypt key :: ByteString
key nonce :: ByteString
nonce =
    let st :: State
st = CryptoFailable State -> State
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable Nonce
forall iv. ByteArrayAccess iv => iv -> CryptoFailable Nonce
ChaChaPoly1305.nonce12 ByteString
nonce CryptoFailable Nonce
-> (Nonce -> CryptoFailable State) -> CryptoFailable State
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ByteString -> Nonce -> CryptoFailable State
forall key.
ByteArrayAccess key =>
key -> Nonce -> CryptoFailable State
ChaChaPoly1305.initialize ByteString
key)
     in (\input :: ByteString
input ad :: ByteString
ad ->
            let st2 :: State
st2 = State -> State
ChaChaPoly1305.finalizeAAD (ByteString -> State -> State
forall ba. ByteArrayAccess ba => ba -> State -> State
ChaChaPoly1305.appendAAD ByteString
ad State
st)
                (output :: ByteString
output, st3 :: State
st3) = ByteString -> State -> (ByteString, State)
forall ba. ByteArray ba => ba -> State -> (ba, State)
ChaChaPoly1305.encrypt ByteString
input State
st2
                Poly1305.Auth tag :: Bytes
tag = State -> Auth
ChaChaPoly1305.finalize State
st3
            in (ByteString
output, Bytes -> AuthTag
AuthTag Bytes
tag))
chacha20poly1305 BulkDecrypt key :: ByteString
key nonce :: ByteString
nonce =
    let st :: State
st = CryptoFailable State -> State
forall a. CryptoFailable a -> a
noFail (ByteString -> CryptoFailable Nonce
forall iv. ByteArrayAccess iv => iv -> CryptoFailable Nonce
ChaChaPoly1305.nonce12 ByteString
nonce CryptoFailable Nonce
-> (Nonce -> CryptoFailable State) -> CryptoFailable State
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ByteString -> Nonce -> CryptoFailable State
forall key.
ByteArrayAccess key =>
key -> Nonce -> CryptoFailable State
ChaChaPoly1305.initialize ByteString
key)
     in (\input :: ByteString
input ad :: ByteString
ad ->
            let st2 :: State
st2 = State -> State
ChaChaPoly1305.finalizeAAD (ByteString -> State -> State
forall ba. ByteArrayAccess ba => ba -> State -> State
ChaChaPoly1305.appendAAD ByteString
ad State
st)
                (output :: ByteString
output, st3 :: State
st3) = ByteString -> State -> (ByteString, State)
forall ba. ByteArray ba => ba -> State -> (ba, State)
ChaChaPoly1305.decrypt ByteString
input State
st2
                Poly1305.Auth tag :: Bytes
tag = State -> Auth
ChaChaPoly1305.finalize State
st3
            in (ByteString
output, Bytes -> AuthTag
AuthTag Bytes
tag))

-- | All AES and ChaCha20-Poly1305 ciphers supported ordered from strong to
-- weak.  This choice of ciphersuites should satisfy most normal needs.  For
-- otherwise strong ciphers we make little distinction between AES128 and
-- AES256, and list each but the weakest of the AES128 ciphers ahead of the
-- corresponding AES256 ciphers, with the ChaCha20-Poly1305 variant placed just
-- after.
--
-- The CCM ciphers all come together after the GCM variants due to their
-- relative performance cost.
ciphersuite_default :: [Cipher]
ciphersuite_default :: [Cipher]
ciphersuite_default =
    [        -- First the PFS + GCM + SHA2 ciphers
      Cipher
cipher_ECDHE_ECDSA_AES128GCM_SHA256, Cipher
cipher_ECDHE_ECDSA_AES256GCM_SHA384
    , Cipher
cipher_ECDHE_ECDSA_CHACHA20POLY1305_SHA256
    , Cipher
cipher_ECDHE_RSA_AES128GCM_SHA256, Cipher
cipher_ECDHE_RSA_AES256GCM_SHA384
    , Cipher
cipher_ECDHE_RSA_CHACHA20POLY1305_SHA256
    , Cipher
cipher_DHE_RSA_AES128GCM_SHA256, Cipher
cipher_DHE_RSA_AES256GCM_SHA384
    , Cipher
cipher_DHE_RSA_CHACHA20POLY1305_SHA256
    ,        -- Next the PFS + CCM + SHA2 ciphers
      Cipher
cipher_ECDHE_ECDSA_AES128CCM_SHA256, Cipher
cipher_ECDHE_ECDSA_AES256CCM_SHA256
    , Cipher
cipher_DHE_RSA_AES128CCM_SHA256, Cipher
cipher_DHE_RSA_AES256CCM_SHA256
             -- Next the PFS + CBC + SHA2 ciphers
    , Cipher
cipher_ECDHE_ECDSA_AES128CBC_SHA256, Cipher
cipher_ECDHE_ECDSA_AES256CBC_SHA384
    , Cipher
cipher_ECDHE_RSA_AES128CBC_SHA256, Cipher
cipher_ECDHE_RSA_AES256CBC_SHA384
    , Cipher
cipher_DHE_RSA_AES128_SHA256, Cipher
cipher_DHE_RSA_AES256_SHA256
             -- Next the PFS + CBC + SHA1 ciphers
    , Cipher
cipher_ECDHE_ECDSA_AES128CBC_SHA, Cipher
cipher_ECDHE_ECDSA_AES256CBC_SHA
    , Cipher
cipher_ECDHE_RSA_AES128CBC_SHA, Cipher
cipher_ECDHE_RSA_AES256CBC_SHA
    , Cipher
cipher_DHE_RSA_AES128_SHA1, Cipher
cipher_DHE_RSA_AES256_SHA1
             -- Next the non-PFS + GCM + SHA2 ciphers
    , Cipher
cipher_AES128GCM_SHA256, Cipher
cipher_AES256GCM_SHA384
             -- Next the non-PFS + CCM + SHA2 ciphers
    , Cipher
cipher_AES128CCM_SHA256, Cipher
cipher_AES256CCM_SHA256
             -- Next the non-PFS + CBC + SHA2 ciphers
    , Cipher
cipher_AES256_SHA256, Cipher
cipher_AES128_SHA256
             -- Next the non-PFS + CBC + SHA1 ciphers
    , Cipher
cipher_AES256_SHA1, Cipher
cipher_AES128_SHA1
             -- Nobody uses or should use DSS, RC4,  3DES or MD5
    -- , cipher_DHE_DSS_AES256_SHA1, cipher_DHE_DSS_AES128_SHA1
    -- , cipher_DHE_DSS_RC4_SHA1, cipher_RC4_128_SHA1, cipher_RC4_128_MD5
    -- , cipher_RSA_3DES_EDE_CBC_SHA1
             -- TLS13 (listed at the end but version is negotiated first)
    , Cipher
cipher_TLS13_AES128GCM_SHA256
    , Cipher
cipher_TLS13_AES256GCM_SHA384
    , Cipher
cipher_TLS13_CHACHA20POLY1305_SHA256
    , Cipher
cipher_TLS13_AES128CCM_SHA256
    ]

{-# WARNING ciphersuite_all "This ciphersuite list contains RC4. Use ciphersuite_strong or ciphersuite_default instead." #-}
-- | The default ciphersuites + some not recommended last resort ciphers.
ciphersuite_all :: [Cipher]
ciphersuite_all :: [Cipher]
ciphersuite_all = [Cipher]
ciphersuite_default [Cipher] -> [Cipher] -> [Cipher]
forall a. [a] -> [a] -> [a]
++
    [ Cipher
cipher_ECDHE_ECDSA_AES128CCM8_SHA256, Cipher
cipher_ECDHE_ECDSA_AES256CCM8_SHA256
    , Cipher
cipher_DHE_RSA_AES128CCM8_SHA256, Cipher
cipher_DHE_RSA_AES256CCM8_SHA256
    , Cipher
cipher_DHE_DSS_AES256_SHA1, Cipher
cipher_DHE_DSS_AES128_SHA1
    , Cipher
cipher_AES128CCM8_SHA256, Cipher
cipher_AES256CCM8_SHA256
    , Cipher
cipher_RSA_3DES_EDE_CBC_SHA1
    , Cipher
cipher_RC4_128_SHA1
    , Cipher
cipher_TLS13_AES128CCM8_SHA256
    ]

{-# DEPRECATED ciphersuite_medium "Use ciphersuite_strong or ciphersuite_default instead." #-}
-- | list of medium ciphers.
ciphersuite_medium :: [Cipher]
ciphersuite_medium :: [Cipher]
ciphersuite_medium = [ Cipher
cipher_RC4_128_SHA1
                     , Cipher
cipher_AES128_SHA1
                     ]

-- | The strongest ciphers supported.  For ciphers with PFS, AEAD and SHA2, we
-- list each AES128 variant after the corresponding AES256 and ChaCha20-Poly1305
-- variants.  For weaker constructs, we use just the AES256 form.
--
-- The CCM ciphers come just after the corresponding GCM ciphers despite their
-- relative performance cost.
ciphersuite_strong :: [Cipher]
ciphersuite_strong :: [Cipher]
ciphersuite_strong =
    [        -- If we have PFS + AEAD + SHA2, then allow AES128, else just 256
      Cipher
cipher_ECDHE_ECDSA_AES256GCM_SHA384, Cipher
cipher_ECDHE_ECDSA_AES256CCM_SHA256
    , Cipher
cipher_ECDHE_ECDSA_CHACHA20POLY1305_SHA256
    , Cipher
cipher_ECDHE_ECDSA_AES128GCM_SHA256, Cipher
cipher_ECDHE_ECDSA_AES128CCM_SHA256
    , Cipher
cipher_ECDHE_RSA_AES256GCM_SHA384
    , Cipher
cipher_ECDHE_RSA_CHACHA20POLY1305_SHA256
    , Cipher
cipher_ECDHE_RSA_AES128GCM_SHA256
    , Cipher
cipher_DHE_RSA_AES256GCM_SHA384, Cipher
cipher_DHE_RSA_AES256CCM_SHA256
    , Cipher
cipher_DHE_RSA_CHACHA20POLY1305_SHA256
    , Cipher
cipher_DHE_RSA_AES128GCM_SHA256, Cipher
cipher_DHE_RSA_AES128CCM_SHA256
             -- No AEAD
    , Cipher
cipher_ECDHE_ECDSA_AES256CBC_SHA384
    , Cipher
cipher_ECDHE_RSA_AES256CBC_SHA384
    , Cipher
cipher_DHE_RSA_AES256_SHA256
             -- No SHA2
    , Cipher
cipher_ECDHE_ECDSA_AES256CBC_SHA
    , Cipher
cipher_ECDHE_RSA_AES256CBC_SHA
    , Cipher
cipher_DHE_RSA_AES256_SHA1
             -- No PFS
    , Cipher
cipher_AES256GCM_SHA384
    , Cipher
cipher_AES256CCM_SHA256
             -- Neither PFS nor AEAD, just SHA2
    , Cipher
cipher_AES256_SHA256
             -- Last resort no PFS, AEAD or SHA2
    , Cipher
cipher_AES256_SHA1
             -- TLS13 (listed at the end but version is negotiated first)
    , Cipher
cipher_TLS13_AES256GCM_SHA384
    , Cipher
cipher_TLS13_CHACHA20POLY1305_SHA256
    , Cipher
cipher_TLS13_AES128GCM_SHA256
    , Cipher
cipher_TLS13_AES128CCM_SHA256
    ]

-- | DHE-RSA cipher suite.  This only includes ciphers bound specifically to
-- DHE-RSA so TLS 1.3 ciphers must be added separately.
ciphersuite_dhe_rsa :: [Cipher]
ciphersuite_dhe_rsa :: [Cipher]
ciphersuite_dhe_rsa = [ Cipher
cipher_DHE_RSA_AES256GCM_SHA384, Cipher
cipher_DHE_RSA_AES256CCM_SHA256
                      , Cipher
cipher_DHE_RSA_CHACHA20POLY1305_SHA256
                      , Cipher
cipher_DHE_RSA_AES128GCM_SHA256, Cipher
cipher_DHE_RSA_AES128CCM_SHA256
                      , Cipher
cipher_DHE_RSA_AES256_SHA256, Cipher
cipher_DHE_RSA_AES128_SHA256
                      , Cipher
cipher_DHE_RSA_AES256_SHA1, Cipher
cipher_DHE_RSA_AES128_SHA1
                      ]

ciphersuite_dhe_dss :: [Cipher]
ciphersuite_dhe_dss :: [Cipher]
ciphersuite_dhe_dss = [Cipher
cipher_DHE_DSS_AES256_SHA1, Cipher
cipher_DHE_DSS_AES128_SHA1, Cipher
cipher_DHE_DSS_RC4_SHA1]

-- | all unencrypted ciphers, do not use on insecure network.
ciphersuite_unencrypted :: [Cipher]
ciphersuite_unencrypted :: [Cipher]
ciphersuite_unencrypted = [Cipher
cipher_null_MD5, Cipher
cipher_null_SHA1]

bulk_null, bulk_rc4, bulk_aes128, bulk_aes256, bulk_tripledes_ede, bulk_aes128gcm, bulk_aes256gcm :: Bulk
bulk_aes128ccm, bulk_aes128ccm8, bulk_aes256ccm, bulk_aes256ccm8, bulk_chacha20poly1305 :: Bulk
bulk_null :: Bulk
bulk_null = Bulk :: [Char] -> Int -> Int -> Int -> Int -> Int -> BulkFunctions -> Bulk
Bulk
    { bulkName :: [Char]
bulkName         = "null"
    , bulkKeySize :: Int
bulkKeySize      = 0
    , bulkIVSize :: Int
bulkIVSize       = 0
    , bulkExplicitIV :: Int
bulkExplicitIV   = 0
    , bulkAuthTagLen :: Int
bulkAuthTagLen   = 0
    , bulkBlockSize :: Int
bulkBlockSize    = 0
    , bulkF :: BulkFunctions
bulkF            = (BulkDirection -> ByteString -> BulkStream) -> BulkFunctions
BulkStreamF BulkDirection -> ByteString -> BulkStream
forall p p. p -> p -> BulkStream
passThrough
    }
  where
    passThrough :: p -> p -> BulkStream
passThrough _ _ = (ByteString -> (ByteString, BulkStream)) -> BulkStream
BulkStream ByteString -> (ByteString, BulkStream)
go where go :: ByteString -> (ByteString, BulkStream)
go inp :: ByteString
inp = (ByteString
inp, (ByteString -> (ByteString, BulkStream)) -> BulkStream
BulkStream ByteString -> (ByteString, BulkStream)
go)

bulk_rc4 :: Bulk
bulk_rc4 = Bulk :: [Char] -> Int -> Int -> Int -> Int -> Int -> BulkFunctions -> Bulk
Bulk
    { bulkName :: [Char]
bulkName         = "RC4-128"
    , bulkKeySize :: Int
bulkKeySize      = 16
    , bulkIVSize :: Int
bulkIVSize       = 0
    , bulkExplicitIV :: Int
bulkExplicitIV   = 0
    , bulkAuthTagLen :: Int
bulkAuthTagLen   = 0
    , bulkBlockSize :: Int
bulkBlockSize    = 0
    , bulkF :: BulkFunctions
bulkF            = (BulkDirection -> ByteString -> BulkStream) -> BulkFunctions
BulkStreamF BulkDirection -> ByteString -> BulkStream
rc4
    }

bulk_aes128 :: Bulk
bulk_aes128 = Bulk :: [Char] -> Int -> Int -> Int -> Int -> Int -> BulkFunctions -> Bulk
Bulk
    { bulkName :: [Char]
bulkName         = "AES128"
    , bulkKeySize :: Int
bulkKeySize      = 16
    , bulkIVSize :: Int
bulkIVSize       = 16
    , bulkExplicitIV :: Int
bulkExplicitIV   = 0
    , bulkAuthTagLen :: Int
bulkAuthTagLen   = 0
    , bulkBlockSize :: Int
bulkBlockSize    = 16
    , bulkF :: BulkFunctions
bulkF            = (BulkDirection -> ByteString -> BulkBlock) -> BulkFunctions
BulkBlockF BulkDirection -> ByteString -> BulkBlock
aes128cbc
    }

bulk_aes128ccm :: Bulk
bulk_aes128ccm = Bulk :: [Char] -> Int -> Int -> Int -> Int -> Int -> BulkFunctions -> Bulk
Bulk
    { bulkName :: [Char]
bulkName         = "AES128CCM"
    , bulkKeySize :: Int
bulkKeySize      = 16 -- RFC 5116 Sec 5.1: K_LEN
    , bulkIVSize :: Int
bulkIVSize       = 4  -- RFC 6655 CCMNonce.salt, fixed_iv_length
    , bulkExplicitIV :: Int
bulkExplicitIV   = 8
    , bulkAuthTagLen :: Int
bulkAuthTagLen   = 16
    , bulkBlockSize :: Int
bulkBlockSize    = 0  -- dummy, not used
    , bulkF :: BulkFunctions
bulkF            = (BulkDirection -> ByteString -> BulkAEAD) -> BulkFunctions
BulkAeadF BulkDirection -> ByteString -> BulkAEAD
aes128ccm
    }

bulk_aes128ccm8 :: Bulk
bulk_aes128ccm8 = Bulk :: [Char] -> Int -> Int -> Int -> Int -> Int -> BulkFunctions -> Bulk
Bulk
    { bulkName :: [Char]
bulkName         = "AES128CCM8"
    , bulkKeySize :: Int
bulkKeySize      = 16 -- RFC 5116 Sec 5.1: K_LEN
    , bulkIVSize :: Int
bulkIVSize       = 4  -- RFC 6655 CCMNonce.salt, fixed_iv_length
    , bulkExplicitIV :: Int
bulkExplicitIV   = 8
    , bulkAuthTagLen :: Int
bulkAuthTagLen   = 8
    , bulkBlockSize :: Int
bulkBlockSize    = 0  -- dummy, not used
    , bulkF :: BulkFunctions
bulkF            = (BulkDirection -> ByteString -> BulkAEAD) -> BulkFunctions
BulkAeadF BulkDirection -> ByteString -> BulkAEAD
aes128ccm8
    }

bulk_aes128gcm :: Bulk
bulk_aes128gcm = Bulk :: [Char] -> Int -> Int -> Int -> Int -> Int -> BulkFunctions -> Bulk
Bulk
    { bulkName :: [Char]
bulkName         = "AES128GCM"
    , bulkKeySize :: Int
bulkKeySize      = 16 -- RFC 5116 Sec 5.1: K_LEN
    , bulkIVSize :: Int
bulkIVSize       = 4  -- RFC 5288 GCMNonce.salt, fixed_iv_length
    , bulkExplicitIV :: Int
bulkExplicitIV   = 8
    , bulkAuthTagLen :: Int
bulkAuthTagLen   = 16
    , bulkBlockSize :: Int
bulkBlockSize    = 0  -- dummy, not used
    , bulkF :: BulkFunctions
bulkF            = (BulkDirection -> ByteString -> BulkAEAD) -> BulkFunctions
BulkAeadF BulkDirection -> ByteString -> BulkAEAD
aes128gcm
    }

bulk_aes256ccm :: Bulk
bulk_aes256ccm = Bulk :: [Char] -> Int -> Int -> Int -> Int -> Int -> BulkFunctions -> Bulk
Bulk
    { bulkName :: [Char]
bulkName         = "AES256CCM"
    , bulkKeySize :: Int
bulkKeySize      = 32 -- RFC 5116 Sec 5.1: K_LEN
    , bulkIVSize :: Int
bulkIVSize       = 4  -- RFC 6655 CCMNonce.salt, fixed_iv_length
    , bulkExplicitIV :: Int
bulkExplicitIV   = 8
    , bulkAuthTagLen :: Int
bulkAuthTagLen   = 16
    , bulkBlockSize :: Int
bulkBlockSize    = 0  -- dummy, not used
    , bulkF :: BulkFunctions
bulkF            = (BulkDirection -> ByteString -> BulkAEAD) -> BulkFunctions
BulkAeadF BulkDirection -> ByteString -> BulkAEAD
aes256ccm
    }

bulk_aes256ccm8 :: Bulk
bulk_aes256ccm8 = Bulk :: [Char] -> Int -> Int -> Int -> Int -> Int -> BulkFunctions -> Bulk
Bulk
    { bulkName :: [Char]
bulkName         = "AES256CCM8"
    , bulkKeySize :: Int
bulkKeySize      = 32 -- RFC 5116 Sec 5.1: K_LEN
    , bulkIVSize :: Int
bulkIVSize       = 4  -- RFC 6655 CCMNonce.salt, fixed_iv_length
    , bulkExplicitIV :: Int
bulkExplicitIV   = 8
    , bulkAuthTagLen :: Int
bulkAuthTagLen   = 8
    , bulkBlockSize :: Int
bulkBlockSize    = 0  -- dummy, not used
    , bulkF :: BulkFunctions
bulkF            = (BulkDirection -> ByteString -> BulkAEAD) -> BulkFunctions
BulkAeadF BulkDirection -> ByteString -> BulkAEAD
aes256ccm8
    }

bulk_aes256gcm :: Bulk
bulk_aes256gcm = Bulk :: [Char] -> Int -> Int -> Int -> Int -> Int -> BulkFunctions -> Bulk
Bulk
    { bulkName :: [Char]
bulkName         = "AES256GCM"
    , bulkKeySize :: Int
bulkKeySize      = 32 -- RFC 5116 Sec 5.1: K_LEN
    , bulkIVSize :: Int
bulkIVSize       = 4  -- RFC 5288 GCMNonce.salt, fixed_iv_length
    , bulkExplicitIV :: Int
bulkExplicitIV   = 8
    , bulkAuthTagLen :: Int
bulkAuthTagLen   = 16
    , bulkBlockSize :: Int
bulkBlockSize    = 0  -- dummy, not used
    , bulkF :: BulkFunctions
bulkF            = (BulkDirection -> ByteString -> BulkAEAD) -> BulkFunctions
BulkAeadF BulkDirection -> ByteString -> BulkAEAD
aes256gcm
    }

bulk_aes256 :: Bulk
bulk_aes256 = Bulk :: [Char] -> Int -> Int -> Int -> Int -> Int -> BulkFunctions -> Bulk
Bulk
    { bulkName :: [Char]
bulkName         = "AES256"
    , bulkKeySize :: Int
bulkKeySize      = 32
    , bulkIVSize :: Int
bulkIVSize       = 16
    , bulkExplicitIV :: Int
bulkExplicitIV   = 0
    , bulkAuthTagLen :: Int
bulkAuthTagLen   = 0
    , bulkBlockSize :: Int
bulkBlockSize    = 16
    , bulkF :: BulkFunctions
bulkF            = (BulkDirection -> ByteString -> BulkBlock) -> BulkFunctions
BulkBlockF BulkDirection -> ByteString -> BulkBlock
aes256cbc
    }

bulk_tripledes_ede :: Bulk
bulk_tripledes_ede = Bulk :: [Char] -> Int -> Int -> Int -> Int -> Int -> BulkFunctions -> Bulk
Bulk
    { bulkName :: [Char]
bulkName      = "3DES-EDE-CBC"
    , bulkKeySize :: Int
bulkKeySize   = 24
    , bulkIVSize :: Int
bulkIVSize    = 8
    , bulkExplicitIV :: Int
bulkExplicitIV = 0
    , bulkAuthTagLen :: Int
bulkAuthTagLen = 0
    , bulkBlockSize :: Int
bulkBlockSize = 8
    , bulkF :: BulkFunctions
bulkF         = (BulkDirection -> ByteString -> BulkBlock) -> BulkFunctions
BulkBlockF BulkDirection -> ByteString -> BulkBlock
tripledes_ede
    }

bulk_chacha20poly1305 :: Bulk
bulk_chacha20poly1305 = Bulk :: [Char] -> Int -> Int -> Int -> Int -> Int -> BulkFunctions -> Bulk
Bulk
    { bulkName :: [Char]
bulkName         = "CHACHA20POLY1305"
    , bulkKeySize :: Int
bulkKeySize      = 32
    , bulkIVSize :: Int
bulkIVSize       = 12 -- RFC 7905 section 2, fixed_iv_length
    , bulkExplicitIV :: Int
bulkExplicitIV   = 0
    , bulkAuthTagLen :: Int
bulkAuthTagLen   = 16
    , bulkBlockSize :: Int
bulkBlockSize    = 0  -- dummy, not used
    , bulkF :: BulkFunctions
bulkF            = (BulkDirection -> ByteString -> BulkAEAD) -> BulkFunctions
BulkAeadF BulkDirection -> ByteString -> BulkAEAD
chacha20poly1305
    }

-- TLS13 bulks are same as TLS12 except they never have explicit IV
bulk_aes128gcm_13, bulk_aes256gcm_13, bulk_aes128ccm_13, bulk_aes128ccm8_13 :: Bulk
bulk_aes128gcm_13 :: Bulk
bulk_aes128gcm_13  = Bulk
bulk_aes128gcm  { bulkIVSize :: Int
bulkIVSize = 12, bulkExplicitIV :: Int
bulkExplicitIV = 0 }
bulk_aes256gcm_13 :: Bulk
bulk_aes256gcm_13  = Bulk
bulk_aes256gcm  { bulkIVSize :: Int
bulkIVSize = 12, bulkExplicitIV :: Int
bulkExplicitIV = 0 }
bulk_aes128ccm_13 :: Bulk
bulk_aes128ccm_13  = Bulk
bulk_aes128ccm  { bulkIVSize :: Int
bulkIVSize = 12, bulkExplicitIV :: Int
bulkExplicitIV = 0 }
bulk_aes128ccm8_13 :: Bulk
bulk_aes128ccm8_13 = Bulk
bulk_aes128ccm8 { bulkIVSize :: Int
bulkIVSize = 12, bulkExplicitIV :: Int
bulkExplicitIV = 0 }

-- | unencrypted cipher using RSA for key exchange and MD5 for digest
cipher_null_MD5 :: Cipher
cipher_null_MD5 :: Cipher
cipher_null_MD5 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x0001
    , cipherName :: [Char]
cipherName         = "RSA-null-MD5"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_null
    , cipherHash :: Hash
cipherHash         = Hash
MD5
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Maybe Version
forall a. Maybe a
Nothing
    }

-- | unencrypted cipher using RSA for key exchange and SHA1 for digest
cipher_null_SHA1 :: Cipher
cipher_null_SHA1 :: Cipher
cipher_null_SHA1 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x0002
    , cipherName :: [Char]
cipherName         = "RSA-null-SHA1"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_null
    , cipherHash :: Hash
cipherHash         = Hash
SHA1
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Maybe Version
forall a. Maybe a
Nothing
    }

-- | RC4 cipher, RSA key exchange and MD5 for digest
cipher_RC4_128_MD5 :: Cipher
cipher_RC4_128_MD5 :: Cipher
cipher_RC4_128_MD5 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x0004
    , cipherName :: [Char]
cipherName         = "RSA-rc4-128-md5"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_rc4
    , cipherHash :: Hash
cipherHash         = Hash
MD5
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Maybe Version
forall a. Maybe a
Nothing
    }

-- | RC4 cipher, RSA key exchange and SHA1 for digest
cipher_RC4_128_SHA1 :: Cipher
cipher_RC4_128_SHA1 :: Cipher
cipher_RC4_128_SHA1 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x0005
    , cipherName :: [Char]
cipherName         = "RSA-rc4-128-sha1"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_rc4
    , cipherHash :: Hash
cipherHash         = Hash
SHA1
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Maybe Version
forall a. Maybe a
Nothing
    }

-- | 3DES cipher (168 bit key), RSA key exchange and SHA1 for digest
cipher_RSA_3DES_EDE_CBC_SHA1 :: Cipher
cipher_RSA_3DES_EDE_CBC_SHA1 :: Cipher
cipher_RSA_3DES_EDE_CBC_SHA1 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x000A
    , cipherName :: [Char]
cipherName         = "RSA-3DES-EDE-CBC-SHA1"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_tripledes_ede
    , cipherHash :: Hash
cipherHash         = Hash
SHA1
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Maybe Version
forall a. Maybe a
Nothing
    }

-- | AES cipher (128 bit key), RSA key exchange and SHA1 for digest
cipher_AES128_SHA1 :: Cipher
cipher_AES128_SHA1 :: Cipher
cipher_AES128_SHA1 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x002F
    , cipherName :: [Char]
cipherName         = "RSA-AES128-SHA1"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128
    , cipherHash :: Hash
cipherHash         = Hash
SHA1
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
SSL3
    }

-- | AES cipher (128 bit key), DHE key exchanged signed by DSA and SHA1 for digest
cipher_DHE_DSS_AES128_SHA1 :: Cipher
cipher_DHE_DSS_AES128_SHA1 :: Cipher
cipher_DHE_DSS_AES128_SHA1 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x0032
    , cipherName :: [Char]
cipherName         = "DHE-DSA-AES128-SHA1"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128
    , cipherHash :: Hash
cipherHash         = Hash
SHA1
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_DHE_DSS
    , cipherMinVer :: Maybe Version
cipherMinVer       = Maybe Version
forall a. Maybe a
Nothing
    }

-- | AES cipher (128 bit key), DHE key exchanged signed by RSA and SHA1 for digest
cipher_DHE_RSA_AES128_SHA1 :: Cipher
cipher_DHE_RSA_AES128_SHA1 :: Cipher
cipher_DHE_RSA_AES128_SHA1 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x0033
    , cipherName :: [Char]
cipherName         = "DHE-RSA-AES128-SHA1"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128
    , cipherHash :: Hash
cipherHash         = Hash
SHA1
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_DHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Maybe Version
forall a. Maybe a
Nothing
    }

-- | AES cipher (256 bit key), RSA key exchange and SHA1 for digest
cipher_AES256_SHA1 :: Cipher
cipher_AES256_SHA1 :: Cipher
cipher_AES256_SHA1 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x0035
    , cipherName :: [Char]
cipherName         = "RSA-AES256-SHA1"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256
    , cipherHash :: Hash
cipherHash         = Hash
SHA1
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
SSL3
    }

-- | AES cipher (256 bit key), DHE key exchanged signed by DSA and SHA1 for digest
cipher_DHE_DSS_AES256_SHA1 :: Cipher
cipher_DHE_DSS_AES256_SHA1 :: Cipher
cipher_DHE_DSS_AES256_SHA1 = Cipher
cipher_DHE_DSS_AES128_SHA1
    { cipherID :: CipherID
cipherID           = 0x0038
    , cipherName :: [Char]
cipherName         = "DHE-DSA-AES256-SHA1"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256
    }

-- | AES cipher (256 bit key), DHE key exchanged signed by RSA and SHA1 for digest
cipher_DHE_RSA_AES256_SHA1 :: Cipher
cipher_DHE_RSA_AES256_SHA1 :: Cipher
cipher_DHE_RSA_AES256_SHA1 = Cipher
cipher_DHE_RSA_AES128_SHA1
    { cipherID :: CipherID
cipherID           = 0x0039
    , cipherName :: [Char]
cipherName         = "DHE-RSA-AES256-SHA1"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256
    }

-- | AES cipher (128 bit key), RSA key exchange and SHA256 for digest
cipher_AES128_SHA256 :: Cipher
cipher_AES128_SHA256 :: Cipher
cipher_AES128_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x003C
    , cipherName :: [Char]
cipherName         = "RSA-AES128-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12
    }

-- | AES cipher (256 bit key), RSA key exchange and SHA256 for digest
cipher_AES256_SHA256 :: Cipher
cipher_AES256_SHA256 :: Cipher
cipher_AES256_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x003D
    , cipherName :: [Char]
cipherName         = "RSA-AES256-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12
    }

-- This is not registered in IANA.
-- So, this will be removed in the next major release.
cipher_DHE_DSS_RC4_SHA1 :: Cipher
cipher_DHE_DSS_RC4_SHA1 :: Cipher
cipher_DHE_DSS_RC4_SHA1 = Cipher
cipher_DHE_DSS_AES128_SHA1
    { cipherID :: CipherID
cipherID           = 0x0066
    , cipherName :: [Char]
cipherName         = "DHE-DSA-RC4-SHA1"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_rc4
    }

cipher_DHE_RSA_AES128_SHA256 :: Cipher
cipher_DHE_RSA_AES128_SHA256 :: Cipher
cipher_DHE_RSA_AES128_SHA256 = Cipher
cipher_DHE_RSA_AES128_SHA1
    { cipherID :: CipherID
cipherID           = 0x0067
    , cipherName :: [Char]
cipherName         = "DHE-RSA-AES128-SHA256"
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12
    }

cipher_DHE_RSA_AES256_SHA256 :: Cipher
cipher_DHE_RSA_AES256_SHA256 :: Cipher
cipher_DHE_RSA_AES256_SHA256 = Cipher
cipher_DHE_RSA_AES128_SHA256
    { cipherID :: CipherID
cipherID           = 0x006B
    , cipherName :: [Char]
cipherName         = "DHE-RSA-AES256-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256
    }

-- | AESCCM cipher (128 bit key), RSA key exchange.
-- The SHA256 digest is used as a PRF, not as a MAC.
cipher_AES128CCM_SHA256 :: Cipher
cipher_AES128CCM_SHA256 :: Cipher
cipher_AES128CCM_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc09c
    , cipherName :: [Char]
cipherName         = "RSA-AES128CCM-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128ccm
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 6655 Sec 3
    }

-- | AESCCM8 cipher (128 bit key), RSA key exchange.
-- The SHA256 digest is used as a PRF, not as a MAC.
cipher_AES128CCM8_SHA256 :: Cipher
cipher_AES128CCM8_SHA256 :: Cipher
cipher_AES128CCM8_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc0a0
    , cipherName :: [Char]
cipherName         = "RSA-AES128CCM8-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128ccm8
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 6655 Sec 3
    }

-- | AESGCM cipher (128 bit key), RSA key exchange.
-- The SHA256 digest is used as a PRF, not as a MAC.
cipher_AES128GCM_SHA256 :: Cipher
cipher_AES128GCM_SHA256 :: Cipher
cipher_AES128GCM_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x009C
    , cipherName :: [Char]
cipherName         = "RSA-AES128GCM-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128gcm
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12
    }

-- | AESCCM cipher (256 bit key), RSA key exchange.
-- The SHA256 digest is used as a PRF, not as a MAC.
cipher_AES256CCM_SHA256 :: Cipher
cipher_AES256CCM_SHA256 :: Cipher
cipher_AES256CCM_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc09d
    , cipherName :: [Char]
cipherName         = "RSA-AES256CCM-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256ccm
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 6655 Sec 3
    }

-- | AESCCM8 cipher (256 bit key), RSA key exchange.
-- The SHA256 digest is used as a PRF, not as a MAC.
cipher_AES256CCM8_SHA256 :: Cipher
cipher_AES256CCM8_SHA256 :: Cipher
cipher_AES256CCM8_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc0a1
    , cipherName :: [Char]
cipherName         = "RSA-AES256CCM8-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256ccm8
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 6655 Sec 3
    }

-- | AESGCM cipher (256 bit key), RSA key exchange.
-- The SHA384 digest is used as a PRF, not as a MAC.
cipher_AES256GCM_SHA384 :: Cipher
cipher_AES256GCM_SHA384 :: Cipher
cipher_AES256GCM_SHA384 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x009D
    , cipherName :: [Char]
cipherName         = "RSA-AES256GCM-SHA384"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256gcm
    , cipherHash :: Hash
cipherHash         = Hash
SHA384
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA384
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12
    }

cipher_DHE_RSA_AES128CCM_SHA256 :: Cipher
cipher_DHE_RSA_AES128CCM_SHA256 :: Cipher
cipher_DHE_RSA_AES128CCM_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc09e
    , cipherName :: [Char]
cipherName         = "DHE-RSA-AES128CCM-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128ccm
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_DHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 6655 Sec 3
    }

cipher_DHE_RSA_AES128CCM8_SHA256 :: Cipher
cipher_DHE_RSA_AES128CCM8_SHA256 :: Cipher
cipher_DHE_RSA_AES128CCM8_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc0a2
    , cipherName :: [Char]
cipherName         = "DHE-RSA-AES128CCM8-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128ccm8
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_DHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 6655 Sec 3
    }

cipher_DHE_RSA_AES128GCM_SHA256 :: Cipher
cipher_DHE_RSA_AES128GCM_SHA256 :: Cipher
cipher_DHE_RSA_AES128GCM_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x009E
    , cipherName :: [Char]
cipherName         = "DHE-RSA-AES128GCM-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128gcm
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_DHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 5288 Sec 4
    }

cipher_DHE_RSA_AES256CCM_SHA256 :: Cipher
cipher_DHE_RSA_AES256CCM_SHA256 :: Cipher
cipher_DHE_RSA_AES256CCM_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc09f
    , cipherName :: [Char]
cipherName         = "DHE-RSA-AES256CCM-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256ccm
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_DHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 6655 Sec 3
    }

cipher_DHE_RSA_AES256CCM8_SHA256 :: Cipher
cipher_DHE_RSA_AES256CCM8_SHA256 :: Cipher
cipher_DHE_RSA_AES256CCM8_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc0a3
    , cipherName :: [Char]
cipherName         = "DHE-RSA-AES256CCM8-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256ccm8
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_DHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 6655 Sec 3
    }

cipher_DHE_RSA_AES256GCM_SHA384 :: Cipher
cipher_DHE_RSA_AES256GCM_SHA384 :: Cipher
cipher_DHE_RSA_AES256GCM_SHA384 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x009F
    , cipherName :: [Char]
cipherName         = "DHE-RSA-AES256GCM-SHA384"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256gcm
    , cipherHash :: Hash
cipherHash         = Hash
SHA384
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA384
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_DHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12
    }

cipher_ECDHE_RSA_CHACHA20POLY1305_SHA256 :: Cipher
cipher_ECDHE_RSA_CHACHA20POLY1305_SHA256 :: Cipher
cipher_ECDHE_RSA_CHACHA20POLY1305_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xCCA8
    , cipherName :: [Char]
cipherName         = "ECDHE-RSA-CHACHA20POLY1305-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_chacha20poly1305
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12
    }

cipher_ECDHE_ECDSA_CHACHA20POLY1305_SHA256 :: Cipher
cipher_ECDHE_ECDSA_CHACHA20POLY1305_SHA256 :: Cipher
cipher_ECDHE_ECDSA_CHACHA20POLY1305_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xCCA9
    , cipherName :: [Char]
cipherName         = "ECDHE-ECDSA-CHACHA20POLY1305-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_chacha20poly1305
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_ECDSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12
    }

cipher_DHE_RSA_CHACHA20POLY1305_SHA256 :: Cipher
cipher_DHE_RSA_CHACHA20POLY1305_SHA256 :: Cipher
cipher_DHE_RSA_CHACHA20POLY1305_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xCCAA
    , cipherName :: [Char]
cipherName         = "DHE-RSA-CHACHA20POLY1305-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_chacha20poly1305
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_DHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12
    }

cipher_TLS13_AES128GCM_SHA256 :: Cipher
cipher_TLS13_AES128GCM_SHA256 :: Cipher
cipher_TLS13_AES128GCM_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x1301
    , cipherName :: [Char]
cipherName         = "AES128GCM-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128gcm_13
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_TLS13
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS13
    }

cipher_TLS13_AES256GCM_SHA384 :: Cipher
cipher_TLS13_AES256GCM_SHA384 :: Cipher
cipher_TLS13_AES256GCM_SHA384 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x1302
    , cipherName :: [Char]
cipherName         = "AES256GCM-SHA384"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256gcm_13
    , cipherHash :: Hash
cipherHash         = Hash
SHA384
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_TLS13
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS13
    }

cipher_TLS13_CHACHA20POLY1305_SHA256 :: Cipher
cipher_TLS13_CHACHA20POLY1305_SHA256 :: Cipher
cipher_TLS13_CHACHA20POLY1305_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x1303
    , cipherName :: [Char]
cipherName         = "CHACHA20POLY1305-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_chacha20poly1305
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_TLS13
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS13
    }

cipher_TLS13_AES128CCM_SHA256 :: Cipher
cipher_TLS13_AES128CCM_SHA256 :: Cipher
cipher_TLS13_AES128CCM_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x1304
    , cipherName :: [Char]
cipherName         = "AES128CCM-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128ccm_13
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_TLS13
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS13
    }

cipher_TLS13_AES128CCM8_SHA256 :: Cipher
cipher_TLS13_AES128CCM8_SHA256 :: Cipher
cipher_TLS13_AES128CCM8_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0x1305
    , cipherName :: [Char]
cipherName         = "AES128CCM8-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128ccm8_13
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_TLS13
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS13
    }

cipher_ECDHE_ECDSA_AES128CBC_SHA :: Cipher
cipher_ECDHE_ECDSA_AES128CBC_SHA :: Cipher
cipher_ECDHE_ECDSA_AES128CBC_SHA = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xC009
    , cipherName :: [Char]
cipherName         = "ECDHE-ECDSA-AES128CBC-SHA"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128
    , cipherHash :: Hash
cipherHash         = Hash
SHA1
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_ECDSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS10
    }

cipher_ECDHE_ECDSA_AES256CBC_SHA :: Cipher
cipher_ECDHE_ECDSA_AES256CBC_SHA :: Cipher
cipher_ECDHE_ECDSA_AES256CBC_SHA = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xC00A
    , cipherName :: [Char]
cipherName         = "ECDHE-ECDSA-AES256CBC-SHA"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256
    , cipherHash :: Hash
cipherHash         = Hash
SHA1
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_ECDSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS10
    }

cipher_ECDHE_RSA_AES128CBC_SHA :: Cipher
cipher_ECDHE_RSA_AES128CBC_SHA :: Cipher
cipher_ECDHE_RSA_AES128CBC_SHA = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xC013
    , cipherName :: [Char]
cipherName         = "ECDHE-RSA-AES128CBC-SHA"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128
    , cipherHash :: Hash
cipherHash         = Hash
SHA1
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS10
    }

cipher_ECDHE_RSA_AES256CBC_SHA :: Cipher
cipher_ECDHE_RSA_AES256CBC_SHA :: Cipher
cipher_ECDHE_RSA_AES256CBC_SHA = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xC014
    , cipherName :: [Char]
cipherName         = "ECDHE-RSA-AES256CBC-SHA"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256
    , cipherHash :: Hash
cipherHash         = Hash
SHA1
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Maybe Hash
forall a. Maybe a
Nothing
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS10
    }

cipher_ECDHE_RSA_AES128CBC_SHA256 :: Cipher
cipher_ECDHE_RSA_AES128CBC_SHA256 :: Cipher
cipher_ECDHE_RSA_AES128CBC_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xC027
    , cipherName :: [Char]
cipherName         = "ECDHE-RSA-AES128CBC-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 5288 Sec 4
    }

cipher_ECDHE_RSA_AES256CBC_SHA384 :: Cipher
cipher_ECDHE_RSA_AES256CBC_SHA384 :: Cipher
cipher_ECDHE_RSA_AES256CBC_SHA384 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xC028
    , cipherName :: [Char]
cipherName         = "ECDHE-RSA-AES256CBC-SHA384"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256
    , cipherHash :: Hash
cipherHash         = Hash
SHA384
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA384
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 5288 Sec 4
    }

cipher_ECDHE_ECDSA_AES128CBC_SHA256 :: Cipher
cipher_ECDHE_ECDSA_AES128CBC_SHA256 :: Cipher
cipher_ECDHE_ECDSA_AES128CBC_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc023
    , cipherName :: [Char]
cipherName         = "ECDHE-ECDSA-AES128CBC-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_ECDSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 5289
    }

cipher_ECDHE_ECDSA_AES256CBC_SHA384 :: Cipher
cipher_ECDHE_ECDSA_AES256CBC_SHA384 :: Cipher
cipher_ECDHE_ECDSA_AES256CBC_SHA384 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xC024
    , cipherName :: [Char]
cipherName         = "ECDHE-ECDSA-AES256CBC-SHA384"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256
    , cipherHash :: Hash
cipherHash         = Hash
SHA384
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA384
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_ECDSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 5289
    }

cipher_ECDHE_ECDSA_AES128CCM_SHA256 :: Cipher
cipher_ECDHE_ECDSA_AES128CCM_SHA256 :: Cipher
cipher_ECDHE_ECDSA_AES128CCM_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc0ac
    , cipherName :: [Char]
cipherName         = "ECDHE-ECDSA-AES128CCM-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128ccm
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_ECDSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 7251
    }

cipher_ECDHE_ECDSA_AES128CCM8_SHA256 :: Cipher
cipher_ECDHE_ECDSA_AES128CCM8_SHA256 :: Cipher
cipher_ECDHE_ECDSA_AES128CCM8_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc0ae
    , cipherName :: [Char]
cipherName         = "ECDHE-ECDSA-AES128CCM8-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128ccm8
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_ECDSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 7251
    }

cipher_ECDHE_ECDSA_AES128GCM_SHA256 :: Cipher
cipher_ECDHE_ECDSA_AES128GCM_SHA256 :: Cipher
cipher_ECDHE_ECDSA_AES128GCM_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xC02B
    , cipherName :: [Char]
cipherName         = "ECDHE-ECDSA-AES128GCM-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128gcm
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_ECDSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 5289
    }

cipher_ECDHE_ECDSA_AES256CCM_SHA256 :: Cipher
cipher_ECDHE_ECDSA_AES256CCM_SHA256 :: Cipher
cipher_ECDHE_ECDSA_AES256CCM_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc0ad
    , cipherName :: [Char]
cipherName         = "ECDHE-ECDSA-AES256CCM-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256ccm
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_ECDSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 7251
    }

cipher_ECDHE_ECDSA_AES256CCM8_SHA256 :: Cipher
cipher_ECDHE_ECDSA_AES256CCM8_SHA256 :: Cipher
cipher_ECDHE_ECDSA_AES256CCM8_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xc0af
    , cipherName :: [Char]
cipherName         = "ECDHE-ECDSA-AES256CCM8-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256ccm8
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_ECDSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 7251
    }

cipher_ECDHE_ECDSA_AES256GCM_SHA384 :: Cipher
cipher_ECDHE_ECDSA_AES256GCM_SHA384 :: Cipher
cipher_ECDHE_ECDSA_AES256GCM_SHA384 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xC02C
    , cipherName :: [Char]
cipherName         = "ECDHE-ECDSA-AES256GCM-SHA384"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256gcm
    , cipherHash :: Hash
cipherHash         = Hash
SHA384
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA384
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_ECDSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 5289
    }

cipher_ECDHE_RSA_AES128GCM_SHA256 :: Cipher
cipher_ECDHE_RSA_AES128GCM_SHA256 :: Cipher
cipher_ECDHE_RSA_AES128GCM_SHA256 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xC02F
    , cipherName :: [Char]
cipherName         = "ECDHE-RSA-AES128GCM-SHA256"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes128gcm
    , cipherHash :: Hash
cipherHash         = Hash
SHA256
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA256
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 5288 Sec 4
    }

cipher_ECDHE_RSA_AES256GCM_SHA384 :: Cipher
cipher_ECDHE_RSA_AES256GCM_SHA384 :: Cipher
cipher_ECDHE_RSA_AES256GCM_SHA384 = Cipher :: CipherID
-> [Char]
-> Hash
-> Bulk
-> CipherKeyExchangeType
-> Maybe Version
-> Maybe Hash
-> Cipher
Cipher
    { cipherID :: CipherID
cipherID           = 0xC030
    , cipherName :: [Char]
cipherName         = "ECDHE-RSA-AES256GCM-SHA384"
    , cipherBulk :: Bulk
cipherBulk         = Bulk
bulk_aes256gcm
    , cipherHash :: Hash
cipherHash         = Hash
SHA384
    , cipherPRFHash :: Maybe Hash
cipherPRFHash      = Hash -> Maybe Hash
forall a. a -> Maybe a
Just Hash
SHA384
    , cipherKeyExchange :: CipherKeyExchangeType
cipherKeyExchange  = CipherKeyExchangeType
CipherKeyExchange_ECDHE_RSA
    , cipherMinVer :: Maybe Version
cipherMinVer       = Version -> Maybe Version
forall a. a -> Maybe a
Just Version
TLS12 -- RFC 5289
    }

-- A list of cipher suite is found from:
-- https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4