package secp256k1

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t

Opaque data structure that holds a parsed ECDSA signature.

val compare : t -> t -> int
val of_compact : Context.t -> ?pos:int -> buffer -> t option
val of_compact_exn : Context.t -> ?pos:int -> buffer -> t

Parse an ECDSA signature in compact (64 bytes) format. Buffer must be 64 bytes long.

val of_der : Context.t -> ?pos:int -> buffer -> t option
val of_der_exn : Context.t -> ?pos:int -> buffer -> t

Parse a DER ECDSA signature.

val to_compact : Context.t -> t -> buffer

Serialize an ECDSA signature in compact (64 byte) format.

val to_der : Context.t -> t -> buffer

Serialize an ECDSA signature in DER format.

val write_compact : Context.t -> buffer -> ?pos:int -> t -> int

write_compact ctx buf ?pos signature writes signature at buf starting at pos in compact format.

val write_der : Context.t -> buffer -> ?pos:int -> t -> int

write_der ctx buf ?pos signature writes signature at buf starting at pos in DER format.

val sign : Context.t -> seckey:Secret.t -> ?pos:int -> buffer -> t

Create an ECDSA signature. The created signature is always in lower-S form. Buffer must contain a 32-byte message hash.

val write_sign : Context.t -> seckey:Secret.t -> outbuf:buffer -> ?outpos:int -> inbuf:buffer -> ?inpos:int -> unit -> int

write_sign ctx ~seckey ~outbuf ~outpos ~inbuf ~inpos () signs the message at inbuf starting at inpos and writes the signature at outbuf starting at outpos using seckey, and returns the number of bytes written.

val verify : Context.t -> pubkey:Public.t -> signature:t -> ?pos:int -> buffer -> bool

Verify an ECDSA signature. To avoid accepting malleable signatures, only ECDSA signatures in lower-S form are accepted.

OCaml

Innovation. Community. Security.