Struct CryptContextHandle

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

Cryptographic context for device

Implementations§

Source§

impl<'a> CryptContextHandle<'a>

Source

pub fn format<T: CryptParams>( &mut self, type_: EncryptionFormat, cipher_and_mode: (&str, &str), uuid: Option<Uuid>, volume_key: Either<&[u8], usize>, params: Option<&mut T>, ) -> Result<(), LibcryptErr>

Format and encrypt the given device with the requested encryption algorithm and key or key length.

For volume_key parameter, either the volume key or the desired length of the generated volume key can be specified.

For the volume_key parameter, the value in Either::Right must be in units of bytes. For a common key length such as 512 bits, the value passed to the Either::Right variant would be 512 / 8.

Source

pub fn convert<T: CryptParams>( &mut self, type_: EncryptionFormat, params: Option<&mut T>, ) -> Result<(), LibcryptErr>

Convert to new format type

Source

pub fn set_uuid(&mut self, uuid: Option<Uuid>) -> Result<(), LibcryptErr>

Set UUID of crypt device

Source

pub fn set_label( &mut self, label: Option<&str>, subsystem_label: Option<&str>, ) -> Result<(), LibcryptErr>

Set LUKS2 device label

Source

pub fn volume_key_keyring(&mut self, enable: bool) -> Result<(), LibcryptErr>

Set policty on loading volume keys via kernel keyring

Source

pub fn load<T: CryptParams>( &mut self, type_: Option<EncryptionFormat>, params: Option<&mut T>, ) -> Result<(), LibcryptErr>

Load on-disk header parameters based on provided type

Source

pub fn repair<T: CryptParams>( &mut self, type_: EncryptionFormat, params: Option<&mut T>, ) -> Result<(), LibcryptErr>

Repair crypt device header if invalid

Source

pub fn resize(&mut self, name: &str, new_size: u64) -> Result<(), LibcryptErr>

Resize crypt device

Source

pub fn suspend(&mut self, name: &str) -> Result<(), LibcryptErr>

Suspend crypt device

Source

pub fn resume_by_passphrase( &mut self, name: &str, keyslot: c_int, passphrase: &str, ) -> Result<c_int, LibcryptErr>

Resume crypt device using a passphrase

Source

pub fn resume_by_keyfile_device_offset( &mut self, name: &str, keyslot: c_int, keyfile: &Path, keyfile_size: size_t, keyfile_offset: u64, ) -> Result<c_int, LibcryptErr>

Resume crypt device using a key file at an offset on disk

Auto Trait Implementations§

§

impl<'a> Freeze for CryptContextHandle<'a>

§

impl<'a> RefUnwindSafe for CryptContextHandle<'a>

§

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

§

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

§

impl<'a> Unpin for CryptContextHandle<'a>

§

impl<'a> !UnwindSafe for CryptContextHandle<'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.