Trait SetKeyBySlice

Source
pub trait SetKeyBySlice<'a, const KL: usize> {
    // Required methods
    fn set_key(
        &self,
        key: &'static mut [u8; KL],
    ) -> Result<(), (ErrorCode, &'static mut [u8; KL])>;
    fn set_client(&self, client: &'a dyn SetKeyBySliceClient<KL>);
}
Expand description

Interface for setting keys by a slice.

KL is the length of the keys.

Implementers must be able to store keys from a slice. This is most commonly used for implementations that hold keys in memory. However, this interface is asynchronous as keys may be stored in external storage or an external chip and require an asynchronous operations.

Implementors cannot hold the slice of the key being set. Instead, they must make an internal copy of the key and return the slice in SetKeyBySliceClient::set_key_done().

Required Methods§

Source

fn set_key( &self, key: &'static mut [u8; KL], ) -> Result<(), (ErrorCode, &'static mut [u8; KL])>

Set the current key.

This is asynchronous. The key slice will be returned in SetKeyBySliceClient::set_key_done(), or immediately if there is an error.

§Return

Ok() if the key setting operation was accepted. Otherwise:

  • Err(ErrorCode::FAIL) if the key cannot be set.
Source

fn set_client(&self, client: &'a dyn SetKeyBySliceClient<KL>)

Implementors§