pub trait KeyWrap:
Send
+ Sync
+ Debug {
// Required methods
fn key_id(&self) -> KeyId;
fn root(&self) -> &Key;
fn wrap(&self, tenant: TenantId, key: &Key) -> Result<Wrapped, WrapError>;
fn unwrap(
&self,
tenant: TenantId,
wrapped: &[u8],
kek: Option<&WrappedKek>,
) -> Result<Key, WrapError>;
}Expand description
A key-wrapping backend. Its methods are synchronous: the registry calls them from blocking threads.
Required Methods§
Sourcefn key_id(&self) -> KeyId
fn key_id(&self) -> KeyId
The id of the key that wraps tenant keys. The registry counts each wrap against it, and a key rotation records when its use began.
Sourcefn root(&self) -> &Key
fn root(&self) -> &Key
The root of the hierarchy: the key the server catalog key is derived
from (envelope::catalog_key).
Sourcefn unwrap(
&self,
tenant: TenantId,
wrapped: &[u8],
kek: Option<&WrappedKek>,
) -> Result<Key, WrapError>
fn unwrap( &self, tenant: TenantId, wrapped: &[u8], kek: Option<&WrappedKek>, ) -> Result<Key, WrapError>
Unwraps a key KeyWrap::wrap made for tenant, into a locked page
of its own: wrapped under the key-encryption key kek, or under
the master key file when kek is None.
§Errors
WrapError::Elsewhere when the key is under another key than this
backend’s, WrapError::Damaged when wrapped does not open for
tenant under the backend’s key, WrapError::Blob when kek’s
blob cannot be read, and WrapError::Memory when the key’s page
cannot be locked.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".