Trait cryptsetup_rs::device::Luks2TokenHandler
source · [−]pub trait Luks2TokenHandler {
fn name() -> &'static str;
fn open(
cd: RawDevice,
token_id: Luks2TokenId
) -> (Vec<u8>, TokenHandlerResult);
fn free(buf: Vec<u8>);
fn can_validate() -> bool;
fn is_valid(cd: RawDevice, json: String) -> Option<TokenHandlerResult>;
fn dump(cd: RawDevice, json: String);
}
Expand description
Equivalence trait for raw::crypt_token_handler
The implementation makes use of traits to generate the raw C functions as a default trait implementation in
Luks2TokenHandlerRaw
. There isn’t really an alternative (safe) way to create the C functions because the
libcryptsetup interface does not offer user pointers as parameters on all of the callback functions (eliminating
the possibility of using boxed closures)
Required Methods
sourcefn open(cd: RawDevice, token_id: Luks2TokenId) -> (Vec<u8>, TokenHandlerResult)
fn open(cd: RawDevice, token_id: Luks2TokenId) -> (Vec<u8>, TokenHandlerResult)
Return the key (the vector returned will be disowned and passed to the free function later)
sourcefn can_validate() -> bool
fn can_validate() -> bool
Whether the handler can validate json
Validate the token handler JSON representation