package tezos-crypto

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type _ key
val size : int

Size of a signature

val pk_size : int

Size of a public key

val sk_size : int

Size of a secret key

val compare : 'a key -> 'a key -> int
val equal : 'a key -> 'a key -> bool
val sk_of_bytes : Stdlib.Bytes.t -> secret key option
val pk_of_bytes : Stdlib.Bytes.t -> public key option
val pk_of_bytes_without_validation : Stdlib.Bytes.t -> public key option

This function does not check that the resulting pk is valid. It is slightly faster than pk_of_bytes but should only be used to deserialize bytes that were serialized from a pk. E.g. the pks in the storage of the protocol.

val neuterize : 'a key -> public key

neuterize sk generates the corresponding public key of sk

val keypair : unit -> public key * secret key

keypair generates both a secret key and its corresponding public key

val to_bytes : _ key -> Stdlib.Bytes.t

to_bytes key returns the contents of the key. For P-256 public keys, it returns the compressed form (see hacl.ml for more details)

val blit_to_bytes : _ key -> ?pos:int -> Stdlib.Bytes.t -> unit

blit_to_bytes key ?pos buf copies all of the bytes of key into buf starting at position pos. As above, P-256 public keys are written in compressed form.

val sign : sk:secret key -> msg:Stdlib.Bytes.t -> Stdlib.Bytes.t

sign sk msg returns the signature of msg with sk

val verify : pk:public key -> msg:Stdlib.Bytes.t -> signature:Stdlib.Bytes.t -> bool

verify pk msg signature attempts to verify msg with signature and returns true if successful

OCaml

Innovation. Community. Security.