crypto-cipher-tests-0.0.11: Generic cryptography cipher tests

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

Crypto.Cipher.Tests

Contents

- KATs

Description

Synopsis

- testBlockCipher :: BlockCipher a => KATs -> a -> Test
- testBlockCipherIO :: BlockCipherIO a => KATs -> a -> Test
- testStreamCipher :: StreamCipher a => [KAT_Stream] -> a -> Test
- defaultKATs :: KATs
- defaultStreamKATs :: [KAT_Stream]
- data KATs = KATs {
  - kat_ECB :: [KAT_ECB]
  - kat_CBC :: [KAT_CBC]
  - kat_CFB :: [KAT_CFB]
  - kat_CTR :: [KAT_CTR]
  - kat_XTS :: [KAT_XTS]
  - kat_AEAD :: [KAT_AEAD]
  }
- data KAT_Stream = KAT_Stream {
  - streamKey :: ByteString
  - streamPlaintext :: ByteString
  - streamCiphertext :: ByteString
  }
- data KAT_ECB = KAT_ECB {
  - ecbKey :: ByteString
  - ecbPlaintext :: ByteString
  - ecbCiphertext :: ByteString
  }
- data KAT_CBC = KAT_CBC {
  - cbcKey :: ByteString
  - cbcIV :: ByteString
  - cbcPlaintext :: ByteString
  - cbcCiphertext :: ByteString
  }
- data KAT_CFB = KAT_CFB {
  - cfbKey :: ByteString
  - cfbIV :: ByteString
  - cfbPlaintext :: ByteString
  - cfbCiphertext :: ByteString
  }
- data KAT_CTR = KAT_CTR {
  - ctrKey :: ByteString
  - ctrIV :: ByteString
  - ctrPlaintext :: ByteString
  - ctrCiphertext :: ByteString
  }
- data KAT_XTS = KAT_XTS {
  - xtsKey1 :: ByteString
  - xtsKey2 :: ByteString
  - xtsIV :: ByteString
  - xtsPlaintext :: ByteString
  - xtsCiphertext :: ByteString
  }
- data KAT_AEAD = KAT_AEAD {
  - aeadMode :: AEADMode
  - aeadKey :: ByteString
  - aeadIV :: ByteString
  - aeadHeader :: ByteString
  - aeadPlaintext :: ByteString
  - aeadCiphertext :: ByteString
  - aeadTaglen :: Int
  - aeadTag :: AuthTag
  }

# Documentation

testBlockCipher :: BlockCipher a => KATs -> a -> Test Source #

Return tests for a specific blockcipher and a list of KATs

testBlockCipherIO :: BlockCipherIO a => KATs -> a -> Test Source #

Return test for a specific blockcipher and a list of KATs

testStreamCipher :: StreamCipher a => [KAT_Stream] -> a -> Test Source #

Return tests for a specific streamcipher and a list of KATs

# KATs

defaultKATs :: KATs Source #

the empty KATs

defaultStreamKATs :: [KAT_Stream] Source #

the empty KATs for stream

data KATs Source #

all the KATs. use defaultKATs to prevent compilation error from future expansion of this data structure

Constructors

KATs |

Fields

- kat_ECB :: [KAT_ECB]
- kat_CBC :: [KAT_CBC]
- kat_CFB :: [KAT_CFB]
- kat_CTR :: [KAT_CTR]
- kat_XTS :: [KAT_XTS]
- kat_AEAD :: [KAT_AEAD]

#### Instances

Instances details

Show KATs Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods showsPrec :: Int -> KATs -> ShowS Source # show :: KATs -> String Source # showList :: [KATs] -> ShowS Source #
Eq KATs Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods (==) :: KATs -> KATs -> Bool Source # (/=) :: KATs -> KATs -> Bool Source #

data KAT_Stream Source #

KAT for Stream cipher

Constructors

KAT_Stream |

Fields

- streamKey :: ByteString
- streamPlaintext :: ByteString
- streamCiphertext :: ByteString

#### Instances

Instances details

Show KAT_Stream Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods showsPrec :: Int -> KAT_Stream -> ShowS Source # show :: KAT_Stream -> String Source # showList :: [KAT_Stream] -> ShowS Source #
Eq KAT_Stream Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods (==) :: KAT_Stream -> KAT_Stream -> Bool Source # (/=) :: KAT_Stream -> KAT_Stream -> Bool Source #

data KAT_ECB Source #

ECB KAT

Constructors

KAT_ECB |

Fields

- ecbKey :: ByteString

  Key

