Skip to main content

KeyWrap

Trait KeyWrap 

Source
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<Vec<u8>, WrapError>;
    fn unwrap(&self, tenant: TenantId, wrapped: &[u8]) -> Result<Key, WrapError>;
}
Expand description

A key-wrapping backend. Its methods are synchronous: the registry calls them from blocking threads.

Required Methods§

Source

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.

Source

fn root(&self) -> &Key

The root of the hierarchy: the key the server catalog key is derived from (envelope::catalog_key).

Source

fn wrap(&self, tenant: TenantId, key: &Key) -> Result<Vec<u8>, WrapError>

Wraps key, the tenant key of tenant, bound to that tenant.

§Errors

A WrapError when the backend cannot wrap it.

Source

fn unwrap(&self, tenant: TenantId, wrapped: &[u8]) -> Result<Key, WrapError>

Unwraps a key KeyWrap::wrap made for tenant, into a locked page of its own.

§Errors

WrapError::Damaged when wrapped does not open for tenant under the backend’s key, 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".

Implementors§