Luks2TokenHandler

Trait Luks2TokenHandler 

Source
pub trait Luks2TokenHandler {
    // Required methods
    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§

Source

fn name() -> &'static str

Display name of token handler

Source

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)

Source

fn free(buf: Vec<u8>)

Free the key (by passing it the reconstructed) vector

Source

fn can_validate() -> bool

Whether the handler can validate json

Source

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

Validate the token handler JSON representation

Source

fn dump(cd: RawDevice, json: String)

Dump debug information about the token handler implementation

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§