code wiki / (root) / nx_mtls_pkcs12_ecdsa.nx

nx_mtls_pkcs12_ecdsa.nx

buildroot/runtime/nx_mtls_pkcs12_ecdsa.nx

4586 B64 linesdepth 12pulls 26 transitivereach 0 importersview sourcekind tooltopic mtls
docsdependenciesstructsconstsfunctions

about

nx_mtls_pkcs12_ecdsa.nx -- ECDSA-P256 .p12 driver (the browser-interop-safe provisioning, rung R5c). Reads the OPAQUE-bound EC identity (priv scalar + self-signed ECDSA cert) emitted by nx_mtls_ecdsa, builds the EC PKCS#8 (RFC 5915 ECPrivateKey inside a OneAsymmetricKey with the prime256v1 AlgorithmIdentifier), and wraps it via the key-type-agnostic nx_mtls_emit_pkcs12_from (the proven PBES2 + PKCS#12-KDF/HMAC + PFX container). DECOUPLED via /tmp files because the x509-build hub (cert/key gen) and the pkcs12 container (hmac/pbkdf2/sha256) have clashing SHA-256 closures and cannot co-import. Output: a .p12 Chrome/Edge/Firefox + the Windows cert store all import. Validated end-to-end by openssl + python (dev-time). license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_mtls_pkcs12.nx nx_mtls_pkcs12_ecdsa.nx

imports: nx_syscalls.nxnx_mtls_pkcs12.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ecp_puts sys_write sys_mmap ecp_read sys_openat_rd sys_read sys_close sys_exit nxae_put_int_u8 nxae_put nxae_put_octet_string nxae_put_tlv nxae_put ↻ nxae_put_length nxae_put ↻ nxae_put_bytes nxae_put_tlv ↻ ecp_oid_ecpubkey ecp_oid_p256 nxae_put_oid nxae_put_tlv ↻ nx_mtls_emit_pkcs12_from sys_mmap ↻ pbkdf2_sha256 sys_mmap ↻ hmac_sha256 sys_mmap ↻ sha256_digest sys_mmap ↻ sha256_init sys_mmap ↻ sha256_k sha256_update sha256_compress_ni_blocks blk_set_byte sha256_compress sha256_final blk_set_byte ↻ sha256_compress ↻

structs

none

consts

11const K_MAGIC_4096: i64 = 4096
12const K_MAGIC_8192: i64 = 8192

functions

15func ecp_oid_ecpubkey(o: *u8) -> i64 { o[0]=0x2a as u8;o[1]=0x86 as u8;o[2]=0x48 as u8;o[3]=0xce as u8;o[4]=0x3d as u8;o[5]=0x02 as u8;o[6]=0x01 as u8; return 7 }
called by 1: main
16func ecp_oid_p256(o: *u8) -> i64 { o[0]=0x2a as u8;o[1]=0x86 as u8;o[2]=0x48 as u8;o[3]=0xce as u8;o[4]=0x3d as u8;o[5]=0x03 as u8;o[6]=0x01 as u8;o[7]=0x07 as u8; return 8 }
called by 1: main
18func ecp_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
24func ecp_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main calls 1: sys_write
25func ecp_putn(v: i64) -> i64 { let t: *u8 = sys_mmap(24); var m: i64 = v; var k: i64 = 0; if m==0 { t[0]=48 as u8; k=1 } while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } let o: *u8 = sys_mmap(24); var i: i64=0; while i<k { o[i]=t[k-1-i]; i=i+1 } sys_write(1,o,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
27func main() -> i64