Struct key_bag::KeyBagManager

source ·
pub struct KeyBagManager { /* private fields */ }
Expand description

Manages the persistence of a KeyBag.

All operations on the keybag are atomic.

Implementations§

source§

impl KeyBagManager

source

pub fn open(directory: OwnedFd, path: &Path) -> Result<Option<Self>, OpenError>

Opens a key-bag file. If it doesn’t exist, or is an empty file, returns Ok(None).

source

pub fn create(directory: OwnedFd, path: &Path) -> Result<Self, OpenError>

Creates a new, empty key-bag file, writing it to disk.

source

pub fn new_key( &mut self, slot: KeySlot, wrapping_key: &WrappingKey ) -> Result<Aes256Key, Error>

Generates and stores a new key in the key-bag, based on |wrapping_key|. Returns the unwrapped key contents.

source

pub fn remove_key(&mut self, slot: KeySlot) -> Result<(), Error>

Removes a key from the key bag.

source

pub fn unwrap_key( &self, slot: KeySlot, wrapping_key: &WrappingKey ) -> Result<Aes256Key, UnwrapError>

Attempts to unwrap a key at |slot| with |wrapping_key|.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.