pub struct Verifier { /* private fields */ }Expand description
Verifies signed v2 frames against a shared key, rejecting forged and replayed frames.
A verifier recomputes each frame’s signature and rejects it unless it matches. It also enforces freshness: a frame from a stream it has seen must carry a strictly newer timestamp than the last, and a frame from a new stream must not be more than the replay window behind the newest timestamp seen, so a recording of an old frame cannot be re-injected.
Implementations§
Source§impl Verifier
impl Verifier
Sourcepub fn with_window(self, window: u64) -> Self
pub fn with_window(self, window: u64) -> Self
Sourcepub fn verify(&mut self, frame: &Frame) -> Result<()>
pub fn verify(&mut self, frame: &Frame) -> Result<()>
Verifies a signed frame’s signature and freshness.
On success, the frame’s stream timestamp is recorded so a later replay of the same or an older frame is rejected.
§Arguments
frame- the parsed frame to check.
§Returns
Ok(()) if the frame is authentic and fresh.
§Errors
Returns MavlinkError::Unsigned if the frame is not signed,
MavlinkError::BadSignature if the signature does not match the key, or
MavlinkError::ReplayedTimestamp if the timestamp is not fresh.