Struct CryptKeyslotHandle

Source
pub struct CryptKeyslotHandle<'a> { /* private fields */ }
Expand description

Handle for keyslot operations

Implementations§

Source§

impl<'a> CryptKeyslotHandle<'a>

Source

pub fn add_by_passphrase( &mut self, keyslot: Option<c_uint>, passphrase: &[u8], new_passphrase: &[u8], ) -> Result<c_uint, LibcryptErr>

Add key slot using a passphrase

Source

pub fn change_by_passphrase( &mut self, keyslot_old: Option<c_uint>, keyslot_new: Option<c_uint>, passphrase: &[u8], new_passphrase: &[u8], ) -> Result<c_uint, LibcryptErr>

Change allocated key slot using a passphrase

Source

pub fn add_by_keyfile_device_offset( &mut self, keyslot: Option<c_uint>, keyfile_and_size: (&Path, size_t), keyfile_offset: u64, new_keyfile_and_size: (&Path, size_t), new_keyfile_offset: u64, ) -> Result<c_uint, LibcryptErr>

Add key slot using key file

Source

pub fn add_by_key( &mut self, keyslot: Option<c_uint>, volume_key: Option<Either<&[u8], usize>>, passphrase: &[u8], flags: CryptVolumeKey, ) -> Result<c_uint, LibcryptErr>

Add key slot with a key

Source

pub fn destroy(&mut self, keyslot: c_uint) -> Result<(), LibcryptErr>

Destroy key slot

Source

pub fn status(&mut self, keyslot: c_uint) -> Result<KeyslotInfo, LibcryptErr>

Get keyslot status

Source

pub fn get_priority( &mut self, keyslot: c_uint, ) -> Result<KeyslotPriority, LibcryptErr>

Get keyslot priority (LUKS2 specific)

Source

pub fn set_priority( &mut self, keyslot: c_uint, priority: KeyslotPriority, ) -> Result<(), LibcryptErr>

Get keyslot priority (LUKS2 specific)

Source

pub fn max_keyslots(fmt: EncryptionFormat) -> Result<c_uint, LibcryptErr>

Get maximum keyslots supported for device type

Source

pub fn area(&mut self, keyslot: c_uint) -> Result<(u64, u64), LibcryptErr>

Get keyslot area pointers

Source

pub fn get_key_size(&mut self, keyslot: c_uint) -> Result<c_uint, LibcryptErr>

Get size of key in keyslot - only different from crypt_get_volume_key_size() binding in the case of LUKS2 using unbound keyslots

Source

pub fn get_encryption( &mut self, keyslot: Option<c_uint>, ) -> Result<(&str, size_t), LibcryptErr>

Get encryption cipher and key size of keyslot (not data)

Source

pub fn get_pbkdf( &mut self, keyslot: c_uint, ) -> Result<CryptPbkdfType, LibcryptErr>

Get PBDKF parameters for a keyslot

Source

pub fn set_encryption( &mut self, cipher: &str, key_size: size_t, ) -> Result<(), LibcryptErr>

Set encryption used for keyslot

Source

pub fn get_dir() -> Result<Box<Path>, LibcryptErr>

Get directory where crypt devices are mapped

Auto Trait Implementations§

§

impl<'a> Freeze for CryptKeyslotHandle<'a>

§

impl<'a> RefUnwindSafe for CryptKeyslotHandle<'a>

§

impl<'a> !Send for CryptKeyslotHandle<'a>

§

impl<'a> !Sync for CryptKeyslotHandle<'a>

§

impl<'a> Unpin for CryptKeyslotHandle<'a>

§

impl<'a> !UnwindSafe for CryptKeyslotHandle<'a>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.