- ecbPlaintext :: ByteString

  Plaintext

- ecbCiphertext :: ByteString

  Ciphertext

#### Instances

Instances details

Show KAT_ECB Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods showsPrec :: Int -> KAT_ECB -> ShowS Source # show :: KAT_ECB -> String Source # showList :: [KAT_ECB] -> ShowS Source #
Eq KAT_ECB Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods (==) :: KAT_ECB -> KAT_ECB -> Bool Source # (/=) :: KAT_ECB -> KAT_ECB -> Bool Source #

data KAT_CBC Source #

CBC KAT

Constructors

KAT_CBC |

Fields

- cbcKey :: ByteString

  Key

- cbcIV :: ByteString

  IV

- cbcPlaintext :: ByteString

  Plaintext

- cbcCiphertext :: ByteString

  Ciphertext

#### Instances

Instances details

Show KAT_CBC Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods showsPrec :: Int -> KAT_CBC -> ShowS Source # show :: KAT_CBC -> String Source # showList :: [KAT_CBC] -> ShowS Source #
Eq KAT_CBC Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods (==) :: KAT_CBC -> KAT_CBC -> Bool Source # (/=) :: KAT_CBC -> KAT_CBC -> Bool Source #

data KAT_CFB Source #

CFB KAT

Constructors

KAT_CFB |

Fields

- cfbKey :: ByteString

  Key

- cfbIV :: ByteString

  IV

- cfbPlaintext :: ByteString

  Plaintext

- cfbCiphertext :: ByteString

  Ciphertext

#### Instances

Instances details

Show KAT_CFB Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods showsPrec :: Int -> KAT_CFB -> ShowS Source # show :: KAT_CFB -> String Source # showList :: [KAT_CFB] -> ShowS Source #
Eq KAT_CFB Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods (==) :: KAT_CFB -> KAT_CFB -> Bool Source # (/=) :: KAT_CFB -> KAT_CFB -> Bool Source #

data KAT_CTR Source #

CTR KAT

Constructors

KAT_CTR |

Fields

- ctrKey :: ByteString

  Key

- ctrIV :: ByteString

  IV (usually represented as a 128 bits integer)

- ctrPlaintext :: ByteString

  Plaintext

- ctrCiphertext :: ByteString

  Ciphertext

#### Instances

Instances details

Show KAT_CTR Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods showsPrec :: Int -> KAT_CTR -> ShowS Source # show :: KAT_CTR -> String Source # showList :: [KAT_CTR] -> ShowS Source #
Eq KAT_CTR Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods (==) :: KAT_CTR -> KAT_CTR -> Bool Source # (/=) :: KAT_CTR -> KAT_CTR -> Bool Source #

data KAT_XTS Source #

XTS KAT

Constructors

KAT_XTS |

Fields

- xtsKey1 :: ByteString

  1st XTS key

- xtsKey2 :: ByteString

  2nd XTS key

- xtsIV :: ByteString

  XTS IV

- xtsPlaintext :: ByteString

  plaintext

- xtsCiphertext :: ByteString

  Ciphertext

#### Instances

Instances details

Show KAT_XTS Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods showsPrec :: Int -> KAT_XTS -> ShowS Source # show :: KAT_XTS -> String Source # showList :: [KAT_XTS] -> ShowS Source #
Eq KAT_XTS Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods (==) :: KAT_XTS -> KAT_XTS -> Bool Source # (/=) :: KAT_XTS -> KAT_XTS -> Bool Source #

data KAT_AEAD Source #

AEAD KAT

Constructors

KAT_AEAD |

Fields

- aeadMode :: AEADMode

  AEAD mode to use

- aeadKey :: ByteString

  Key

- aeadIV :: ByteString

  IV for initialization

- aeadHeader :: ByteString

  Authentificated Header

- aeadPlaintext :: ByteString

  Plaintext

- aeadCiphertext :: ByteString

  Ciphertext

- aeadTaglen :: Int

  aead tag len

- aeadTag :: AuthTag

  expected tag

#### Instances

Instances details

Show KAT_AEAD Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods showsPrec :: Int -> KAT_AEAD -> ShowS Source # show :: KAT_AEAD -> String Source # showList :: [KAT_AEAD] -> ShowS Source #
Eq KAT_AEAD Source # |
Instance details Defined in Crypto.Cipher.Tests.KATs Methods (==) :: KAT_AEAD -> KAT_AEAD -> Bool Source # (/=) :: KAT_AEAD -> KAT_AEAD -> Bool Source #