package sodium

  1. Overview
  2. Docs
type storage = Stdlib.Bytes.t
val of_public_key : public key -> storage

of_public_key k converts k to type storage. The result is public_key_size bytes long.

val to_public_key : storage -> public key

to_public_key s converts s to a public key.

val of_secret_key : secret key -> storage

of_secret_key k converts k to storage. The result is secret_key_size bytes long.

val to_secret_key : storage -> secret key

to_secret_key s converts s to a secret key.

val of_channel_key : channel key -> storage

of_channel_key k converts k to storage. The result is channel_key_size bytes long.

val to_channel_key : storage -> channel key

to_channel_key s converts s to a channel key.

val of_nonce : nonce -> storage

of_nonce n converts n to storage. The result is nonce_size bytes long.

val to_nonce : storage -> nonce

to_nonce s converts s to a nonce.

val box : secret key -> public key -> storage -> nonce -> storage

box sk pk m n encrypts and authenticates a message m using the sender's secret key sk, the receiver's public key pk, and a nonce n.

val box_open : secret key -> public key -> storage -> nonce -> storage

box_open sk pk c n verifies and decrypts a ciphertext c using the receiver's secret key sk, the sender's public key pk, and a nonce n.

val fast_box : channel key -> storage -> nonce -> storage

fast_box ck m n encrypts and authenticates a message m using the channel key ck precomputed from sender's secret key and the receiver's public key, and a nonce n.

val fast_box_open : channel key -> storage -> nonce -> storage

fast_box_open ck c n verifies and decrypts a ciphertext c using the channel key ck precomputed from receiver's secret key and the sender's public key, and a nonce n.

OCaml

Innovation. Community. Security.