wip secmod
This commit is contained in:
parent
2dafed2273
commit
355efa8b0f
2 changed files with 85 additions and 0 deletions
60
src/secmod_eddsa.ml
Normal file
60
src/secmod_eddsa.ml
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
open Syntax
|
||||
open Crypto
|
||||
|
||||
let read fname = Bos.OS.File.read fname |> unwrap_err_msg
|
||||
let write fname s = Bos.OS.File.write fname s |> unwrap_err_msg
|
||||
|
||||
let read_eddsa fname =
|
||||
let* data = read fname in
|
||||
EddsaPrivateKey.of_octets data
|
||||
|
||||
let write_eddsa fname priv = write fname (EddsaPrivateKey.to_octets priv)
|
||||
|
||||
module Config = struct
|
||||
(* TODO config *)
|
||||
open Config.Exchange_secmod_eddsa
|
||||
|
||||
let dir = Config.secmod_eddsa_dir
|
||||
let lookahead_sign = lookahead_sign
|
||||
let overlap_duration = overlap_duration
|
||||
let duration = duration
|
||||
end
|
||||
|
||||
open Mirage_crypto_ec
|
||||
|
||||
type priv = Ed25519.priv
|
||||
type pub = Ed25519.pub
|
||||
|
||||
type t = {
|
||||
priv: priv;
|
||||
pub: pub;
|
||||
start: Timestamp.t;
|
||||
end_: Timestamp.t;
|
||||
}
|
||||
|
||||
(*
|
||||
create dir if not exists
|
||||
read dir contents
|
||||
init sm_key
|
||||
check filename
|
||||
build sorted list
|
||||
check overlaps
|
||||
just fail if not good
|
||||
add keys until lookahead
|
||||
|
||||
|
||||
|
||||
- sign
|
||||
- verify
|
||||
- expose future_sk list
|
||||
- purge
|
||||
- schedule tasks
|
||||
- !lock
|
||||
|
||||
todo taler doc/config is confusing
|
||||
how is computed stamp_expire stamp_end
|
||||
what to do of 'Exchange.signkey_legal_duration'
|
||||
=> (??)
|
||||
stamp_expire = stamp_start + duration
|
||||
stamp_end = stamp_start + signkey_legal_duration
|
||||
*)
|
||||
Loading…
Add table
Add a link
Reference in a new issue