Module K256.Libsecp256k1

Versions of the ECDSA functions which work on low-S normalized signatures. These functions can be used when compatibility with libsecp256k1 is required.

For more details on low-S normalization (or canonical lowest S value), see here. libsecp256k1 always performs low-S normalization.

val sign : sk:bytes -> msg:bytes -> k:bytes -> bytes option

sign sk msg k attempts to sign the message msg with secret key sk and signing secret k and returns the low-S normalized signature if successful.

val verify : pk:bytes -> msg:bytes -> signature:bytes -> bool

verify pk msg signature checks the signature of msg using public key pk and returns true if it is valid. The signature must be low-S normalized.

val is_signature_normalized : signature:bytes -> bool

is_signature_normalized signature checks whether a raw signature is low-S normalized

val normalize_signature : signature:bytes -> bytes option

normalize_signature signature computes the canonical lowest S value of a raw signature and returns it if successful.