|
1 | | -# Merkle Tree CA Worker |
| 1 | +# IETF Merkle Tree CA Worker |
2 | 2 |
|
3 | | -A Rust implementation of a [Merkle Tree CA](https://github.com/davidben/merkle-tree-certs/) (MTCA) for deployment on [Cloudflare Workers](https://workers.cloudflare.com/). |
| 3 | +A Rust implementation of an [IETF Merkle Tree Certificate CA](https://github.com/ietf-plants-wg/merkle-tree-certs/) for deployment on [Cloudflare Workers](https://workers.cloudflare.com/). |
4 | 4 |
|
5 | | -Much of the API and the internal architecture of the Merkle Tree CA is shared by the [Static CT Log](../ct_worker/README.md). This Worker also implements issuance of Merkle Tree Certificates (MTCs). The issuance API should be considered unstable. For now, its primary purpose is to support an experimental deployment of the MTC specification. |
| 5 | +This worker implements [draft-ietf-plants-merkle-tree-certs-02](https://datatracker.ietf.org/doc/draft-ietf-plants-merkle-tree-certs/). For the older bootstrap experiment, see [`bootstrap_mtc_worker`](../bootstrap_mtc_worker/README.md). |
6 | 6 |
|
7 | | -## Development |
8 | | - |
9 | | -`node` and `npm` are required to run the Worker locally. First, use `npm` to install `wrangler`: |
| 7 | +The internal log architecture (Sequencer, Batcher, Cleaner Durable Objects, tiled R2 storage) is shared with the [Static CT Log](../ct_worker/README.md). |
10 | 8 |
|
11 | | -```bash |
12 | | -npm install -g wrangler@latest |
13 | | -``` |
| 9 | +## How it works |
14 | 10 |
|
15 | | -Then use `wrangler` to run the Worker locally from this directory: |
| 11 | +Subscribers submit a PKCS#10 CSR (base64url-encoded, no padding) to the `add-entry` endpoint, matching the ACME `finalize` format (RFC 8555 §7.4). The CA extracts the subject, SPKI, and SANs from the CSR and logs them as a `TBSCertificateLogEntry`. The validity window is set server-side to `[now, now + max_certificate_lifetime_secs]`. |
16 | 12 |
|
17 | | -```bash |
18 | | -npx wrangler dev -e=dev |
19 | | -``` |
20 | | - |
21 | | -The Worker doesn't implement a full-blown MTCA. Instead, it implements what we call a **bootstrap MTCA**. For every MTC requested, the requester must provide a **bootstrap certificate**. A bootstrap certificate is a standard X.509 certificate chain that must have a path to a root certificate trusted by `bootstrap_mtc_worker`. By default, the root store used is the intersection of Chrome's and Mozilla's trust stores. |
22 | | - |
23 | | -To test the basic functionality, run the following script from this directory: |
24 | | - |
25 | | -```bash |
26 | | -./test-dev.sh |
27 | | -``` |
| 13 | +Once a landmark interval elapses, the sequencer produces a landmark subtree and the CA can issue **landmark-relative MTC certificates** — DER-encoded X.509 structures whose `signatureValue` encodes a Merkle inclusion proof into the landmark subtree rather than a traditional signature. |
28 | 14 |
|
29 | | -This script does the following: |
| 15 | +## Known limitations |
30 | 16 |
|
31 | | -1. Fetch a bootstrap certificate chain. |
| 17 | +- Standalone certificates (with cosignatures in the `signatures` field) are not yet implemented. |
| 18 | +- ML-DSA signing is not yet implemented. |
| 19 | +- The subtree signing oracle (for external cosigners) is not yet implemented. |
| 20 | +- ACME order `notBefore`/`notAfter` fields are not currently supported. |
32 | 21 |
|
33 | | -1. Submit the bootstrap certificate chain to the MTCA running locally. |
34 | | - |
35 | | -1. Wait for the next landmark to be minted. The landmark interval is defined in [`config.dev.json`](./config.dev.json). |
| 22 | +## Development |
36 | 23 |
|
37 | | -1. Request the signatureless MTC from the MTCA running locally |
| 24 | +Requires `node` and `npm`. |
38 | 25 |
|
39 | | -### Overriding the trust store |
| 26 | +```bash |
| 27 | +# Run locally |
| 28 | +npx wrangler -e=dev dev |
40 | 29 |
|
41 | | -It may be useful to provide your own roots for testing. To do so: |
| 30 | +# Reset local state between runs |
| 31 | +./reset-dev.sh |
| 32 | +``` |
42 | 33 |
|
43 | | -1. Build the Worker with the `"dev-bootstrap-roots"` feature. Note that `wrangler` invokes `cargo` with a custom build script, so the simplest thing to do is to edit the `Cargo.toml` file by adding `"dev-boostrap-roots"` to the default feature set. |
| 34 | +### Integration tests |
44 | 35 |
|
45 | | -1. Append your roots to [`dev-bootstrap-roots.pem`](./dev-bootstrap-roots.pem). |
| 36 | +```bash |
| 37 | +BASE_URL=http://localhost:8787 IETF_MTC_LOG_NAME=dev2 cargo test -p integration_tests --test ietf_mtc_api |
| 38 | +``` |
46 | 39 |
|
47 | 40 | ## Deployment |
48 | 41 |
|
49 | 42 | See the [`ct_worker` documentation](../ct_worker/README.md#deployment-to-a-custom-domain) for deployment to a custom domain. |
50 | 43 |
|
| 44 | +The production environment is `prod` (maps to `config.prod.json`): |
| 45 | + |
| 46 | +```bash |
| 47 | +npx wrangler -e=prod deploy |
| 48 | +``` |
| 49 | + |
51 | 50 | ## License |
52 | 51 |
|
53 | 52 | The project is licensed under the [BSD-3-Clause License](./LICENSE). |
0 commit comments