+ wip sign_future_keys
This commit is contained in:
parent
d7d302bafa
commit
0879cdc46b
3 changed files with 63 additions and 54 deletions
54
tools/offline_signature.ml
Normal file
54
tools/offline_signature.ml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
let _denom_signature ~key ~key_pub
|
||||
Api.FutureDenom.
|
||||
{
|
||||
section_name= _;
|
||||
value;
|
||||
stamp_start;
|
||||
stamp_expire_withdraw;
|
||||
stamp_expire_deposit;
|
||||
stamp_expire_legal;
|
||||
denom_pub;
|
||||
fee_withdraw;
|
||||
fee_deposit;
|
||||
fee_refresh;
|
||||
fee_refund= _;
|
||||
(* TODO check sigs *)
|
||||
denom_secmod_sig= _;
|
||||
} =
|
||||
let pub_octets =
|
||||
let denom_pub =
|
||||
match denom_pub with
|
||||
| Rsa v -> v
|
||||
| CS _ -> Fmt.failwith "CS key types are not supported."
|
||||
in
|
||||
let pub = denom_pub.Api.RsaDenominationKey.rsa_pub in
|
||||
Crypto.RsaPublicKey.to_octets pub
|
||||
in
|
||||
let h_denom_pub = Api.HashCode.hash pub_octets in
|
||||
let master_sig =
|
||||
let open Bin_type in
|
||||
let open Bin_signature.DenominationKeyValidityPS in
|
||||
{
|
||||
master= key_pub;
|
||||
start= stamp_start;
|
||||
expire_withdraw= stamp_expire_withdraw;
|
||||
expire_spend= stamp_expire_deposit;
|
||||
expire_legal= stamp_expire_legal;
|
||||
value;
|
||||
fee_withdraw;
|
||||
fee_deposit;
|
||||
fee_refresh;
|
||||
denom_hash= DenominationHash.hash pub_octets;
|
||||
}
|
||||
|> Bin.to_string bin
|
||||
|> Crypto.EddsaSignature.sign ~key
|
||||
in
|
||||
Api.DenomSignature.{ h_denom_pub; master_sig }
|
||||
|
||||
let sign_future_keys ~master_key:_ _future_key_response =
|
||||
(*
|
||||
let open Syntax in
|
||||
let open Crypto in
|
||||
*)
|
||||
(* TODO sign *)
|
||||
assert false
|
||||
Loading…
Add table
Add a link
Reference in a new issue