Skip to content

Rewrite crypto/pki service in Go on the crud framework - #4

Merged
jagnd1 merged 1 commit into
mainfrom
go-rewrite-crud
Sep 12, 2026
Merged

jagnd1 merged 1 commit into
mainfrom
go-rewrite-crud

Conversation

@jagnd1

@jagnd1 jagnd1 commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Summary

Rewrites the crypto/PKI service from the legacy Python/FastAPI implementation to Go, built on the crud service framework (services/common). Honors the same API contract — REST (/v1/crypto/*, /v1/serv/*) and gRPC (crypto.v1.CryptoService).

What's included

  • Pure-Go crypto engine (internal/crypto, stdlib crypto/* only): AES/TDES/CMAC, TR-31 vD key blocks, LMK-wrapped keys, RSA/ECC + DER, ECDH (X9.63 HKDF), ANSI X9.24-3 DUKPT (subpackage), PIN ISO-0, X.509 TBS/CRL, TR-34 CMS (EnvelopedData + SignedData). Known-answer tests cross-validated against the legacy implementation.
  • HSM seam (internal/hsm): HSM interface + GP (software) implementation. Real HSMs (PS/AT) plug in via CRYPTO_HSM with no usecase changes. Keys always LMK-wrapped.
  • PKI: cert create/renew + CRL follow TBS → HSM-sign → pack (no library signing, matching real-HSM signatures).
  • Auth: REST dual-mode (JWT or API key), gRPC API-key only, RBAC, health probes.
  • Docs overhauled to the Go stack; ASC X9 DUKPT attribution retained.

Note

The legacy Python tree is retained as the behavioral reference (recoverable via the v1.0.0-python tag) and is scheduled for removal in a follow-up.

Verification

  • 5 crypto_svc + 3 common Go packages: tests green, go vet clean.
  • All 19 REST endpoints live-tested (deterministic outputs byte-for-byte match the legacy service).
  • gRPC verified with API-key auth.

Stdlib-first Go rewrite (services/crypto_svc) on the crud service
framework, replacing the Python/FastAPI implementation while honoring the
same API contract (REST /v1/crypto + /v1/serv, gRPC crypto.v1).

- pure-Go crypto engine (crypto/* + hand-rolled CMAC, TR-31 vD, DUKPT,
  HKDF, PIN ISO-0) with known-answer tests cross-validated against the
  legacy implementation
- HSM seam: internal/hsm.HSM interface + GP (software, LMK-wrapped TR-31
  key blocks) implementation; PS/AT plug in via CRYPTO_HSM
- PKI: cert create/renew + CRL (TBS -> HSM-sign -> pack, no library
  signing); TR-34 CMS key export (EnvelopedData + SignedData)
- REST dual-auth (JWT or API key), gRPC API-key only, RBAC, health probes
- shared framework vendored at services/common (auth, errs, respond,
  middleware, ...)
- docs overhauled to the Go stack; ASC X9 DUKPT attribution retained

Python tree retained as behavioral reference until Phase 5 removal
(checkpoint: v1.0.0-python).
@jagnd1
jagnd1 merged commit aa80989 into main Sep 12, 2026
1 check failed
@jagnd1
jagnd1 deleted the go-rewrite-crud branch September 12, 2026 21:35
@jagnd1 jagnd1 mentioned this pull request Sep 12, 2026
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