Point representation and conversions
val raw_to_compressed : p:bytes -> result:bytes -> unit
raw_to_compressed p result
converts a "raw" point p
(64 bytes) to a "compressed" point result
(33 bytes)
val raw_to_uncompressed : p:bytes -> result:bytes -> unit
raw_to_uncompressed p result
converts a "raw" point p
(64 bytes) to an "uncompressed" point result
(65 bytes)
val compressed_to_raw : p:bytes -> result:bytes -> bool
compressed_to_raw p result
converts a "compressed" point p
(33 bytes) to a "raw" point result
(64 bytes). Returns true if successful.
val uncompressed_to_raw : p:bytes -> result:bytes -> bool
uncompressed_to_raw p result
converts an "uncompressed" point p
(65 bytes) to a "raw" point result
(64 bytes). Returns true if successful.
val dh_initiator : sk:bytes -> pk:bytes -> bool
dh_initiator sk pk
takes a 32-byte secret key sk
and writes the corresponding 64-byte public key in pk
.
val dh_responder : sk:bytes -> pk:bytes -> shared:bytes -> bool
dh_responder sk pk shared
takes a 32-byte secret key sk
and another party's 64-byte public key and writes the 64-byte ECDH shared key in shared
. Buffer shared
must be distinct from pk
.
val sign : sk:bytes -> msg:bytes -> k:bytes -> signature:bytes -> bool
sign sk msg k signature
attempts to sign the message msg
with secret key sk
and signing secret k
. If successful, the signature is written in signature
and the function returns true.