+ DenominationKeyAnnouncementPS.bin

This commit is contained in:
swrup 2025-10-17 15:25:10 +02:00
parent a27af0ecf1
commit c946cb0358
5 changed files with 32 additions and 16 deletions

View file

@ -108,16 +108,11 @@ module RsaPublicKey = struct
type t = Mirage_crypto_pk.Rsa.pub
let of_string s =
(* TODO bin
- no [Bin.of_string] ?
- what to do with the int ref? *)
match B32.decode s with
| Error _ as err -> err
| Ok s -> (
let off = ref 0 in
let v = Bin.decode Binary_formats.RsaPublicKey.bin s off in
let res = Mirage_crypto_pk.Rsa.pub ~n:v.n ~e:v.e in
match res with Error (`Msg e) -> Error e | Ok pub -> Ok pub)
let open Syntax in
let* s = B32.decode s in
let* v = Util.bin_of_string Binary_formats.RsaPublicKey.bin s in
let+ v = Mirage_crypto_pk.Rsa.pub ~n:v.n ~e:v.e |> unwrap_err_msg in
v
let to_string ({ n; e } : Mirage_crypto_pk.Rsa.pub) =
let open Binary_formats.RsaPublicKey in