objective categorical abstract machine language personal data server
65
fork

Configure Feed

Select the types of activity you want to include in your feed.

Key generation

futurGH 70674ce0 23c3b368

+22 -2
+3 -1
dune-project
··· 69 69 (depends 70 70 ocaml 71 71 dune 72 - (hacl-star (>= 0.7.2)))) 72 + (hacl-star (>= 0.7.2)) 73 + (mirage-crypto-ec (>= 2.0.1)) 74 + (multibase (>= 0.1.0))))
+2
kleidos.opam
··· 10 10 "ocaml" 11 11 "dune" {>= "3.14"} 12 12 "hacl-star" {>= "0.7.2"} 13 + "mirage-crypto-ec" {>= "2.0.1"} 14 + "multibase" {>= "0.1.0"} 13 15 "odoc" {with-doc} 14 16 ] 15 17 build: [
+1 -1
kleidos/dune
··· 1 1 (library 2 2 (name kleidos) 3 - (libraries hacl-star multibase)) 3 + (libraries hacl-star mirage-crypto-ec multibase))
+16
kleidos/kleidos.ml
··· 35 35 36 36 val derive_pubkey : privkey:bytes -> bytes 37 37 38 + val generate_keypair : unit -> bytes * bytes 39 + 38 40 val privkey_to_multikey : bytes -> string 39 41 40 42 val pubkey_to_multikey : bytes -> string ··· 90 92 | None -> 91 93 failwith "failed to derive public key" 92 94 95 + let generate_keypair () : bytes * bytes = 96 + (* P256 is fine for generating a privkey for either curve, 97 + but the accompanying public key won't work K256 *) 98 + let open Mirage_crypto_ec.P256.Dsa in 99 + let privkey = generate () |> fst |> priv_to_octets |> Bytes.of_string in 100 + (privkey, derive_pubkey ~privkey) 101 + 93 102 let pubkey_to_multikey pubkey : string = 94 103 to_multikey pubkey ~prefix:public_prefix 95 104 ··· 146 155 P256.raw_to_compressed pubkey 147 156 | None -> 148 157 failwith "failed to derive public key" 158 + 159 + let generate_keypair () : bytes * bytes = 160 + (* don't know why but the pubkey returned by generate () fails to validate 161 + so we derive our own *) 162 + let open Mirage_crypto_ec.P256.Dsa in 163 + let privkey = generate () |> fst |> priv_to_octets |> Bytes.of_string in 164 + (privkey, derive_pubkey ~privkey) 149 165 150 166 let pubkey_to_multikey pubkey : string = 151 167 to_multikey pubkey ~prefix:public_prefix