package sihl

  1. Overview
  2. Docs

Module Crypto.Encrypted_tokenSource

Sourcetype t
Sourceval equal : t -> t -> bool

equal tkn1 tkn2 checks if two encrypted tokens tkn1 and tkn2 are equal.

Sourceval to_uri_safe_string : t -> string

to_uri_safe_string tkn turns an encrypted token tkn into a URI-safe base64 string. Used to make sure CSRF works with all encodings.

Sourceval of_uri_safe_string : string -> t option

of_uri_safe_string tkn turns a URI-safe string tkn into an encrypted token. Attempts to parse the base64 input tkn, which can fail. This does not perform any cryptographic operation to ensure tkn can be decrypted.

Sourceval to_struct : t -> Cstruct.t

to_struct tkn turns an encrypted token tkn to a raw format.

Sourceval from_struct : with_secret:Secret.t -> Cstruct.t -> t

from_struct ~with_secret tkn encrypts a raw token tkn using AES in ECB mode given a secret with_secret.

Sourceval from_struct_random : with_secret:Secret.t -> Cstruct.t -> t

from_struct_random ~with_secret tkn encrypts a raw token tkn. Additionally the encrypted result is scrambled with a random salt (IV) using AES in CBC mode given a secret with_secret.

OCaml

Innovation. Community. Security.