package tezos-crypto

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Bls : sig ... end

Tezos - BLS12-381 cryptography

module Ed25519 : sig ... end

Tezos - Ed25519 cryptography

module P256 : sig ... end

Tezos - P256 cryptography

module Secp256k1 : sig ... end

Tezos - Secp256k1 cryptography

include module type of struct include Signature end
module type CONV = Signature.CONV

The type of conversion modules from one version to another.

The type of partial conversion modules from one version to another.

module V_latest : sig ... end

The module V_latest is to be used by the shell and points to the latest available version of signatures.

module V0 : sig ... end

V0 supports Ed25519, Secp256k1, and P256.

module V1 : sig ... end

V1 supports Ed25519, Secp256k1, P256, and BLS.

include module type of V_latest

The module V_latest is to be used by the shell and points to the latest available version of signatures.

The module V_latest is to be used by the shell and points to the latest available version of signatures.

type public_key_hash = Signature.V_latest.public_key_hash
type public_key = Signature.V_latest.public_key =
  1. | Bls of Bls12_381_signature.MinPk.pk
type secret_key = Signature.V_latest.secret_key =
  1. | Bls of Bls12_381_signature.sk
type watermark =
  1. | Generic_operation
  2. | Custom of Stdlib.Bytes.t
val bytes_of_watermark : watermark -> Stdlib.Bytes.t
val pp_watermark : Stdlib.Format.formatter -> watermark -> unit
type signature = Signature.V_latest.signature =
  1. | Bls of Bls12_381_signature.MinPk.signature
  2. | Unknown of Stdlib.Bytes.t
type prefix = Signature.V_latest.prefix =
  1. | Bls_prefix of Stdlib.Bytes.t

A signature prefix holds data only for signature that are more than 64 bytes long.

module Public_key_hash : sig ... end
module Public_key : sig ... end
module Secret_key : sig ... end
type t = signature
val pp : Stdlib.Format.formatter -> t -> unit
include Tezos_stdlib.Compare.S with type t := t
val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (<) : t -> t -> bool
val (<=) : t -> t -> bool
val (>=) : t -> t -> bool
val (>) : t -> t -> bool
val compare : t -> t -> int
val equal : t -> t -> bool
val max : t -> t -> t
val min : t -> t -> t
val to_b58check : t -> string
val to_short_b58check : t -> string
val of_b58check : string -> t Tezos_error_monad.Error_monad.tzresult
val of_b58check_exn : string -> t
val of_b58check_opt : string -> t option
type Base58.data +=
  1. | Data of t
val b58check_encoding : t Base58.encoding
val encoding : t Data_encoding.t
val rpc_arg : t Tezos_rpc.Arg.t
val zero : t
val sign : ?watermark:watermark -> Secret_key.t -> Stdlib.Bytes.t -> t

sign ?watermark sk message produce the signature of message (with possibly watermark) using sk.

val check : ?watermark:watermark -> Public_key.t -> t -> Stdlib.Bytes.t -> bool

check pk ?watermark signature message check that signature is the signature produced by signing message (with possibly watermark) with the secret key of pk.

val deterministic_nonce : Secret_key.t -> Stdlib.Bytes.t -> Stdlib.Bytes.t

deterministic_nonce sk msg returns a nonce that is determined by sk and msg

val deterministic_nonce_hash : Secret_key.t -> Stdlib.Bytes.t -> Stdlib.Bytes.t

deterministic_nonce_hash sk msg returns the BLAKE2b hash of a nonce that is determined by sk and msg.

In other words, Blake2b.digest (deterministic_nonce sk msg) = deterministic_nonce_hash sk msg

type splitted = {
  1. prefix : prefix option;
  2. suffix : Stdlib.Bytes.t;
}

A splitted signature is a binary representation of a signature with a fixed 64 bytes suffix and a possible prefix.

val split_signature : t -> splitted

split_signature s splits the signature s into {prefix; suffix} where suffix is the fixed 64 bytes suffix of s and prefix are the remaining preceding bytes if any.

val of_splitted : splitted -> t option

of_splitted s reconstructs a signature from a splitted one, if possible.

val prefix_encoding : prefix Data_encoding.t

Encoding for signature prefixes.

val append : ?watermark:watermark -> secret_key -> Stdlib.Bytes.t -> Stdlib.Bytes.t

append sk buf is the concatenation of buf and the serialization of the signature of buf signed by sk.

val concat : Stdlib.Bytes.t -> t -> Stdlib.Bytes.t

concat buf t is the concatenation of buf and the serialization of t.

val to_hex : t -> Tezos_stdlib.Hex.t
val of_hex : Tezos_stdlib.Hex.t -> t Tezos_error_monad.Error_monad.tzresult
val of_hex_opt : Tezos_stdlib.Hex.t -> t option
val of_hex_exn : Tezos_stdlib.Hex.t -> t
val to_string : t -> string
val of_string : string -> t Tezos_error_monad.Error_monad.tzresult
val of_string_opt : string -> t option
val of_string_exn : string -> t
val to_bytes : t -> Stdlib.Bytes.t
val of_bytes : Stdlib.Bytes.t -> t Tezos_error_monad.Error_monad.tzresult
val of_bytes_opt : Stdlib.Bytes.t -> t option
val of_bytes_exn : Stdlib.Bytes.t -> t
val size : t -> int

The size of the signature in bytes. Can be 64 for Ed25519, Secp256k1 and P256 signatures or 96 for BLS signatures.

val of_secp256k1 : Tezos_crypto__.Secp256k1.t -> t

of_secp256k1 s returns a wrapped version of the Secp256k1 signature s in t.

val of_ed25519 : Tezos_crypto__.Ed25519.t -> t

of_ed25519 s returns a wrapped version of the Ed25519 signature s in t.

val of_p256 : Tezos_crypto__.P256.t -> t

of_p256 s returns a wrapped version of the P256 signature s in t.

val of_bls : Bls12_381_signature.MinPk.signature -> t

of_bls s returns a wrapped version of the BLS signature s in t.

type algo = Signature.V_latest.algo =
  1. | Ed25519
  2. | Secp256k1
  3. | P256
  4. | Bls

The type of signing algorithms.

val algos : algo list

The list of signing algorithm supported, i.e. all constructors of type algo.

val generate_key : ?algo:algo -> ?seed:Stdlib.Bytes.t -> unit -> public_key_hash * public_key * secret_key

generate_key ~algo ~seed () generates a key pair for the signing algorithm algo from the random seed seed.

module Of_V_latest : sig ... end

Converting from signatures of V_latest to V_latest. This module implements conversions which are the identity, so total, but we keep the signature as CONV_OPT for compatibility with V0.Of_V_latest and V1.Of_V_latest and to ease snapshotting.

module Of_V0 : sig ... end

Converting from signatures of V0 to V_latest.

module Of_V1 : sig ... end

Converting from signatures of V1 to V_latest.

OCaml

Innovation. Community. Security.