Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/aienux/connector/gates/signer.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / aienux / connector / gates / signer.om` 104 lines ยท 1978 bytes Raw Blame History 1 note gates/signer.om -- test tool (never shipped): sign or make keys exactly as the runner does. 2 note Composed: om2, om/tls sha2 ec ecdh, runner/00base.om, runner/10key.om, this unit. 3 note signer gen make /key (state = $INTERPLANE_RUNNER_HOME); print pub hex and key id 4 note signer pub print pub hex and key id of the existing key 5 note signer sign read a message (every line before "sig") on stdin, print it with its sig line 6 note signer mall read a signed message on stdin, print it with s replaced by n - s (the other 7 note valid encoding of the same signature: ECDSA malleability) 8 text sgusage "usage: signer gen | pub | sign | mall\n" 9 text sggen "gen" 10 text sgpub "pub" 11 text sgsign "sign" 12 text sgmall "mall" 13 text sgsig "sig " 14 15 fn sg_mall to int 16 m = new uchar 8192 0 17 s = new uchar 32 0 18 o = new uchar 64 0 19 x = new uchar 64 0 20 w = new ulong ECWN 0 21 k = ulong 0 22 while lt k 8192 bound 8193 23 r = read 0 m k sub 8192 k 24 if le r 0 25 break 26 end 27 k = add k ulong r 28 end 29 if lt k 134 30 ret 2 31 end 32 q = sub k 65 33 if not r_unhex part m q 64 s 34 ret 2 35 end 36 e = ec_setup w 256 37 ec_load w ECA0 s 38 ecd_sub w ECCN ECA1 ECZ ECA0 39 ecd_out w ECA1 o 0 40 j = r_hex part o 0 32 x 0 41 for i ulong 64 42 put m add q i get x i 43 end 44 v = write 1 m 0 k 45 ret 0 46 end 47 48 fn sg_show to void 49 w = write 1 rpubh 0 130 50 r_say rtsp 51 w = write 1 rkid 0 64 52 r_say rtnl 53 end 54 55 fn main to int 56 a = new uchar 16 0 57 m = new uchar 8192 0 58 sg = new uchar 128 0 59 if ne argcnt 2 60 r_say sgusage 61 ret 2 62 end 63 n = argread 1 a 0 16 64 if not r_home 65 ret 2 66 end 67 if r_eq part a 0 ulong n sgmall 68 ret sg_mall 69 end 70 if r_eq part a 0 ulong n sggen 71 if not r_kgen 72 ret 3 73 end 74 sg_show 75 ret 0 76 end 77 if not r_kload 78 ret 3 79 end 80 if r_eq part a 0 ulong n sgpub 81 sg_show 82 ret 0 83 end 84 if not r_eq part a 0 ulong n sgsign 85 r_say sgusage 86 ret 2 87 end 88 k = ulong 0 89 while lt k 8192 bound 8193 90 r = read 0 m k sub 8192 k 91 if le r 0 92 break 93 end 94 k = add k ulong r 95 end 96 if not r_ksign part m 0 k sg 97 ret 3 98 end 99 w = write 1 m 0 k 100 r_say sgsig 101 w = write 1 sg 0 128 102 r_say rtnl 103 ret 0 104 end