refacto crypto: add eddsa.ml + rsa.ml
This commit is contained in:
parent
4e707b080a
commit
87f06339c8
16 changed files with 517 additions and 537 deletions
|
|
@ -2,10 +2,25 @@ open Time
|
|||
open Hash
|
||||
|
||||
module Aliases = struct
|
||||
module DenominationHash = Crypto.DenominationHash
|
||||
module EddsaPrivateKey = struct
|
||||
type t = Eddsa.priv
|
||||
|
||||
let bin = Eddsa.priv_bin
|
||||
end
|
||||
|
||||
module EddsaPublicKey = struct
|
||||
type t = Eddsa.pub
|
||||
|
||||
let bin = Eddsa.pub_bin
|
||||
end
|
||||
|
||||
module EddsaSignature = struct
|
||||
type t = Eddsa.sig_
|
||||
|
||||
let bin = Eddsa.sig_bin
|
||||
end
|
||||
|
||||
(* some of those are actuall ecdhe, or union of eddsa|ecdhe *)
|
||||
open Crypto
|
||||
module PursePublicKey = EddsaPublicKey
|
||||
module AuditorPublicKeyP = EddsaPublicKey
|
||||
module ReservePublicKeyP = EddsaPublicKey
|
||||
|
|
@ -140,8 +155,6 @@ module MK (R : sig
|
|||
|
||||
val bin : r Bin.t
|
||||
end) : sig
|
||||
open Crypto
|
||||
|
||||
(* record type of data to sign *)
|
||||
type r = R.r
|
||||
|
||||
|
|
@ -150,8 +163,8 @@ end) : sig
|
|||
|
||||
(* todo
|
||||
- type for unknown/verified signatures? (nk/ok) *)
|
||||
val verify : EddsaPublicKey.t -> t -> r -> (unit, string) result
|
||||
val signf : (string -> EddsaSignature.t) -> r -> t
|
||||
val verify : Eddsa.pub -> t -> r -> (unit, string) result
|
||||
val signf : (string -> Eddsa.sig_) -> r -> t
|
||||
val jsont : t Jsont.t
|
||||
val caqti : t Caqti_type.t
|
||||
|
||||
|
|
@ -159,17 +172,15 @@ end) : sig
|
|||
(signature over contatentation of all of the master_sigs) *)
|
||||
val to_octets : t -> string
|
||||
end = struct
|
||||
open Crypto
|
||||
|
||||
type r = R.r
|
||||
type t = EddsaSignature.t
|
||||
type t = Eddsa.sig_
|
||||
|
||||
let to_string = Bin.to_string R.bin
|
||||
let verify key t r = EddsaSignature.verify ~key t ~msg:(to_string r)
|
||||
let verify key t r = Eddsa.verify ~key t ~msg:(to_string r)
|
||||
let signf f r = f (to_string r)
|
||||
let jsont = EddsaSignature.jsont
|
||||
let caqti : EddsaSignature.t Caqti_type.t = EddsaSignature.caqti
|
||||
let to_octets t = EddsaSignature.to_octets t
|
||||
let jsont = Eddsa.sig_jsont
|
||||
let caqti = Eddsa.sig_caqti
|
||||
let to_octets t = Eddsa.sig_to_octets t
|
||||
end
|
||||
|
||||
(* ---- *)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue