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