pub struct CryptContextHandle<'a> { /* private fields */ }
Expand description
Cryptographic context for device
Implementations§
Source§impl<'a> CryptContextHandle<'a>
impl<'a> CryptContextHandle<'a>
Sourcepub 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>
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
.
Sourcepub fn convert<T: CryptParams>(
&mut self,
type_: EncryptionFormat,
params: Option<&mut T>,
) -> Result<(), LibcryptErr>
pub fn convert<T: CryptParams>( &mut self, type_: EncryptionFormat, params: Option<&mut T>, ) -> Result<(), LibcryptErr>
Convert to new format type
Sourcepub fn set_uuid(&mut self, uuid: Option<Uuid>) -> Result<(), LibcryptErr>
pub fn set_uuid(&mut self, uuid: Option<Uuid>) -> Result<(), LibcryptErr>
Set UUID of crypt device
Sourcepub fn set_label(
&mut self,
label: Option<&str>,
subsystem_label: Option<&str>,
) -> Result<(), LibcryptErr>
pub fn set_label( &mut self, label: Option<&str>, subsystem_label: Option<&str>, ) -> Result<(), LibcryptErr>
Set LUKS2 device label
Sourcepub fn volume_key_keyring(&mut self, enable: bool) -> Result<(), LibcryptErr>
pub fn volume_key_keyring(&mut self, enable: bool) -> Result<(), LibcryptErr>
Set policty on loading volume keys via kernel keyring
Sourcepub fn load<T: CryptParams>(
&mut self,
type_: Option<EncryptionFormat>,
params: Option<&mut T>,
) -> Result<(), LibcryptErr>
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
Sourcepub fn repair<T: CryptParams>(
&mut self,
type_: EncryptionFormat,
params: Option<&mut T>,
) -> Result<(), LibcryptErr>
pub fn repair<T: CryptParams>( &mut self, type_: EncryptionFormat, params: Option<&mut T>, ) -> Result<(), LibcryptErr>
Repair crypt device header if invalid
Sourcepub fn resize(&mut self, name: &str, new_size: u64) -> Result<(), LibcryptErr>
pub fn resize(&mut self, name: &str, new_size: u64) -> Result<(), LibcryptErr>
Resize crypt device
Sourcepub fn resume_by_passphrase(
&mut self,
name: &str,
keyslot: c_int,
passphrase: &str,
) -> Result<c_int, LibcryptErr>
pub fn resume_by_passphrase( &mut self, name: &str, keyslot: c_int, passphrase: &str, ) -> Result<c_int, LibcryptErr>
Resume crypt device using a passphrase
Sourcepub 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>
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> 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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