Struct CryptDeviceHandle

Source
pub struct CryptDeviceHandle<P: Debug> { /* private fields */ }
Expand description

An opaque handle on an initialized crypt device

Trait Implementations§

Source§

impl<P: Debug> CryptDevice for CryptDeviceHandle<P>

Source§

fn path(&self) -> &Path

Path the device was opened/created with
Source§

fn cipher(&self) -> &str

Name of cipher used
Source§

fn cipher_mode(&self) -> &str

Name of cipher mode used
Source§

fn device_name(&self) -> &str

Path to the underlying device (as reported by libcryptsetup)
Source§

fn rng_type(&self) -> crypt_rng_type

Random number generator used for operations on this crypt device
Source§

fn set_rng_type(&mut self, rng_type: crypt_rng_type)

Sets the random number generator to use
Source§

fn set_iteration_time(&mut self, iteration_time_ms: u64)

Sets the iteration time for the PBKDF2 function. Note that this does not affect the MK iterations.
Source§

fn volume_key_size(&self) -> u8

Volume key size (in bytes)
Source§

impl CryptDeviceType for CryptDeviceHandle<Luks1Params>

Source§

fn device_type(&self) -> crypt_device_type

Type of the crypt device
Source§

impl CryptDeviceType for CryptDeviceHandle<Luks2Params>

Source§

fn device_type(&self) -> crypt_device_type

Type of the crypt device
Source§

impl<P: Debug> Debug for CryptDeviceHandle<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Debug> Drop for CryptDeviceHandle<P>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Luks1CryptDevice for CryptDeviceHandle<Luks1Params>

Source§

fn hash_spec(&self) -> &str

Get the hash algorithm used
Source§

fn mk_bits(&self) -> u32

Number of bits in the master key
Source§

fn mk_digest(&self) -> &[u8; 20]

Master key header digest
Source§

fn mk_iterations(&self) -> u32

Master key PBKDF2 iterations
Source§

fn mk_salt(&self) -> &[u8; 32]

Master key salt
Source§

fn payload_offset(&self) -> u32

Get the offset of the payload
Source§

impl Luks2CryptDevice for CryptDeviceHandle<Luks2Params>

Source§

fn register_new_token_handler<Handler: Luks2TokenHandlerRaw>() -> Result<Luks2TokenHandlerBox<Handler>>

Register a LUKS2 token handler
Source§

fn register_token_handler<Handler: Luks2TokenHandlerRaw>( handler: &Luks2TokenHandlerBox<Handler>, ) -> Result<()>

Register a LUKS2 token handler given a reference to it
Source§

fn token_status( &mut self, token_id: Luks2TokenId, ) -> (crypt_token_info, Option<String>)

Get token status for a given token id
Source§

fn get_token(&mut self, token_id: Luks2TokenId) -> Result<Luks2Token>

Get a token by id
Source§

fn add_token_with_id( &mut self, token: &Luks2Token, token_id: Luks2TokenId, ) -> Result<()>

Add a token with a specific id
Source§

fn add_token(&mut self, token: &Luks2Token) -> Result<Luks2TokenId>

Add a token, returning the allocated token id
Source§

fn remove_token(&mut self, token_id: Luks2TokenId) -> Result<()>

Remove a token by id
Source§

fn assign_token_to_keyslot( &mut self, token_id: Luks2TokenId, keyslot_opt: Option<Keyslot>, ) -> Result<()>

Assign a token id to a keyslot (or all active keyslots if no keyslot is specified)
Source§

fn unassign_token_keyslot( &mut self, token_id: Luks2TokenId, keyslot_opt: Option<Keyslot>, ) -> Result<()>

Unassing a token from a keyslot (or all active keyslots if no keyslot is specified)
Source§

fn token_keyslot_is_assigned( &mut self, token_id: Luks2TokenId, keyslot: Keyslot, ) -> Result<bool>

Check whether a token is assigned to a given keyslot
Source§

fn activate_with_token( &mut self, name: &str, token_id: Luks2TokenId, ) -> Result<Keyslot>

Activate the crypt device with the specified name and token
Source§

fn check_activation_with_token( &mut self, token_id: Luks2TokenId, ) -> Result<Keyslot>

Check activation of a device with a token
Source§

fn set_pbkdf_params( &mut self, type_: crypt_pbkdf_algo_type, hash: &str, time_ms: u32, iterations: u32, max_memory_kb: u32, parallel_threads: u32, ) -> Result<()>

Set PBKDF parameters (used during next keyslot registration)
Source§

impl LuksCryptDevice for CryptDeviceHandle<Luks1Params>

Source§

fn activate(&mut self, name: &str, key: &[u8]) -> Result<Keyslot>

Activate the crypt device, and give it the specified name
Source§

fn deactivate(self, name: &str) -> Result<()>

Deactivate the crypt device, remove the device-mapper mapping and key information from kernel
Source§

fn destroy_keyslot(&mut self, slot: Keyslot) -> Result<()>

Destroy (and disable) key slot
Source§

fn keyslot_status(&self, keyslot: Keyslot) -> crypt_keyslot_info

Get status of key slot
Source§

fn dump(&self)

Dump text-formatted information about the current device to stdout
Source§

fn uuid(&self) -> Uuid

UUID of the current device
Source§

fn add_keyslot( &mut self, key: &[u8], maybe_prev_key: Option<&[u8]>, maybe_keyslot: Option<Keyslot>, ) -> Result<Keyslot>

Add a new keyslot with the specified key
Source§

fn update_keyslot( &mut self, key: &[u8], prev_key: &[u8], maybe_keyslot: Option<Keyslot>, ) -> Result<Keyslot>

Replace an old key with a new one
Source§

impl LuksCryptDevice for CryptDeviceHandle<Luks2Params>

Source§

fn activate(&mut self, name: &str, key: &[u8]) -> Result<u8>

Activate the crypt device, and give it the specified name
Source§

fn deactivate(self, name: &str) -> Result<()>

Deactivate the crypt device, remove the device-mapper mapping and key information from kernel
Source§

fn destroy_keyslot(&mut self, slot: Keyslot) -> Result<()>

Destroy (and disable) key slot
Source§

fn keyslot_status(&self, keyslot: Keyslot) -> crypt_keyslot_info

Get status of key slot
Source§

fn dump(&self)

Dump text-formatted information about the current device to stdout
Source§

fn uuid(&self) -> Uuid

UUID of the current device
Source§

fn add_keyslot( &mut self, key: &[u8], maybe_prev_key: Option<&[u8]>, maybe_keyslot: Option<Keyslot>, ) -> Result<Keyslot>

Add a new keyslot with the specified key
Source§

fn update_keyslot( &mut self, key: &[u8], prev_key: &[u8], maybe_keyslot: Option<Keyslot>, ) -> Result<Keyslot>

Replace an old key with a new one
Source§

impl<P: PartialEq + Debug> PartialEq for CryptDeviceHandle<P>

Source§

fn eq(&self, other: &CryptDeviceHandle<P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P: Debug> StructuralPartialEq for CryptDeviceHandle<P>

Auto Trait Implementations§

§

impl<P> Freeze for CryptDeviceHandle<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for CryptDeviceHandle<P>
where P: RefUnwindSafe,

§

impl<P> !Send for CryptDeviceHandle<P>

§

impl<P> !Sync for CryptDeviceHandle<P>

§

impl<P> Unpin for CryptDeviceHandle<P>
where P: Unpin,

§

impl<P> UnwindSafe for CryptDeviceHandle<P>
where P: UnwindSafe,

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.