pub trait HardwareProvider:
Send
+ Sync
+ 'static {
// Required methods
fn kind(&self) -> HardwareKind;
fn probe(&self) -> HardwareProbe;
fn custody(&self) -> KeyCustody;
fn wrap_key(&self, content_key: &ContentKey) -> Result<Vec<u8>>;
fn unwrap_key(&self, wrapped: &[u8]) -> Result<ContentKey>;
}Expand description
A binding to one OS hardware trusted component.
Implementations are injected into
HardwareBoundBackend, which probes and
self-tests them before claiming a hardware tier — an implementation is never
taken at its word.
Required Methods§
Sourcefn kind(&self) -> HardwareKind
fn kind(&self) -> HardwareKind
Which hardware class this provider binds to.
Sourcefn probe(&self) -> HardwareProbe
fn probe(&self) -> HardwareProbe
Inspect the host for usable hardware.
MUST return HardwareProbe::Indeterminate — never
Absent — when the inspection itself fails
(an error, a timeout, an empty or unintelligible response). “I could not
tell” and “there is none” are different answers and the caller acts
differently on each.
Sourcefn custody(&self) -> KeyCustody
fn custody(&self) -> KeyCustody
Where this provider’s wrapping key lives.
Sourcefn wrap_key(&self, content_key: &ContentKey) -> Result<Vec<u8>>
fn wrap_key(&self, content_key: &ContentKey) -> Result<Vec<u8>>
Encrypt content_key to the hardware wrapping key.
The returned bytes are opaque to this crate and are stored verbatim in the envelope header.
Sourcefn unwrap_key(&self, wrapped: &[u8]) -> Result<ContentKey>
fn unwrap_key(&self, wrapped: &[u8]) -> Result<ContentKey>
Decrypt a previously wrapped content key using the hardware key.
MUST fail — never return arbitrary bytes — when wrapped was sealed by a
different hardware key (for instance a blob copied from another machine).
That failure is the cross-machine binding guarantee.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".