Skip to main content

SignMethod

Trait SignMethod 

Source
pub trait SignMethod {
    // Required methods
    fn signature_type(&self) -> u64;
    fn next_seq_num(&mut self) -> u64;
    fn certificate(&self) -> Option<Certificate>;
    fn sign(&self, data: &[u8]) -> Bytes;

    // Provided method
    fn time(&self) -> SignatureTime { ... }
}
Expand description

Something that can sign Interests and Data – see DigestSha256 and SignatureSha256WithRsa for the implementations this crate provides.

Required Methods§

Source

fn signature_type(&self) -> u64

The signature type number this method produces (see signature_type).

Source

fn next_seq_num(&mut self) -> u64

Returns the next signing sequence number, advancing internal state so each call returns a new value.

Source

fn certificate(&self) -> Option<Certificate>

The certificate this method signs with, if any (e.g. None for DigestSha256, which signs without a key).

Source

fn sign(&self, data: &[u8]) -> Bytes

Signs data, returning the raw signature bytes.

Provided Methods§

Source

fn time(&self) -> SignatureTime

The current time, used as the default signing timestamp. Provided so it doesn’t need to be implemented by every SignMethod.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: SignMethod + ?Sized> SignMethod for Box<T>

Source§

fn signature_type(&self) -> u64

Source§

fn next_seq_num(&mut self) -> u64

Source§

fn certificate(&self) -> Option<Certificate>

Source§

fn sign(&self, data: &[u8]) -> Bytes

Source§

impl<T: SignMethod> SignMethod for &mut T

Source§

fn signature_type(&self) -> u64

Source§

fn next_seq_num(&mut self) -> u64

Source§

fn certificate(&self) -> Option<Certificate>

Source§

fn sign(&self, data: &[u8]) -> Bytes

Implementors§