Skip to content

ndncert: fix v0.3 session cryptography and add CA server - #245

Merged
markverick merged 6 commits into
dv2from
feat/dv2-ndncert-ca
Oct 27, 2026
Merged

markverick merged 6 commits into
dv2from
feat/dv2-ndncert-ca

Conversation

@markverick

Copy link
Copy Markdown
Collaborator

Ports #239 and #240 to dv2.

Fix NDNCERT v0.3 session cryptography and add a Go certificate authority server.

  • Generate fresh ECDH keys and IV state for each certificate session.
  • Encode and advance IV counters according to v0.3, rejecting malformed messages, replayed or overlapping counter ranges, prefix collisions, and counter exhaustion.
  • Add INFO, PROBE, NEW, and CHALLENGE handling with email and DNS-01 verification.
  • Authenticate requests against the certificate-request key and enforce naming policies, validity limits, challenge expiration, attempt limits, and bounded concurrency.
  • Add ndnd sec certca, sample configuration, startup documentation, and container CA roots for SMTP TLS.
  • Support persistent storage of issued certificates through --data-dir. Active requests remain in memory.

Peers using the previous IV format require coordinated updates. Low-level callers must pass the session counter to AeadDecrypt and handle errors from AeadMessage.FromTLV.

Initialize ECDH and IV state for every NEW request rather than once per Client. Cover sequential reuse, failed NEW attempts, and CA signature validation with distinct CA and requester keys.
Start IV counters at zero, encode them in big-endian order, and advance after encryption using integer block counts. Reject empty plaintext, oversized GCM messages, and exhausted counters without wrapping.

Add reference-encryption, block arithmetic, and send-exhaustion regression tests.
Reject malformed cipher messages, changing or colliding IV prefixes, replayed or overlapping block ranges, and receive-counter wraparound. Update peer state only after authentication and validation, and decrypt into a private buffer without modifying the packet.

Cover authenticated receive-state transitions and a two-round client CHALLENGE exchange against an independent AES-GCM peer, including replay rejection.
Share certificate-based signature verification between Data and Interest packets so the NDNCERT CA can authenticate signed requests.
Serve INFO, PROBE, NEW, and CHALLENGE requests with email and DNS-01
verification, certificate naming and validity policies, bounded challenge
workers, and expiring request state.

Use the session crypto helpers from #236 for both directions and return
error 3 for invalid encrypted requests. Keep max-suffix-length in local
policy and PROBE responses instead of extending the CA profile format.

Test NEW key agreement, issuance, authorization, malformed requests,
replay rejection, concurrency, expiration, and challenge attempt limits.
Add ndnd sec certca with email delivery configuration, optional object
persistence, sample configuration, and startup instructions. Include
system CA roots in the container for outgoing SMTP TLS connections.

Fixes #237
@markverick
markverick merged commit 317af14 into dv2 Oct 27, 2026
5 checks passed
@markverick
markverick deleted the feat/dv2-ndncert-ca branch October 27, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant