wip: implement hash
need good handling of 0-terminated C-string
This commit is contained in:
parent
6220bbdae1
commit
f7a33e2dd4
5 changed files with 148 additions and 71 deletions
|
|
@ -134,7 +134,7 @@ module RsaPublicKey = struct
|
|||
type t = Mirage_crypto_pk.Rsa.pub
|
||||
|
||||
let to_octets ({ n; e } : Mirage_crypto_pk.Rsa.pub) =
|
||||
let open Binary_formats.RsaPublicKey in
|
||||
let open Binary_formats.GNUNET_RsaPublicKey in
|
||||
let header = { n_len= Z.size n; e_len= Z.size e } in
|
||||
let v = { header; n; e } in
|
||||
let s = Bin.to_string bin v in
|
||||
|
|
@ -143,7 +143,7 @@ module RsaPublicKey = struct
|
|||
let of_b32 s =
|
||||
let open Syntax in
|
||||
let* s = B32.decode s in
|
||||
let* v = Util.bin_of_string Binary_formats.RsaPublicKey.bin s in
|
||||
let* v = Util.bin_of_string Binary_formats.GNUNET_RsaPublicKey.bin s in
|
||||
let+ v = Mirage_crypto_pk.Rsa.pub ~n:v.n ~e:v.e |> unwrap_err_msg in
|
||||
v
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue