pub struct KeyBagManager { /* private fields */ }
Expand description
Manages the persistence of a KeyBag.
All operations on the keybag are atomic.
Implementations§
Source§impl KeyBagManager
impl KeyBagManager
Sourcepub fn open(directory: OwnedFd, path: &Path) -> Result<Option<Self>, OpenError>
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).
Sourcepub fn create(directory: OwnedFd, path: &Path) -> Result<Self, OpenError>
pub fn create(directory: OwnedFd, path: &Path) -> Result<Self, OpenError>
Creates a new, empty key-bag file, writing it to disk.
Sourcepub fn new_key(
&mut self,
slot: KeySlot,
wrapping_key: &WrappingKey,
) -> Result<Aes256Key, Error>
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.
Sourcepub fn remove_key(&mut self, slot: KeySlot) -> Result<(), Error>
pub fn remove_key(&mut self, slot: KeySlot) -> Result<(), Error>
Removes a key from the key bag.
Sourcepub fn unwrap_key(
&self,
slot: KeySlot,
wrapping_key: &WrappingKey,
) -> Result<Aes256Key, UnwrapError>
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§
impl Freeze for KeyBagManager
impl RefUnwindSafe for KeyBagManager
impl Send for KeyBagManager
impl Sync for KeyBagManager
impl Unpin for KeyBagManager
impl UnwindSafe for KeyBagManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more