HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulecryptonite-0.30Haskell2010

Crypto.Cipher.AESGCMSIV

Implementation of AES-GCM-SIV, an AEAD scheme with nonce misuse resistance defined in RFC 8452.

To achieve the nonce misuse-resistance property, encryption requires two passes on the plaintext, hence no streaming API is provided. This AEAD operates on complete inputs held in memory. For simplicity, the implementation of decryption uses a similar pattern, with performance penalty compared to an implementation which is able to merge both passes.

The specification allows inputs up to 2^36 bytes but this implementation requires AAD and plaintext/ciphertext to be both smaller than 2^32 bytes.

  • 1 type
  • 4 values
  • Packagecryptonite-0.30
  • Exports5
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceAESGCMSIV.hs
newtypenewtype Nonce
#

Nonce value for AES-GCM-SIV, always 12 bytes.

Instances3Eq, Show, ByteArrayAccess
  • Eq NonceDefined in cryptonite-0.30 · Crypto.Cipher.AESGCMSIV
  • Show NonceDefined in cryptonite-0.30 · Crypto.Cipher.AESGCMSIV
  • ByteArrayAccess NonceDefined in cryptonite-0.30 · Crypto.Cipher.AESGCMSIV
valueencrypt
  1. :: (BlockCipher128 aes, ByteArrayAccess aad, ByteArray ba)
  2. => aes
  3. -> Nonce
  4. -> aad
  5. -> ba
  6. -> (AuthTag, ba)
#

AEAD encryption with the specified key and nonce. The key must be given as an initialized AES128 or AES256 cipher.

Lengths of additional data and plaintext must be less than 2^32 bytes, otherwise an exception is thrown.

valuedecrypt
  1. :: (BlockCipher128 aes, ByteArrayAccess aad, ByteArray ba)
  2. => aes
  3. -> Nonce
  4. -> aad
  5. -> ba
  6. -> AuthTag
  7. -> Maybe ba
#

AEAD decryption with the specified key and nonce. The key must be given as an initialized AES128 or AES256 cipher.

Lengths of additional data and ciphertext must be less than 2^32 bytes, otherwise an exception is thrown.