better secmod
This commit is contained in:
parent
67d0820643
commit
7bb2f60f24
24 changed files with 1231 additions and 1022 deletions
|
|
@ -1,9 +1,7 @@
|
|||
(* TODO signatures
|
||||
check with taler-wallet-core/src/crypto/cryptoImplementation.js
|
||||
check with taler-wallet
|
||||
check signed/unsigned ints
|
||||
check endianness
|
||||
|
||||
better handling of decoding failure *)
|
||||
check endianness *)
|
||||
open Hash
|
||||
|
||||
module Aliases = struct
|
||||
|
|
@ -147,43 +145,51 @@ end
|
|||
|
||||
(* --- Packed Signatures --- *)
|
||||
|
||||
module MK (R : sig
|
||||
module type R = sig
|
||||
type r
|
||||
|
||||
val bin : r Bin.t
|
||||
end) : sig
|
||||
end
|
||||
|
||||
module type SIGNATURE = sig
|
||||
open Crypto
|
||||
|
||||
type r = R.r
|
||||
type r
|
||||
type t
|
||||
|
||||
val sign_f : f:(string -> eddsa_sig) -> r -> t
|
||||
|
||||
val verify_f :
|
||||
f:(eddsa_sig -> msg:string -> (unit, string) result) ->
|
||||
t ->
|
||||
r ->
|
||||
(unit, string) result
|
||||
val signf : (string -> EddsaSignature.t) -> r -> t
|
||||
|
||||
(* todo
|
||||
- type for unknown/verified signatures? (nk/ok) *)
|
||||
val verify : EddsaPublicKey.t -> t -> r -> (unit, string) result
|
||||
val jsont : t Jsont.t
|
||||
val caqti : t Caqti_type.t
|
||||
|
||||
(* TODO rm *)
|
||||
(* escape hatch, only needed for /keys `exchange_sig` (signature over contatentation of all of the master_sigs) *)
|
||||
val to_octets : t -> string
|
||||
end = struct
|
||||
end
|
||||
|
||||
module MK (R : R) : SIGNATURE with type r := R.r = struct
|
||||
open Crypto
|
||||
|
||||
type r = R.r
|
||||
type t = EddsaSignature.t
|
||||
|
||||
let sign_f ~f r = f (Bin.to_string R.bin r)
|
||||
let verify_f ~f t r = f t ~msg:(Bin.to_string R.bin r)
|
||||
let to_string = Bin.to_string R.bin
|
||||
let verify key t r = EddsaSignature.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
|
||||
end
|
||||
|
||||
module MK_master_sig (R : R) = struct
|
||||
include MK (R)
|
||||
|
||||
let verify = verify Config.Exchange.master_public_key
|
||||
end
|
||||
|
||||
(* ---- *)
|
||||
|
||||
module DenominationKeyAnnouncement = struct
|
||||
module R = struct
|
||||
(* CS: use purpose TALER_SIGNATURE_SM_CS_DENOMINATION_KEY *)
|
||||
|
|
@ -211,7 +217,6 @@ module DenominationKeyAnnouncement = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
end
|
||||
|
||||
|
|
@ -236,7 +241,6 @@ module SigningKeyAnnouncement = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
end
|
||||
|
||||
|
|
@ -305,8 +309,7 @@ module DenominationKeyValidity = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module ExchangeSigningKeyValidity = struct
|
||||
|
|
@ -333,8 +336,7 @@ module ExchangeSigningKeyValidity = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module MasterDenominationKeyRevocation = struct
|
||||
|
|
@ -352,8 +354,7 @@ module MasterDenominationKeyRevocation = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module MasterSigningKeyRevocation = struct
|
||||
|
|
@ -371,8 +372,7 @@ module MasterSigningKeyRevocation = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module MasterAddAuditor = struct
|
||||
|
|
@ -396,8 +396,7 @@ module MasterAddAuditor = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module MasterDelAuditor = struct
|
||||
|
|
@ -418,8 +417,7 @@ module MasterDelAuditor = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module GlobalFees = struct
|
||||
|
|
@ -474,8 +472,7 @@ module GlobalFees = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module MasterWireDetails = struct
|
||||
|
|
@ -513,8 +510,7 @@ module MasterWireDetails = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module MasterAddWire = struct
|
||||
|
|
@ -556,8 +552,7 @@ module MasterAddWire = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module MasterDelWire = struct
|
||||
|
|
@ -578,8 +573,7 @@ module MasterDelWire = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module MasterDrainProfit = struct
|
||||
|
|
@ -607,8 +601,7 @@ module MasterDrainProfit = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module MasterAmlOfficerStatus = struct
|
||||
|
|
@ -634,8 +627,7 @@ module MasterAmlOfficerStatus = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module PartnerConfiguration = struct
|
||||
|
|
@ -674,8 +666,7 @@ module PartnerConfiguration = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module WadPartnerSignature = struct
|
||||
|
|
@ -722,7 +713,6 @@ module WadPartnerSignature = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
end
|
||||
|
||||
|
|
@ -752,8 +742,7 @@ module MasterWireFee = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
include MK_master_sig (R)
|
||||
end
|
||||
|
||||
module ExchangeKeyValidity = struct
|
||||
|
|
@ -819,7 +808,6 @@ module ExchangeKeyValidity = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
end
|
||||
|
||||
|
|
@ -842,7 +830,6 @@ module ExchangeKeySet = struct
|
|||
|> sealr
|
||||
end
|
||||
|
||||
include R
|
||||
include MK (R)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue