key_bag

Struct 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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.