Skip to main content

PacketAuthenticator

Trait PacketAuthenticator 

Source
pub trait PacketAuthenticator {
    type Error;

    // Required methods
    fn sign(
        &mut self,
        key_id: u32,
        nonce: u64,
        payload: &[u8],
        out: &mut Vec<u8>,
    ) -> Result<(), Self::Error>;
    fn verify(
        &mut self,
        key_id: u32,
        nonce: u64,
        payload: &[u8],
        tag: &[u8],
    ) -> Result<bool, Self::Error>;
}
Expand description

Packet authenticator hook. Embedders should provide a real MAC/signature implementation and key management outside SectorSync.

Required Associated Types§

Source

type Error

Authenticator error type.

Required Methods§

Source

fn sign( &mut self, key_id: u32, nonce: u64, payload: &[u8], out: &mut Vec<u8>, ) -> Result<(), Self::Error>

Produces an authentication tag over key_id, nonce, and payload.

Source

fn verify( &mut self, key_id: u32, nonce: u64, payload: &[u8], tag: &[u8], ) -> Result<bool, Self::Error>

Verifies an authentication tag over key_id, nonce, and payload.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§