pub struct Signature {
pub i: u32,
pub m: u32,
pub t: u64,
pub d: String,
pub s: Vec<SignatureValue>,
pub chain: ChainBinding,
pub n: Option<String>,
pub flags: Vec<Flag>,
}Expand description
A parsed DKIM2-Signature header field (§10).
Produced by Signature::parse when a message is parsed into an
AuthenticatedMessage, and by the
Dkim2Signer signing methods in Dkim2Signed::signature. Verified
signatures are exposed through ChainLink::signature.
Fields§
§i: u32i=: sequence number of this signature in the chain, starting at 1
for the originator (§10.1).
m: u32m=: highest Message-Instance revision number (m=) present when
this signature was created (§10.2).
t: u64t=: signature creation time, in seconds since the UNIX epoch (§10.4).
d: Stringd=: signing domain, used to look up the public key (§10.8).
s: Vec<SignatureValue>s=: one signature value per selector, ordered by
group (§10.9).
chain: ChainBindingmf= and rt= (the SMTP envelope of the hop), or nd= (the domain
of the next signer) (§10.5 to §10.7).
n: Option<String>n=: opaque nonce meaningful only to the signer, at most 64
printable ASCII characters (§10.3).
flags: Vec<Flag>f=: flags reporting what the signer did or requesting behaviour
from later hops (§10.10).
Implementations§
Source§impl Signature
impl Signature
Sourcepub fn parse(header: &[u8]) -> Result<Signature>
pub fn parse(header: &[u8]) -> Result<Signature>
Parses a single DKIM2-Signature header field value (without the
field name).
The value is a Tag=Value list (§8): tag names are case-sensitive,
unrecognized tags (including upper-case variants of known ones) are
ignored, and a repeated tag name invalidates the field. An empty value
is accepted only where the tag’s ABNF allows it (n= and unrecognized
tags). s= entries are split into |-separated groups of
,-separated entries; entries with an algorithm this crate does not
implement are kept as AlgorithmName::Unknown. mf= and rt= are
base64-decoded.
§Errors
Returns Dkim2Error::SignatureSyntax for a malformed tag list or
value, a repeated tag or a nonce that is not up to 64 printable ASCII
characters; Dkim2Error::DuplicateSelector when s= repeats a
selector; Dkim2Error::TooManySelectors when s= has more than
eight entries, a local limit on the public key lookups a signature
can cause;
Dkim2Error::SignatureTagMissing if i=, m=, t=, d= or s=
is missing, or if neither nd= nor both mf= and rt= are present;
and Dkim2Error::SignatureTagUnexpected if nd= appears together
with mf= or rt=.
Trait Implementations§
impl Eq for Signature
Source§impl HeaderWriter for Signature
impl HeaderWriter for Signature
Source§fn write_header(&self, writer: &mut impl Writer)
fn write_header(&self, writer: &mut impl Writer)
writer.impl StructuralPartialEq for Signature
Auto Trait Implementations§
impl Freeze for Signature
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnsafeUnpin for Signature
impl UnwindSafe for Signature
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more