package secp256k1-internal

  1. Overview
  2. Docs

Module External.SignSource

Signature

Sourcetype plain
Sourcetype recoverable
Sourcetype _ t
Sourceval buffer : _ t -> Bigstring.t

buffer signature is the underlying buffer of signature. DO NOT MODIFY.

Sourceval plain_bytes : int

64 bytes

Sourceval recoverable_bytes : int

65 bytes

Sourceval msg_bytes : int

32 bytes

Sourceval equal : 'a t -> 'a t -> bool
Sourceval to_plain : Context.t -> _ t -> plain t

Input/Output

Sourceval read : Context.t -> Bigstring.t -> (plain t, string) result
Sourceval read_exn : Context.t -> Bigstring.t -> plain t
Sourceval read_der : Context.t -> Bigstring.t -> (plain t, string) result
Sourceval read_der_exn : Context.t -> Bigstring.t -> plain t
Sourceval read_recoverable : Context.t -> Bigstring.t -> (recoverable t, string) result

read_recoverable_exn ctx buf reads a recoverable signature in buf if everything goes well or return an error otherwise.

Sourceval read_recoverable_exn : Context.t -> Bigstring.t -> recoverable t

read_recoverable_exn ctx buf reads a recoverable signature in buf.

  • raises [Invalid_argument]

    if buf is less than 65 bytes long or buf does not contain a valid recoverable signature.

Sourceval write_exn : ?der:bool -> Context.t -> Bigstring.t -> _ t -> int
Sourceval write : ?der:bool -> Context.t -> Bigstring.t -> _ t -> (int, string) result
Sourceval to_bytes : ?der:bool -> Context.t -> _ t -> Bigstring.t

to_bytes ?der ctx signature writes the serialization of signature in a freshly allocated Bigstring.t, which is then returned.

Sign

Sourceval normalize : Context.t -> plain t -> plain t option

normalize ctx sig is the normalized lower-S form of Some normalized_sig if sig was not already in this form, or None otherwise.

Creation
Sourceval sign : Context.t -> sk:Key.secret Key.t -> Bigstring.t -> (plain t, string) result
Sourceval sign_exn : Context.t -> sk:Key.secret Key.t -> Bigstring.t -> plain t
Sourceval sign_recoverable : Context.t -> sk:Key.secret Key.t -> Bigstring.t -> (recoverable t, string) result
Sourceval sign_recoverable_exn : Context.t -> sk:Key.secret Key.t -> Bigstring.t -> recoverable t
Direct write
Sourceval write_sign : Context.t -> Bigstring.t -> sk:Key.secret Key.t -> msg:Bigstring.t -> (int, string) result

write_sign ctx buf ~sk ~msg writes signs msg with sk and writes the signature to buf at ?pos. It returns the number of bytes written (64) on success, or ar error message otherwise.

Sourceval write_sign_exn : Context.t -> Bigstring.t -> sk:Key.secret Key.t -> msg:Bigstring.t -> int

write_sign_exn ctx buf ~sk ~msg writes signs msg with sk and writes the signature to buf at ?pos. It returns the number of bytes written (64).

  • raises Invalid_argument

    if buf is not long enough to contain a signature or signing has failed.

Sourceval write_sign_recoverable : Context.t -> sk:Key.secret Key.t -> msg:Bigstring.t -> Bigstring.t -> (int, string) result
Sourceval write_sign_recoverable_exn : Context.t -> sk:Key.secret Key.t -> msg:Bigstring.t -> Bigstring.t -> int
Verification
Sourceval verify_exn : Context.t -> pk:Key.public Key.t -> msg:Bigstring.t -> signature:_ t -> bool
Sourceval verify : Context.t -> pk:Key.public Key.t -> msg:Bigstring.t -> signature:_ t -> (bool, string) result
Recovery
Sourceval recover_exn : Context.t -> signature:recoverable t -> Bigstring.t -> Key.public Key.t
Sourceval recover : Context.t -> signature:recoverable t -> Bigstring.t -> (Key.public Key.t, string) result
OCaml

Innovation. Community. Security.