This commit is contained in:
parent
84c3b8bec5
commit
f57ad1cea3
5 changed files with 31 additions and 26 deletions
23
src/keys.ml
23
src/keys.ml
|
|
@ -8,16 +8,22 @@ module Make (Conn : Pg.CONN) = struct
|
|||
open Crypto
|
||||
|
||||
let master_pub = Config.Exchange.master_public_key
|
||||
let secmod_rsa_pub = Secmod_rsa.sm_key_pub
|
||||
let secmod_eddsa_pub = Secmod_eddsa.sm_key_pub
|
||||
let secmod_rsa_pub = Secmod_rsa.sm_pub
|
||||
let secmod_eddsa_pub = Secmod_eddsa.sm_pub
|
||||
|
||||
let sign ~pub s =
|
||||
Secmod_eddsa.sign ~pub s |> function
|
||||
(* TODO error
|
||||
should be a "key not found", either:
|
||||
- we tried to sign with a key that is not ours
|
||||
- key was revoked
|
||||
- bad keyring state
|
||||
*)
|
||||
let sign pub s =
|
||||
match Secmod_eddsa.sign ~pub s with
|
||||
| Error e -> Fmt.failwith "sign failure: %s." e
|
||||
| Ok v -> v
|
||||
|
||||
let sign_denom ~pub s =
|
||||
Secmod_rsa.sign ~pub s |> function
|
||||
let sign_denom pub s =
|
||||
match Secmod_rsa.sign ~pub s with
|
||||
| Error e -> Fmt.failwith "sign_denom failure: %s." e
|
||||
| Ok v -> v
|
||||
|
||||
|
|
@ -42,8 +48,7 @@ module Make (Conn : Pg.CONN) = struct
|
|||
let exchange_pub = pub in
|
||||
let anchor_time = stamp_start in
|
||||
let duration = Timestamp.diff stamp_start stamp_expire in
|
||||
signf Secmod_eddsa.sign_with_sm_key
|
||||
{ exchange_pub; anchor_time; duration }
|
||||
signf Secmod_eddsa.sign_secmod { exchange_pub; anchor_time; duration }
|
||||
in
|
||||
Api.FutureSignKey.
|
||||
{ key= pub; stamp_start; stamp_expire; stamp_end; signkey_secmod_sig }
|
||||
|
|
@ -90,7 +95,7 @@ module Make (Conn : Pg.CONN) = struct
|
|||
let duration_withdraw =
|
||||
Timestamp.diff stamp_start stamp_expire_withdraw
|
||||
in
|
||||
signf Secmod_rsa.sign_with_sm_key
|
||||
signf Secmod_rsa.sign_secmod
|
||||
{ h_denom_pub; h_section_name; anchor_time; duration_withdraw }
|
||||
in
|
||||
FutureDenom.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue