pub struct Protection { /* private fields */ }Expand description
What actually stands between the stored value and an ordinary local user.
The three operating systems protect it with three different mechanisms, so
the useful cross-platform question is not “what is the mode” but “which
object’s access control decides who can read this, and does it exclude an
unprivileged local user”. Protection::guard answers the first half and
Protection::readable_by_other_local_users the second.
| store | guard |
|---|---|
| Windows, either scope | the file holding the DPAPI blob, whose DACL is protected and names no broad trustee |
| Linux, either scope | the 0600 file |
| macOS, login or rooted keychain | the keychain database file |
| macOS, System Keychain | /var/db/SystemKey, the root-only master key that unlocks it |
That last row is the one worth reading twice.
/Library/Keychains/System.keychain is itself world-readable, and saying so
and stopping would be both true and useless: its contents are encrypted, and
what decides who can decrypt them is the mode of the master key beside it.
Reporting the keychain database there would answer a question nobody asked
and would answer it wrongly.
Implementations§
Source§impl Protection
impl Protection
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
The platform’s own description of it — a Unix mode, or a DACL in SDDL form. For diagnostics and for test failure messages.
Sourcepub const fn readable_by_other_local_users(&self) -> bool
pub const fn readable_by_other_local_users(&self) -> bool
Whether an ordinary local user other than the owner could read the stored value.
A local administrator or root is deliberately outside this question;
see this module’s documentation and 07-security.md.
Trait Implementations§
Source§impl Clone for Protection
impl Clone for Protection
Source§fn clone(&self) -> Protection
fn clone(&self) -> Protection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more