package nocrypto

  1. Overview
  2. Docs

PKCS v1.5-padded operations, as defined by PKCS #1 v1.5.

Keys must have a minimum of 11 + len(message) bytes.

val sig_encode : ?mask:mask -> key:priv -> Cstruct.t -> Cstruct.t

sig_encode mask key message is the PKCS1-padded (type 1) message signed by the key. Note that this operation performs only the padding and RSA transformation steps of the PKCS 1.5 signature.

val sig_decode : key:pub -> Cstruct.t -> Cstruct.t option

sig_decode key signature is either Some message if the signature was produced with the given key as per sign, or None

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

encrypt g key message is a PKCS1-padded (type 2) and encrypted message.

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

decrypt mask key ciphertext is Some message if the ciphertext was produced by the corresponding encrypt operation, or None otherwise.