nx_tls13_server_clientauth.nx
buildroot/runtime/nx_tls13_server_clientauth.nx
about
nx_tls13_server_clientauth.nx -- TLS 1.3 server-side CLIENT authentication: verify a presented
client certificate's CertificateVerify over the handshake transcript (RFC 8446 §4.4.3).
mTLS rung R3 of the NO-COOKIE session carrier. This is the cryptographic heart: it proves that whoever
opened the TLS connection HOLDS THE PRIVATE KEY of the presented client identity cert -- so the browser
authenticates itself at the TLS layer on EVERY connection (top-level navs, refresh, new tab) with zero
cookie, zero header, zero auth-carrier JS. R7 wires this into the live terminator's record loop (send
CertificateRequest after EncryptedExtensions, then receive+decrypt the client's Certificate +
CertificateVerify before its Finished). R6 turns the verified identity pubkey/Subject into HR entitlements.
The signed content mirrors the server's build_cv_context (nx_tls13_server_session_emit_cv) but with the
CLIENT context label (RFC 8446 §4.4.3): 64*0x20 || "TLS 1.3, client CertificateVerify" || 0x00 || hash.
Ed25519 signs/verifies the 130-byte content directly. Composes nx_x509 (parse) + nx_ed25519_signature.
license_tier: ORIGINAL expect_exit: 0
dependencies 4 imports · 2 importers
imports: nx_syscalls.nxnx_x509.nxnx_ed25519_signature.nxnx_x509_leaf_emit.nx
imported by: nx_mtls_loopback_probe.nxnx_tls13_mtls_loopback_test.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 19 | const NX_MAGIC_4096: i64 = 4096 |
| 21 | const NX_CA_OK: i64 = 0 |
| 22 | const NX_CA_BAD_CERT: i64 = 1 |
| 23 | const NX_CA_BAD_SIG: i64 = 2 |
| 24 | const NX_CA_UNSUPPORTED_SCHEME: i64 = 3 |
| 25 | const NX_CA_CV_CONTEXT_LEN: i64 = 130 |
| 26 | const NX_CA_SS_ED25519: i64 = 0x0807 // SignatureScheme ed25519 |
functions
| 29 | func tls13_build_client_cv_content(transcript_hash_32: *u8, out_130: *u8) -> i64 |
| 45 | func tls13_verify_client_auth_ed25519( called by 3: mainmainmain calls 4: sys_mmapx509_parsetls13_build_client_cv_contented25519_verify_full |
| 74 | func ca_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 75 | func ca_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: main |
| 76 | func ca_row(name: *u8, ok: i64) -> i64 { if ok == 1 { ca_w(" PASS " as *u8) } else { ca_w(" FAIL " as *u8) } ca_w(name); ca_w("\n" as *u8); return ok } |
| 79 | func ca_mint(seed: *u8, pub: *u8, cn: *u8, cn_n: i64, cert: *u8, cap: i64, clen: *i64) -> i64 |
| 88 | func main() -> i64 |