ADR-084: Crypto-Provider Policy — aws-lc-rs for CRAIG-Owned Asymmetric Operations and the jsonwebtoken Backend
Status
Accepted (2026-10-24), #2683. Supersedes ADR-007 § jsonwebtoken Crypto Backend Choice and corrects ADR-046 § Decision, Crypto provider.
Context
RUSTSEC-2026-0387 (2026-10-23): crypto-bigint 0.5.5 can branch on secret data in operations meant to be constant-time.
The patched line is >= 0.7.6; there is no 0.5.x backport. crypto-bigint 0.5.5 reached CRAIG only through
elliptic-curve 0.13, along two edges:
-
jsonwebtoken 10’s
rust_cryptobackend pulled p256 / p384 0.13; -
CRAIG’s own p256 0.13 / ecdsa 0.16, which did secret-key work: actor-token signing, the env signing keys (
keypair_env), the BFF transport’s actor tokens and the intake SDK’s detached JWS.
ADR-007 (2026-03) chose rust_crypto as pure Rust, because aws-lc-rs had been deferred over its NASM requirement on
Windows, and CRAIG’s own p256 signing followed that posture. aws-lc-rs was nonetheless already in the build before
ADR-046: lapin 4’s default rustls feature reaches rustls’s aws_lc_rs provider (amq-protocol-tcp → tcp-stream →
rustls-connector → rustls/aws_lc_rs; the lock just before ADR-046, 558fe44af^, carries aws-lc-rs 1.16.3). ADR-046
(2026-06) then also selected it for craig-intake’s in-process TLS (craig-intake’s own rustls features and axum-server’s
tls-rustls). ADR-046 attributed it to reqwest’s rustls-tls, but reqwest 0.12 selects ring.
ADR-046 did not amend ADR-007, so CRAIG carried two asymmetric stacks after the reason for the second had lapsed.
Decision
D1 — aws-lc-rs is the provider for CRAIG-owned asymmetric operations and the jsonwebtoken backend
-
The workspace
jsonwebtokenentry enablesaws_lc_rs(the one backend feature, so jsonwebtoken selects it without aCryptoProvider::install_defaultcall). JWT processing stays delegated to jsonwebtoken; the OIDC path still admits RS256, ES256, ES384 and EdDSA. -
Every CRAIG ES256 operation (key generation, signing, JWS and DER verification) runs on aws-lc-rs.
D2 — craig-crypto is the only CRAIG crate that imports aws_lc_rs::signature
Other crates hold validated types and call a small interface:
-
Es256PublicKeyis validated at construction (from_coordinates,from_sec1; only the 65-byte uncompressed SEC1 form), so an off-curve point is refused before it is stored or registered. -
Es256SigningKey(generate,from_parts,from_d,from_private_jwk) is one aws-lc key pair shared behind anArc;sign_jwsreturns the fixedr‖s,sign_derthe same signature as minimal DER.Debugis redacted. -
verify_jwsaccepts only the 64-byte fixed form andverify_deronly strict DER (short-form lengths, minimal positive INTEGERs, r and s in [1, n), nothing trailing). Undecodable DER isMalformedSignaturebefore AWS-LC is reached, so craig-webauthn keeps itsMalformed/BadSignatureboundary. -
Every error is value-free: a member and a reason, never key or signature bytes.
D3 — JWK serialization is CRAIG code in craig_crypto::jwk
A pure serde and base64ct codec with no provider import. kty must be EC, crv P-256, and x, y and d each
exactly 32 bytes of unpadded base64url. The private env JWK and partner signer JWKs are strict (an unrecognised member is
refused); actor-peer JWKs keep jsonwebtoken’s tolerance of other members. Every public reading refuses a d member. The
private JWK zeroizes d on drop. Output is byte-compatible with the JWKs CRAIG already emits and stores.
D4 — Bans and the named exception
deny.toml bans elliptic-curve (the edge that carried crypto-bigint 0.5) and ed25519-dalek (whose only parent was
jsonwebtoken’s rust_crypto), each with reason = "ADR-084". The named exception is rsa 0.9 on the reqsign path
(zen-engine’s reqsign-google / reqsign-azure-storage, no configured flow): RUSTSEC-2023-0071 stays ignored for it, and
its auth-path leg is gone, since RS256 now verifies on AWS-LC.
D5 — Windows builds declare prebuilt-nasm
The workspace aws-lc-rs entry turns off default features and enables aws-lc-sys and prebuilt-nasm, so an isolated
build of craig-crypto, craig-webauthn or craig-intake-sdk needs no NASM on Windows. An xtask test pins the feature in the
resolved graph of each. CRAIG has no Windows CI runner; the pin is the gate.
As-built (#3194): reqwest’s TLS is a second way to aws-lc-sys. It arrives through rustls’s aws_lc_rs feature, which
enables prebuilt-nasm itself, and the same test pins craig-common’s graph for that path. This was the reason reqwest
had been held at 0.12 since ADR-007.
Outstanding, not claimed
-
TLS consolidation. reqwest’s directly selected
ringbackend stays; moving TLS onto aws-lc-rs is separate work (#2693).ringandrsa0.9 also remain through third-party crates CRAIG does not configure (#2698). As-built (#3194, #2693): the workspace’s reqwest is 0.13 with itsrustlsfeature, so every HTTP client CRAIG builds speaks TLS on aws-lc-rs. A client takes the process-default provider when one is installed and aws-lc-rs otherwise; craig-intake installs aws-lc-rs for its listener, and no other CRAIG process installs one. A craig-common test reads a client’s first flight and finds X25519MLKEM768 offered, a key exchange rustls has only on aws-lc-rs. The same move changes what a client trusts: reqwest 0.13 verifies against the operating system’s trust store (rustls-platform-verifier), where 0.12’srustls-tlscompiled a root set into the binary (Deployment Guide § The certificate authorities an outbound call trusts). The self-signed certificate of craig-intake’s devstack-onlyself-signed-tlsfeature is generated on aws-lc-rs too (rcgen’saws_lc_rsfeature).ringis still compiled, through one upstream: zen-engine 0.55 takes reqwest 0.12 withrustls-tls, which turns on theringfeature of rustls, hyper-rustls, tokio-rustls and rustls-webpki. No CRAIG crate depends on that reqwest. jsonschema 0.33 and the OpenTelemetry 0.29 exporters also take reqwest 0.12, with no TLS feature. #2698 tracks the upstream. -
FIPS. Not claimed. The aws-lc-rs FIPS build is not enabled.
-
Actor-token minting stays a hand-assembled JWT; only its signer changed (moving it onto
jsonwebtoken::encodeis #2694). As-built (#2694): actor tokens are now minted byjsonwebtoken::encode(itsaws_lc_rsbackend signs ES256) over anEncodingKeyfromEs256SigningKey::to_pkcs8_der; the claims are byte-identical, and the header carries the samealg,typandkidin jsonwebtoken’s member order.
Consequences
-
ES256 signatures are randomized (AWS-LC draws a fresh nonce), where p256 signed deterministically (RFC 6979). Verifiers are unaffected; a test may compare a signature only with itself.
-
On the OIDC path RSA keys under 2048 bits are refused, and 4097–8192-bit keys are accepted (rsa 0.9 refused above 4096).
-
A public JWK carrying
dis refused at partner-signer registration, at intake verification and in the peer JWKS; two data-only migrations stripdfrom stored signer keys. -
A malformed
CRAIG_PEER_JWKS_JSONentry fails every service at boot instead of silently breaking one peer. -
High-S WebAuthn signatures verify without normalization.
-
CRAIG-owned asymmetric operations have one provider behind one interface, instead of p256 types in 22 files.
Alternatives
-
p256 0.14 / ecdsa 0.17 with jsonwebtoken
aws_lc_rs(the fixed RustCrypto generation). Valid remediation, and the defined fallback had aws-lc-rs hit a platform or compatibility problem. It needs the same JWK codec, validated types and tests, and keeps two providers; consolidating later would repeat the work. -
Ignore the advisory. Not available: CRAIG performs secret-scalar operations on the affected code.