-
Notifications
You must be signed in to change notification settings - Fork 378
Add key management documentation for MSI v2 #5513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # MSI v2 — Key Logic | ||
|
|
||
| ## Overview | ||
|
|
||
| In MSI v2, before MSAL can do anything with IMDS or ESTS, it needs a key pair. This private key is the root trust anchor for all subsequent operations (CSR, cert issuance, PoP binding). | ||
|
|
||
| ## Key Responsibilities | ||
|
|
||
| - Generate and hold the RSA private key. | ||
| - Ensure the key is protected to the maximum capability of the platform. | ||
| - Provide the key for signing (CSR, PoP requests, mTLS handshakes). | ||
| - Never allow export if backed by hardware/KeyGuard. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: KeyGuard/TPM |
||
|
|
||
| ## Key Selection Priority | ||
|
|
||
| MSAL implements a hierarchical key provider strategy: | ||
|
|
||
| ### KeyGuard (awlays for PoP) | ||
gladjohn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Requires Virtualization-Based Security (VBS). | ||
| - Keys are isolated in a secure enclave. | ||
| - Strongest guarantee that the private key cannot be exfiltrated. | ||
| - Used for Proof-of-Possession (PoP). | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you only put this here and not the other key types? Every Key type listed here can be used in PoP. |
||
|
|
||
| ### Hardware / TPM / KSP (fallback) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you write out the TPM acronym here? |
||
|
|
||
| - Keys are backed by TPM or the Platform Crypto Provider. | ||
| - Non-exportable, tied to the device. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. KeyGuard is also not exportable, can you add this to the KeyGuard section too? |
||
| - Provides strong hardware-based protection, but not as strict as VBS isolation. | ||
|
|
||
| ### In-memory RSA (last resort on Windows and only option in Linux) | ||
|
|
||
| - Keys are created and held in memory. | ||
| - Software-based only, weakest in terms of protection. | ||
| - Used only when platform protections are unavailable. | ||
|
|
||
| ## Mermaid — Key Selection Flow | ||
|
|
||
| ```mermaid | ||
| sequenceDiagram | ||
| autonumber | ||
| participant MSAL | ||
| participant KeyProvider as Key Provider | ||
| MSAL->>KeyProvider: GetOrCreateKey() | ||
| alt Cached key exists | ||
| KeyProvider-->>MSAL: Return cached key | ||
| else No cached key | ||
| KeyProvider-->>KeyProvider: Acquire semaphore | ||
| alt KeyGuard available | ||
| KeyProvider-->>MSAL: KeyGuard key (preferred) | ||
| else Hardware/TPM available | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add "KeyGuard not available" |
||
| KeyProvider-->>MSAL: Hardware key | ||
| else | ||
| KeyProvider-->>MSAL: In-memory RSA key | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add "KeyGuard and TPM not available" |
||
| end | ||
| KeyProvider-->>KeyProvider: Cache key & release semaphore | ||
| end | ||
| ``` | ||
|
|
||
|
|
||
| ✅ Summary: | ||
|
|
||
| In MSI v2, everything starts with a key. MSAL enforces a secure-first fallback chain: KeyGuard → TPM → In-memory. For PoP tokens, KeyGuard is the preferred option since it offers the strongest binding guarantees. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does "hold" mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 ... and to generalize the concept, we should have some Windows / Linux notes .. I assume on Windows "hold" means "write to it a keystore" and on Linux means "write it to memory"