Skip to main content

SigningConfig

Struct SigningConfig 

Source
pub struct SigningConfig { /* private fields */ }
Available on crate feature mav2-message-signing only.
Expand description

Configuration used for MAVLink 2 messages signing as defined in https://mavlink.io/en/guide/message_signing.html.

To use a SigningConfig for sending and reciving messages create a SigningData object using SigningData::from_config.

Debug output redacts the secret key.

§Key handling

This configuration implements neither Copy nor Clone. The owned secret key is zeroized when this configuration is dropped.

This does not erase copies retained by the caller or guarantee erasure of temporary copies created by moves. Zeroization requires destructors to run, so it does not occur if they are skipped, for example on process abort or when the configuration is intentionally leaked with std::mem::forget or Box::leak.

§Examples

Creating SigningData:

let config = SigningConfig::new([0u8; 32], 0, true, false);
let sign_data = SigningData::from_config(config);

SigningConfig does not implement Clone:

ⓘ
fn requires_clone<T: Clone>() {}
requires_clone::<SigningConfig>();

Implementations§

Source§

impl SigningConfig

Source

pub fn new( secret_key: [u8; 32], link_id: u8, sign_outgoing: bool, allow_unsigned: bool, ) -> Self

Creates a new signing configuration.

If sign_outgoing is set messages send using this configuration will be signed. If allow_unsigned is set, when receiving messages, all unsigned messages are accepted, this may also includes MAVLink 1 messages.

The key is stored in an owned buffer that is zeroized on drop. Since [u8; 32] is Copy, callers remain responsible for clearing their own copies.

Trait Implementations§

Source§

impl Debug for SigningConfig

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.