Files
codex/codex-rs/device-key
Ruslan Nigmatullin 848e94ed60 app-server: add Windows device key provider
Device keys need to prove possession with non-exportable key material on every accepted signing flow. Windows should use the platform TPM-backed key provider instead of a software secret store or keyring-style storage, so the private key stays behind the OS crypto boundary.

- Wire the device-key crate's default provider to a Windows-specific implementation on Windows.
- Create and open persistent ECDSA P-256 keys with CNG's Microsoft Platform Crypto Provider.
- Export the public key as SPKI DER by converting the CNG ECC public blob to SEC1 form.
- Sign the accepted payload digest with NCrypt and return DER-encoded ECDSA signatures.
- Preserve the hardware TPM protection class and fail create/load/sign when the platform provider or key is unavailable.

- cargo test -p codex-device-key
- cargo check -p codex-device-key --target x86_64-pc-windows-msvc
- just fix -p codex-device-key
- git diff --check
2026-04-21 10:10:50 -07:00
..