package mirage-crypto

  1. Overview
  2. Docs
type key
type result = {
  1. message : Cstruct.t;
  2. tag : Cstruct.t;
}

The transformed message, packed with the authentication tag.

val of_secret : Cstruct.t -> key

Construct the encryption key corresponding to secret.

val key_sizes : int array

Key sizes allowed with this cipher.

val block_size : int

The size of a single block.

val encrypt : key:key -> iv:Cstruct.t -> ?adata:Cstruct.t -> Cstruct.t -> result

encrypt ~key ~iv ?adata msg is the result containing msg encrypted under key, with iv as the initialization vector, and the authentication tag computed over both adata and msg.

val decrypt : key:key -> iv:Cstruct.t -> ?adata:Cstruct.t -> Cstruct.t -> result

decrypt ~key ~iv ?adata msg is the result containing the inversion of encrypt and the same authentication tag.

OCaml

Innovation. Community. Security.