code wiki / bin / nx_cert_gen.nx

nx_cert_gen.nx

buildroot/runtime/bin/nx_cert_gen.nx

16325 B398 linesdepth 12pulls 33 transitivereach 0 importersview sourcekind tooltopic cert
docsdependenciesstructsconstsfunctions

about

nx_cert_gen.nx -- V-HOST-4c: sovereign X.509 self-signed cert CLI driver. Closes the openssl bridge from NISHI_ANDELINWEST_DEPLOY_PLAYBOOK ยง3. Full sovereign Zone S cert generation per License Containment Cardinal. USAGE (V1 hardcoded; V-PROV-1 CLI argv parser extends): nx_cert_gen.elf \ --domain andelinwest.com \ --san www.andelinwest.com,wiki.andelinwest.com \ --validity-days 365 \ --out-dir /var/nishi-host/certs/andelinwest/ Produces: /var/nishi-host/certs/andelinwest/cert.der (X.509 v3 self-signed) /var/nishi-host/certs/andelinwest/priv.ed25519 (32-byte raw priv) /var/nishi-host/certs/andelinwest/pub.ed25519 (32-byte raw pub; for verify) COMPOSES (per "avoid duplicate primitives"): hub/nx_x509_build (V-HOST-4b; X.509 v3 builder) hub/nx_asn1_write (V-HOST-4a; DER encoder; transitively) nx_csprng (sovereign CSPRNG; sys_getrandom OR /dev/urandom) nx_ed25519_signature (ed25519_pub_from_priv just added) nx_syscalls (sys_now_ms; sys_openat_wr; sys_write; sys_close) V-HOST-4c SCOPE: - Generate 32-byte Ed25519 priv via nx_csprng_fill - Derive 32-byte pub via ed25519_pub_from_priv - Compute notBefore (now Unix sec -> GeneralizedTime) + notAfter (now + validity_days) - Build cert DER via nx_x509_build_self_signed - Write cert.der + priv.ed25519 + pub.ed25519 to disk V-HOST-4c NON-SCOPE: - Full argv parsing (V-PROV-1 CLI; V-HOST-4c uses hardcoded for V1 demo) - PEM emit (only DER; convert via existing nx_pem_encode if shipped) - chmod 0600 on priv (operator does this post-creation; or sys_chmod V+1) Status: V-HOST-4c. 2026-05-27.

dependencies 8 imports · 0 importers

nx_syscalls.nx nx_x509_build.nx nx_asn1_write.nx nx_csprng.nx nx_ed25519_signature.nx nx_u256.nx nx_p256_point.nx nx_p256_scalar_mul.nx nx_cert_gen.nx

imports: nx_syscalls.nxnx_x509_build.nxnx_asn1_write.nxnx_csprng.nxnx_ed25519_signature.nxnx_u256.nxnx_p256_point.nxnx_p256_scalar_mul.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap nx_cert_gen_self_signed sys_mmap ↻ nx_csprng_fill sys_mmap ↻ nx_csprng_urandom_path sys_openat_rd sys_read sys_close ed25519_pub_from_priv sys_mmap ↻ ed25519_sha512 sys_mmap ↻ sha512_init sha512_update sha512_blk_set_byte blk_get_i64 blk_set_i64 sha512_compress sys_mmap ↻ blk_get_i64 ↻ sha512_gamma0 sha512_gamma1 sha512_sigma1 sha512_ch sha512_k sha512_sigma0 sha512_maj sha512_final sha512_blk_set_byte ↻ sha512_compress ↻ ge_p3_alloc sys_mmap ↻ fe_alloc nx_scratch nx_scratch_init nx_scratch_oom sys_mmap ↻ fe_zero

structs

none

consts

51const NX_CG_OK: i64 = 0
52const NX_CG_BAD_INPUT: i64 = 3640
53const NX_CG_CSPRNG_FAILED: i64 = 3641
54const NX_CG_KEYGEN_FAILED: i64 = 3642
55const NX_CG_TIME_FAILED: i64 = 3643
56const NX_CG_CERT_BUILD_FAILED: i64 = 3644
57const NX_CG_FILE_WRITE_FAILED: i64 = 3645
60const NX_CG_CERT_DER_CAP: i64 = 8192
61const NX_CG_FILE_OPEN_MODE_PRIV: i64 = 384 // 0o600 (rw-------)
62const NX_CG_FILE_OPEN_MODE_PUB: i64 = 420 // 0o644 (rw-r--r--)
63const NX_CG_DEFAULT_VALIDITY_DAYS: i64 = 365

functions

72func nx_cg_days_from_civil(y: i64, m: i64, d: i64) -> i64
84func nx_cg_civil_from_days(days: i64,
106func nx_cg_format_generalized_time(unix_sec: i64, out_15: *u8) -> i64
145func nx_cg_write_file(path_z: *u8, mode: i64,
162func nx_cert_gen_self_signed(
242func nx_cg_ecdsa_p256_keygen(priv_limbs: *i64,
280func nx_cert_gen_self_signed_ecdsa_p256(
351func main() -> i64