fix secmod_rsa config; fix signkey stamp_end
This commit is contained in:
parent
8996eb7424
commit
5e9426267a
4 changed files with 59 additions and 50 deletions
26
src/keys.ml
26
src/keys.ml
|
|
@ -62,11 +62,13 @@ module Make (Conn : Pg.CONN) : S = struct
|
|||
|
||||
let denominations () = Pg.get_denominations conn () |> unwrap_err_caqti
|
||||
|
||||
(* TODO check stamps definitions *)
|
||||
let make_future_sk ~pub ~start ~expire =
|
||||
let stamp_start = Timestamp.of_absolute start in
|
||||
let stamp_expire = Timestamp.of_absolute expire in
|
||||
let stamp_end = stamp_expire in
|
||||
let stamp_end =
|
||||
Timestamp.of_absolute
|
||||
@@ Time.Absolute.add start Config.Exchange.signkey_legal_duration
|
||||
in
|
||||
let signkey_secmod_sig =
|
||||
let open Signatures.SigningKeyAnnouncement in
|
||||
let exchange_pub = pub in
|
||||
|
|
@ -113,14 +115,13 @@ module Make (Conn : Pg.CONN) : S = struct
|
|||
let h_pub = DenominationHash.hash (RsaPublicKey.to_octets pub) in
|
||||
let denom_secmod_sig =
|
||||
let open Signatures.DenominationKeyAnnouncement in
|
||||
let h_denom_pub = h_pub in
|
||||
let h_section_name = Hash.Cstring.H64.hash section_name in
|
||||
let anchor_time = stamp_start in
|
||||
let duration_withdraw =
|
||||
Timestamp.diff stamp_start stamp_expire_withdraw
|
||||
in
|
||||
signf Sm_rsa.sign_secmod
|
||||
{ h_denom_pub; h_section_name; anchor_time; duration_withdraw }
|
||||
{
|
||||
h_denom_pub= h_pub;
|
||||
h_section_name= Hash.Cstring.H64.hash section_name;
|
||||
anchor_time= stamp_start;
|
||||
duration_withdraw= Timestamp.diff stamp_start stamp_expire_withdraw;
|
||||
}
|
||||
in
|
||||
FutureDenom.
|
||||
{
|
||||
|
|
@ -162,9 +163,8 @@ module Make (Conn : Pg.CONN) : S = struct
|
|||
let future_denominations () =
|
||||
let+ l =
|
||||
list_map
|
||||
(fun (section_name, pub, t1, _t2) ->
|
||||
(fun (section_name, pub, t1) ->
|
||||
let h_pub = Hash.DenominationHash.hash (RsaPublicKey.to_octets pub) in
|
||||
(*?? let duration_withdraw = Time.Absolute.diff t1 t2 in*)
|
||||
let* opt = find_denomination h_pub in
|
||||
match opt with
|
||||
| None ->
|
||||
|
|
@ -278,12 +278,12 @@ module Make (Conn : Pg.CONN) : S = struct
|
|||
|
||||
let certify_future_denomination h_pub master_sig =
|
||||
Sm_rsa.keys ()
|
||||
|> List.find_opt (fun (_section_name, pub, _t1, _t2) ->
|
||||
|> List.find_opt (fun (_section_name, pub, _t1) ->
|
||||
let h_pub' = Hash.DenominationHash.hash (RsaPublicKey.to_octets pub) in
|
||||
h_pub' = h_pub)
|
||||
|> function
|
||||
| None -> Error "future denomination not found"
|
||||
| Some (section_name, pub, t1, _t2) ->
|
||||
| Some (section_name, pub, t1) ->
|
||||
let h_pub = Hash.DenominationHash.hash (RsaPublicKey.to_octets pub) in
|
||||
let* () =
|
||||
let* opt = find_denomination h_pub in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue