mirage-crypto-pk

Simple public-key cryptography for the modern age
IN THIS PACKAGE

Parameters

Signature

val encrypt : ?g:Mirage_crypto_rng.g -> ?label:Cstruct.t -> key:pub -> Cstruct.t -> Cstruct.t

encrypt ~g ~label ~key message is OAEP-padded and encrypted message, using the optional label.

  • raises Insufficient_key

    (see Insufficient_key)

val decrypt : ?crt_hardening:bool -> ?mask:mask -> ?label:Cstruct.t -> key:priv -> Cstruct.t -> Cstruct.t option

decrypt ~crt_hardening ~mask ~label ~key ciphertext is Some message if the ciphertext was produced by the corresponding encrypt operation, or None otherwise. crt_hardening defaults to false.