nx_doc_seal.nx
buildroot/runtime/nx_doc_seal.nx
about
nx_doc_seal.nx -- LEGAL RUNG D5: tamper-evident e-signature SEAL.
module: nishi-core.legal.doc_seal
capability: LEGAL_ESIGN_SEAL
Produces a non-repudiable, tamper-evident seal binding {document hash +
signer identity + timestamp + the D0 legal regime/verdict} under a REAL
RFC 8032 Ed25519 signature (not the V1 nx_sign_facade stand-in, which is
explicitly non-cryptographic). This is the "DocuSign but better" core:
1. NEVER SEAL A VOID INSTRUMENT -- nx_seal_create FIRST runs the D0
compliance verdict (nx_legal_compliance) and REFUSES to produce any
signature unless the verdict is VALID. The Rule-26 legal invariant is
thus carried into the signing layer: you physically cannot e-seal a
will that would be legally void. A generic e-sign product signs first
and asks never; this one cannot.
2. CANONICAL RECORD -- a deterministic serialization binds the document
hash, signer, timestamp, regime and verdict, so the signature commits
to the FULL legal validity context, not just "someone clicked sign".
3. TAMPER-EVIDENT -- nx_seal_verify recomputes nothing it isn't given;
any single-byte change to the canonical record (document hash, signer,
regime, ...) breaks the Ed25519 verification (proven in the gate).
Composes: nx_legal_compliance (D0 verdict), the ed25519 RFC-8032 chain
(real signature). Distinct from nx_sign_facade because: that is a non-
cryptographic V1 stand-in; a legal signature needs real Ed25519.
license_tier: ORIGINAL
lineage_id: nishi_doc_seal_d5
dependencies 8 imports · 7 importers
imports: nx_syscalls.nxnx_legal_compliance.nxnx_x25519.nxnx_ed25519_field.nxnx_ed25519_point.nxnx_ed25519_arith.nxnx_ed25519_scalar.nxnx_ed25519_signature.nx
imported by: nx_doc_annotate_gate.nxnx_doc_envelope.nxnx_doc_envelope_gate.nxnx_doc_seal_gate.nxnx_legal_portal_boot_gate.nxnx_legal_portal_gate.nxnx_legal_portal_live_gate.nx
structs
| 50 | struct NxSeal |
consts
| 40 | const SEAL_OK: i64 = 0 |
| 41 | const SEAL_REFUSED_VOID: i64 = 1 // D0 verdict INVALID_VOID -> no signature produced |
| 42 | const SEAL_REFUSED_NEEDS_MORE: i64 = 2 // D0 verdict NEEDS_MORE -> no signature produced |
| 44 | const SEAL_VERIFIED: i64 = 0 |
| 45 | const SEAL_TAMPERED: i64 = 1 |
functions
| 74 | func sl_cat(out: *u8, o: i64, s: *u8) -> i64 { var k: i64 = 0; while s[k] != (0 as u8) { out[o] = s[k]; o = o + 1; k = k + 1 } return o } called by 1: nx_seal_canonical |
| 78 | func nx_seal_canonical(out: *u8, doc_hash: *u8, doc_hash_len: i64, |
| 100 | func nx_seal_create(s: *NxSeal) -> i64 |
| 125 | func nx_seal_verify(s: *NxSeal, pub: *u8) -> i64 |