better secmod
This commit is contained in:
parent
f69f393abb
commit
bf45cdc6b1
6 changed files with 104 additions and 54 deletions
|
|
@ -75,7 +75,9 @@ module EddsaSignature : sig
|
|||
type t
|
||||
|
||||
val sign : key:EddsaPrivateKey.t -> string -> t
|
||||
val verify : key:EddsaPublicKey.t -> t -> msg:string -> bool
|
||||
|
||||
(* Ok () on verification success *)
|
||||
val verify : key:EddsaPublicKey.t -> t -> msg:string -> (unit, string) result
|
||||
val to_octets : t -> string
|
||||
val of_octets : string -> (t, string) result
|
||||
val jsont : t Jsont.t
|
||||
|
|
@ -90,7 +92,13 @@ end = struct
|
|||
|
||||
(* mirage_crypto: "The result is the concatenation of r and s, as specified in RFC 8032." *)
|
||||
let sign ~key s = Mirage_crypto_ec.Ed25519.sign ~key s
|
||||
let verify ~key s ~msg = Mirage_crypto_ec.Ed25519.verify ~key s ~msg
|
||||
|
||||
let verify ~key s ~msg =
|
||||
let b = Mirage_crypto_ec.Ed25519.verify ~key s ~msg in
|
||||
match b with
|
||||
| false -> Error "signature verification failure: invalid signature"
|
||||
| true -> Ok ()
|
||||
|
||||
let to_octets t = t
|
||||
|
||||
let of_octets v =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue