Module Conex_mirage_crypto.C

type t

The abstract type t for keys

val decode_priv : string -> Conex_resource.timestamp -> string -> (t, string) Stdlib.result

decode_priv id ts data decodes the private key from data and returns a t or an error.

val bits : t -> int

bits t is the number of bits in t.

val created : t -> Conex_resource.timestamp

created t is the timestamp of creation of t.

id t is the identifier of t.

alg t is the algorithm of t.

val generate : alg:Conex_resource.Key.alg -> ?bits:int -> unit -> string * string

generate ~alg ~bits () generates a private key.

val pub_of_priv : t -> string

pub_of_priv priv is for RSA keys the PEM-encoded PKCS8 public key of priv, for Ed25519 keys the raw public key.

val sign : t -> string -> (string, string) Stdlib.result

sign priv data is for RSA keys the raw PSS signature of data using priv or an error, for Ed25519 keys the signature.

val sha256 : string -> string

sha256 s is the SHA256 digest of s.