package mirage-crypto

  1. Overview
  2. Docs
type key
val of_secret : maclen:int -> Cstruct.t -> key

Construct the encryption key corresponding to secret, that will produce authentication codes with the length maclen.

val key_sizes : int array

Key sizes allowed with this cipher.

val block_size : int

The size of a single block.

val mac_sizes : int array

MAC lengths allowed with this cipher.

val encrypt : key:key -> nonce:Cstruct.t -> ?adata:Cstruct.t -> Cstruct.t -> Cstruct.t

encrypt ~key ~nonce ?adata msg is msg encrypted under key and nonce, packed with authentication data computed over msg and adata.

val decrypt : key:key -> nonce:Cstruct.t -> ?adata:Cstruct.t -> Cstruct.t -> Cstruct.t option

decrypt ~key ~nonce ?adata msg is Some text when msg was produced by the corresponding encrypt, or None otherwise.

OCaml

Innovation. Community. Security.