# Signing keys (core 0.9.0; deploy approvals 0.12.0) Custos signs releases for Fabrica Domi · Artifex without a private key ever leaving the vault. A build asks for a signature over a **digest**; Custos checks who may ask, Mark approves with a match code, and the vault signs and records it. This page is the contract for the keys, the signature kinds and the audit log. ## Where the keys live In the vault body, next to `identity` (FORMAT.md), as the optional member `signing`: ```json "signing": { "keys": [ { "id": "domi-release", "kind": "ed25519", "role": "release", "name": "Domi release", "secret": "", "public": "", "keyId": "<16 hex>", "created": 1793750000000, "pipelines": ["release"], "repos": ["Arca", "Fabrica"] }, { "id": "domi-root", "kind": "root-ca", "role": "release", "name": "Domi Household Root CA", "secret": "", "cert": "", "created": 1793750000000, "pipelines": [], "repos": [] }, { "id": "domi-code-signing", "kind": "code-signing", "role": "release", "name": "Domi Code Signing", "secret": "", "cert": "", "issuer": "domi-root", "created": 1793750000000, "pipelines": ["release"], "repos": ["Arca"] }, { "id": "domi-approve", "kind": "ed25519", "role": "release", "name": "Domi deploy approval", "secret": "", "public": "", "keyId": "<16 hex>", "created": 1793750000000, "pipelines": ["release"], "repos": ["Arca", "Fabrica"] } ], "audit": [ { "at": 1793750100000, "key": "domi-release", "kind": "minisign", "outcome": "approved", "via": "local", "repo": "Arca", "commit": "6925d0cb08b9…", "pipeline": "release", "step": "sign", "trigger": "tag", "file": "Arca_0.1.0_x64-setup.exe", "size": 25145977, "sha256": "c4995c6e…", "signature": "", "run": "r-42", "version": "0.1.0" } ] } ``` Why a body member and not new item types: item types are a closed list, so an older Custos (or the web vault on an older core) would refuse a whole vault that has an item of a new type; and an item's fields can be revealed, copied, shared, exported to KeePass and edited, which are all paths a signing key must never take. A body member is ignored by older readers (FORMAT.md, "Readers ignore JSON members they do not know") and is reachable only through the functions below. As with `identity`, an older Custos drops `signing` when it saves: every Custos that saves the vault must be 0.9.0 or later. There is no mnemonic for these keys: back the vault up. ### Keys | `kind` | Key | Signs | Created | | :-- | :-- | :-- | :-- | | `ed25519` | Ed25519; `secret` is the 32-byte seed, `public` the 32-byte key, `keyId` minisign's 8-byte key id | `minisign`, `manifest`; `domi-approve` only `approval` | random | | `root-ca` | RSA-3072; `secret` is PKCS#8 DER; `cert` a self-signed X.509 v3 CA certificate, valid 10 years | only the leaf it issues, at creation; never a request | random | | `code-signing` | RSA-3072; `secret` PKCS#8 DER; `cert` an X.509 v3 leaf issued by `issuer`, valid 2 years, EKU code signing | `authenticode` | random | `role` is `release` or `test`. *Create release keys* makes `domi-release`, `domi-root`, `domi-code-signing` and (since core 0.12.0) `domi-approve` ("Domi deploy approval"), the Ed25519 key that signs deploy approvals, with the release keys' scope. A vault whose release keys were made by an older core gets it with `signing_add_approve` (*Create approval key*). *Create test keys* makes `domi-test` (Ed25519) and `domi-test-code-signing`, a leaf issued by its own `domi-test-root`: a test certificate never chains to the household root, so an automatically approved signature is never trusted by Mark's PCs. `pipelines` and `repos` list who may ask (pipeline names, repository folder names; `*` means any). A request from a pipeline or repo not on its key's lists is refused **even when approved**. Release keys always need approval. Test keys are approved automatically, but only for requests whose `trigger` is not `tag` (a manual run, a push). Certificates: - root: subject and issuer `CN=, O=Domi`, `basicConstraints` CA (critical), `keyUsage` keyCertSign + cRLSign (critical), subject key identifier; - leaf: subject `CN=, O=Domi`, `basicConstraints` not a CA, `keyUsage` digitalSignature + nonRepudiation, `extKeyUsage` codeSigning, subject and authority key identifiers; both signed with sha256WithRSAEncryption. The root's certificate (public part only) is exported as DER (`.cer`) to install as Trusted Root and Trusted Publisher. ## Signature kinds A request names a key, a kind and what to sign. Custos never receives the file. | `kind` | The request carries | Custos returns | | :-- | :-- | :-- | | `minisign` | `digest`: BLAKE2b-512 of the file (64 bytes) | a `.minisig` file (prehashed, `ED`) | | `manifest` | `manifest`: the `SHA256SUMS` text itself (≤ 32 KiB, canonical, see below) | a `.minisig` file over it | | `authenticode` | `digest`: the 32-byte SHA-256 in signtool's `.dig` | the RSA PKCS#1 v1.5 signature (384 bytes) for `.dig.signed` | | `approval` | `approval`: a deploy approval's canonical JSON (at most 8 KiB, see below), and `run` | a `.minisig` file over it | Any request may carry a `run` (`[A-Za-z0-9._-]{1,64}`, core 0.12.0): the build's run id, so the app can show every request of one run on one card. It is kept in the audit entry. A malformed `run` is `invalid`; `approval` text on a request of another kind is `invalid` too. ### minisign minisign's format (`jedisct1.github.io/minisign`), the **prehashed** variant, the one current minisign writes by default and Tauri's updater (minisign-verify) checks: ``` untrusted comment: signature from Custos key base64("ED" ‖ key_id ‖ ed25519(BLAKE2b-512(file))) trusted comment: timestamp: file: hashed base64(ed25519(signature ‖ trusted comment text)) ``` `key_id` is the key's 8 bytes as stored; `` is them as one little-endian u64 in upper-case hex, as minisign prints it. The trusted comment text is what follows `trusted comment: `, without the newline. Every line ends in `\n`. The public key file is `untrusted comment: minisign public key ` and `base64("Ed" ‖ key_id ‖ public)`. Tauri's updater wants the same two files one level further wrapped: its `pubkey` and each `.sig` are the base64 of the whole minisign text. That wrapping is the build's job. ### manifest `SHA256SUMS` in one canonical form, so the same set of files always gives the same bytes: one line per file, `<64 lower-case hex> \n` (two spaces), names without `/`, `\`, control characters or leading `-`, unique, sorted by their UTF-8 bytes, no empty file. Custos checks the form, hashes the text itself and signs it as `minisign` (file name `SHA256SUMS`). A text in any other form is refused, not normalised. ### approval (core 0.12.0) A deploy approval says "this run of this commit may deploy to these targets until then". Fabrica's hub checks it with `domi-approve`'s public key before it runs a deploy step. What is signed is one line of JSON, no spaces, the keys in exactly this order: ``` {"v":1,"run":"r-42","repo":"Arca","commit":"<40 hex>","pipeline":"release","version":"0.7.0","targets":["deploy to nixos-vm","publish to Aula"],"expires":1793000000} ``` | Key | | | :-- | :-- | | `v` | `1` | | `run` | `[A-Za-z0-9._-]{1,64}`, equal to the request's `run` | | `repo`, `pipeline`, `version` | 1–64 of `[A-Za-z0-9._+-]` | | `commit` | 40 lower-case hex digits | | `targets` | 1–16 strings of 1–80 characters (Unicode scalar values); no control characters, and none of the invisible ones that change how a line looks on the card (U+00AD, U+061C, U+180E, U+200B–U+200F, U+2028–U+202E, U+2060–U+2069, U+FEFF) | | `expires` | Unix seconds, later than now and at most 3 600 s after now (checked before the card and again when signing) | Strings use JSON's minimal escaping: a quote is written `\"`, a backslash `\\`, every other character as itself (no `\u` escapes, no `\/`; control characters cannot occur). There is no newline at the end. Custos parses the text, writes it again in this form and refuses anything that is not byte-identical (`invalid`): another key order, a space, an escape, a duplicate or unknown key, a number written as `1.0`. The signature is a prehashed minisign signature over those bytes, made exactly as for `minisign` with the file name `approval-.json`, so the trusted comment is `timestamp:\tfile:approval-.json\thashed` (the `hashed` that minisign itself writes for a prehashed signature). `minisign -V -P -m approval.json` verifies it. `domi-approve` signs only `approval`, and `approval` is signed only by `domi-approve`; it is a release key, so it always asks. The scope is checked against the JSON's `repo` and `pipeline`; a request whose context names another `repo`, `pipeline`, `commit` or `version` than its JSON is `invalid` (an empty context member is filled from the JSON in the audit). The audit entry's `file` is `approval-.json`. ### authenticode The file is signed by Windows' own tools in three steps, so the key stays in Custos: 1. `signtool sign /dg /fd sha256 /f ` writes `.dig` (the base64 of the 32-byte SHA-256 of the signature's authenticated attributes, no newline) and `.p7u` (the unsigned PKCS#7). 2. Custos signs those 32 bytes: RSA PKCS#1 v1.5 with the SHA-256 DigestInfo. The build writes the base64 of the 384 bytes, no newline, to `.dig.signed`. 3. `signtool sign /di ` puts the signature in; `signtool timestamp /tr /td sha256 ` adds a timestamp. Checked on 2026-11-04 with signtool 10.0.26100 and a throwaway RSA-3072 key: the result verifies with `osslsigncode verify -CAfile `; `signtool verify /pa` on a machine that does not trust the root fails only with "terminated in a root certificate which is not trusted", and a wrong signature gives "No signature found". `signtool verify /pa` on a machine that trusts the root is the last check, done where the root is installed. ## The audit log `audit` is append-only: there is no function that edits or removes an entry. Every request a key is named in gets one entry, whatever happened: | `outcome` | | | :-- | :-- | | `approved` | Mark approved; signed | | `auto` | a test key; signed without asking | | `refused` | Mark refused | | `expired` | nobody answered within 5 minutes | | `out-of-scope` | the pipeline or repo is not on the key's lists (whether or not it was approved) | | `invalid` | the request was malformed (wrong digest length, a manifest or approval not in canonical form, an expired approval, a kind the key cannot do) | `signature` is the SHA-256 (hex) of what was returned, for the signed outcomes. `via` is `local` (the Domi pipe) or `remote` (the factor service's mailbox). `run` (core 0.12.0) is the request's run, absent without one; `version` (core 0.12.0) is the context's version, absent when empty. The entry is part of the vault, so it survives a reopen and travels with it. **Compatibility.** Older cores ignore `run`, `version` and the `domi-approve` key. An audit entry of kind `approval` is a value they do not know, so a core before 0.12.0 refuses a vault that holds one (`Corrupted`): once a vault has recorded an approval request, every Custos that opens it must be on core 0.12.0 or later. ## The API (custos-vault) ``` Vault::signing_create(role, pipelines, repos, now) -> ids // release (with domi-approve) or test set Vault::signing_add_approve(now) -> "domi-approve" // for release keys made before 0.12.0 Vault::signing_keys() -> [SigningKeyView] // public parts only Vault::signing_set_scope(id, pipelines, repos) Vault::signing_export_cert(id) -> DER // a certificate, never a key Vault::signing_minisign_public(id) -> minisign.pub text Vault::signing_check(&request) -> Ok | Refusal // before asking Mark (the clock: now_ms) Vault::signing_check_at(&request, now) -> Ok | Refusal // the same at `now` (an approval's expiry) Vault::signing_sign(&request, Approval::{Mark, Auto}, now) -> Signed // checks again, signs, records Vault::signing_refuse(&request, outcome, now) // records refused / expired Vault::signing_audit() -> [AuditEntry] ``` No function returns a `secret`. The views and the audit entries print and serialise without one; there is a test.