Skip to main content

Backend

Trait Backend 

Source
pub trait Backend:
    Send
    + Sync
    + Debug {
    // Required methods
    fn reference(&self) -> WrapRef;
    fn wrap(&self, ctx: WrapContext, key: &Key) -> Result<Vec<u8>, WrapError>;
    fn unwrap(&self, ctx: WrapContext, blob: &Blob) -> Result<Key, WrapError>;
}
Expand description

A key backend: a service or a device that holds a key which never leaves it, and wraps and unwraps keys under that key. Its methods are synchronous: the registry calls them from blocking threads.

Required Methods§

Source

fn reference(&self) -> WrapRef

The backend’s key, as every blob it makes records it.

Source

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

Wraps key for ctx, and gives the backend’s ciphertext.

§Errors

A WrapError when the backend does not wrap it.

Source

fn unwrap(&self, ctx: WrapContext, blob: &Blob) -> Result<Key, WrapError>

Unwraps the ciphertext of blob, made for ctx, into a locked page of its own.

§Errors

WrapError::Damaged when the ciphertext does not open for ctx, and any other WrapError when the backend does not unwrap it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§