[][src]Trait cryptsetup_rs::device::Luks2TokenHandler

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); }

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

fn name() -> &'static str

Display name of token handler

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)

fn free(buf: Vec<u8>)

Free the key (by passing it the reconstructed) vector

fn can_validate() -> bool

Whether the handler can validate json

fn is_valid(cd: RawDevice, json: String) -> Option<TokenHandlerResult>

Validate the token handler JSON representation

fn dump(cd: RawDevice, json: String)

Dump debug information about the token handler implementation

Loading content...

Implementors

Loading content...