id: 88faea9a70444058807b535547ae7802
parent_id: 
item_type: 1
item_id: dccd45761a584319b7ae75d1c16840f8
item_updated_time: 1782802458180
title_diff: "[{\"diffs\":[[1,\"Keyfob Station — Two-Binary Split (dev vs production)\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":53}]"
body_diff: "[{\"diffs\":[[1,\"# Two-Binary Split: dev station vs production station\\\n\\\n## Goal\\\nSplit the provisioning station into two distinct binaries reflecting the two operational use cases.\\\n\\\n## `kf-dev-station` — Development GUI binary\\\n- **Provisioning + firmware flashing** (SEMS Lite loader).\\\n- Uses the **development SCP03 static key set**; performs the **full KDF in software** (Phase 1 master+UID → S-ENC/MAC/DEK, Phase 2 → session keys).\\\n- Provisions from a per-fob container folder via `FileContainerSource`.\\\n- Today runs against the simulated JCOP applet (stub fob).\\\n\\\n## `kf-prod-station` — Production GUI binary\\\n- **Provisioning only** (no flashing).\\\n- **No KDF in the application.** After `INITIALIZE UPDATE` it forwards\\\n  `{uid, key_version, host_challenge, card_challenge, seq_counter, card_cryptogram}`\\\n  to the KLMS via the `KlmsClient` trait (a DLL in production) and receives back:\\\n  - the SCP03 **session keys** (SES-ENC/MAC/RMAC) + host cryptogram,\\\n  - the **pre-encrypted** personalization content (A003 already S-DEK-encrypted\\\n    inside the KLMS HSM — the app never holds static/master/DEK keys).\\\n- `Scp03Channel::establish_from_session_keys` injects the KLMS-issued keys.\\\n- `KlmsProvisioner` rejects any content item flagged `encrypt_with_dek=true`\\\n  (those must arrive pre-encrypted from the KLMS).\\\n- Today runs end-to-end against `MockKlmsClient` (emulates the HSM with the dev\\\n  keys) + the simulated fob.\\\n\\\n## New crate: `kf-klms`\\\n- `KlmsClient` trait (async) + `SessionRequest` / `SessionResponse` / `KlmsContent`.\\\n- `MockKlmsClient` — emulates the HSM: derives session keys + cryptograms (Phase 2)\\\n  with the dev static keys, verifies the card cryptogram, returns content. This is\\\n  the only place the derivation code runs in the production path; the *application*\\\n  (`KlmsProvisioner`) itself does no KDF.\\\n- Real DLL-backed `KlmsClient` is the next step behind the same trait.\\\n\\\n## `kf-hsm` (Nitrokey local KDF)\\\n- Present + tested (SW↔HW parity proven) but **not used by either binary's runtime\\\n  path**. Remains available for a future local-HSM option; production master key\\\n  belongs on the KLMS server HSM.\\\n\\\n## New code\\\n- `kf-scp03/src/channel.rs`: `Scp03Channel::establish_from_session_keys(keys, level)` —\\\n  inject externally-derived session keys (no static keys, no card-cryptogram check;\\\n  the KLMS authenticates the card).\\\n- `kf-provision/src/klms.rs`: `KlmsProvisioner<T,K>` — production pipeline.\\\n- `kf-klms/src/lib.rs`: trait + mock.\\\n\\\n## Status\\\n- 86 tests pass (incl. `KlmsProvisioner` end-to-end + unencrypted-item rejection +\\\n  `MockKlmsClient` card-auth tests).\\\n- clippy clean (default + `--features nitrokey`); release binaries build.\\\n- Both GUIs compile + the dev GUI smoke-launches.\\\n\\\n## Next steps\\\n- DLL-backed `KlmsClient` (real KLMS link).\\\n- Real `pcsc` transport behind `SmartcardTransport`.\\\n- Wire real readers → provision real fobs from each binary.\\\n\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":2872}]"
metadata_diff: {"new":{"id":"dccd45761a584319b7ae75d1c16840f8","parent_id":"283dd54f183a4ce69366648f091336d1","latitude":"0.00000000","longitude":"0.00000000","altitude":"0.0000","author":"","source_url":"","is_todo":0,"todo_due":0,"todo_completed":0,"source":"joplin-desktop","source_application":"net.cozic.joplin-desktop","application_data":"","order":1782492470236,"user_updated_time":1782492470236,"markup_language":1,"is_shared":0,"share_id":"","conflict_original_id":"","master_key_id":"","user_data":"","deleted_time":1782802458180},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2026-06-30T06:57:45.547Z
created_time: 2026-06-30T06:57:45.547Z
type_: 13