Struct libcryptsetup_rs::CryptContextHandle
source · 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