package sodium

  1. Overview
  2. Docs
type storage = bigbytes
val of_public_key : public key -> storage

of_public_key k converts k to 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_signature : signature -> storage

of_signature a converts a to storage. The result is signature_size bytes long.

val to_signature : storage -> signature

to_signature s converts s to a signature.

val of_seed : seed -> storage

of_seed s converts s to type storage. The result is seed_size bytes long.

val to_seed : storage -> seed

to_seed s converts s to a seed.

  • raises Size_mismatch

    if s is not seed_size bytes long

val sign : secret key -> storage -> storage

sign sk m signs a message m using the signer's secret key sk, and returns the resulting signed message.

val sign_open : public key -> storage -> storage

sign_open pk sm verifies the signature in sm using the signer's public key pk, and returns the message.

  • raises Verification_failure

    if authenticity of message cannot be verified

val sign_detached : secret key -> storage -> signature

sign_detached sk m signs a message m using the signer's secret key sk, and returns the signature.

val verify : public key -> signature -> storage -> unit

verify pk s m checks that s is a correct signature of a message m under the public key pk.

  • raises Verification_failure

    if s is not a correct signature of m under pk