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<&[u8]>, 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, 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.