The Go client, full enrollment and four operations
Build crdca-go from the repository, enroll the card with card-01, sign, renew with ARI and issue instance credentials.
The Go client is a binary with the same four operations as the CLI and the SDKs: enroll, sign, renew and instance. Its enroll walks the whole enrollment —account, order, challenges, CSR, finalize and chain— and checks that the leaf carries exactly the card SAN URI.
Installation
The module is named crdca and lives in the repository's src/go. Install it from that copy:
git clone https://git.nexgen.systems/luisrosasx/crdca.git
cd crdca/src/go
go install ./cmd/crdca
go version
It needs Go 1.26 or later. The binary lands in GOBIN under the name crdca. If you consume it from another Go module, run go mod edit -replace crdca=/path/to/crdca/src/go and then go get crdca/cmd/crdca; the module is not published to a proxy.
The four operations
| Operation | What it does | Network |
|---|---|---|
enroll | account, order, challenges, CSR, finalize, chain and leaf check | ACME |
sign | detached JWS over JCS with crdca_inclusion in the header | no, unless --log |
renew | ARI at half life and a replacement order with replaces | ACME |
instance | one JWT per replica with header {alg, kid, x5t#S256} | no |
vector exists in the binary but is not a fifth SDK command: it checks the JCS and JWS vector shared with Python, TypeScript and Java.
enroll
crdca enroll --card-url <url> --servidor <url> [--perfil agentcard|delegator|agent-mtls]
[--clave <path>|-] [--nueva-clave] [--publicar-token <token>]
[--guardar-clave <path>] [--json]
--card-url becomes the SAN URI; --perfil accepts agentcard, delegator or agent-mtls; --clave accepts a path or -; --guardar-clave writes the generated key with 0600 permissions; --publicar-token publishes <token>.<fingerprint> in the card-01 extension.
Enrollment does not stop at the order: it answers the challenges, finalizes and downloads the chain. That is why it needs --publicar-token when the profile uses card-01; without it the order cannot be validated.
cd src/go
crdca enroll \
--card-url https://example.com/agents/invoices/agent-card.json \
--servidor https://acme.crdca.org/directory \
--nueva-clave --guardar-clave clave.pem \
--publicar-token "$TOKEN" --json > alta.json
Normal output with a completed enrollment:
# cuenta https://acme.crdca.org/account/7Q2
# orden https://acme.crdca.org/order/9f3 (valid)
# perfil agentcard
# clave efímera
# cert <certID>
With --json the object carries ok, resultado and jwk. The chain is in resultado.cadena, in PEM:
jq -r '.resultado.cadena' alta.json > cadena.pem
sign
crdca sign --card <path> --cadena <path> --clave <path>|<-
[--inclusion <b64url>] [--log <url>] [--json]
crdca sign \
--card agent-card.json --cadena cadena.pem --clave clave.pem \
--log https://cdn.crdca.org --json > firma.json
jq '.tarjeta' firma.json > agent-card.firmada.json
Normal output:
# firmada: kid=33Jexv_GITRJ9XRmMLK5Y3n6uXWt80mbWv-YTDu0fgg payload_sha256=...
With --json the signed card is in tarjeta and the protected header in protected. The inclusion travels in the protected header, never in the payload.
renew
crdca renew --ari --cert <path> --clave <path>|<-
--servidor <url> [--ahora <RFC3339>] [--json]
crdca renew --ari --cert hoja.pem --clave clave.pem \
--servidor https://acme.crdca.org/directory --json > renovacion.json
Normal output prints the certID, age, half life and decision. With --json the object is in resultado:
jq '.resultado.decision, .resultado.media_vida_s' renovacion.json
instance
crdca instance --card-url <url> --cadena <path> --clave <path>|<-
[--replicas <n>] [--vida-s <s>] [--jwt] [--ahora <RFC3339>] [--json]
crdca instance \
--card-url https://example.com/agents/invoices/agent-card.json \
--cadena cadena.pem --clave clave.pem \
--replicas 2 --jwt --json > instancia.json
Normal output:
# 2 credencial(es) verificadas para https://example.com/agents/invoices/agent-card.json
# r1 eyJhbGciOiJFZERTQSIsImtpZCI6...
# r2 eyJhbGciOiJFZERTQSIsImtpZCI6...
Each credential carries replica, sub, iat, exp, jti, jwt and cabecera. The maximum lifetime is 86400 s and the client checks the signature and validity before returning it.
Exit codes
| Code | Name | When |
|---|---|---|
| 0 | OK | operation completed |
| 2 | E_USO | missing flag or unknown profile |
| 3 | E_CLAVE | missing key or PEM that is not Ed25519 |
| 4 | E_ENTRADA | unreadable file, invalid JSON or invalid URL |
| 5 | E_CADENA | chain or SAN mismatch |
| 6 | E_INCLUSION | no proof and no log to provide one |
| 7 | E_INSTANCIA | replicas or lifetime outside the profile |
| 8 | E_SERVIDOR, E_ORDEN, E_RETO | ACME, order or challenge failure |
| 1 | internal | unclassified error |
These codes are not the Python CLI codes: the Go client uses its own table. If a script handles both tools, compare by error name and not only by number.
Next step
- Verify a card: the Go middleware and the Envoy filter.
- The human mandate.
- The CLI and Python for the other surfaces.