pub struct Fingerprint {
pub func: HashFunc,
pub digest: Vec<u8>,
}Expand description
One a=fingerprint value (RFC 8122 §5).
Fields§
§func: HashFuncWhich hash it was taken with.
digest: Vec<u8>The digest itself, as octets rather than as text — a fingerprint is compared to a hash of a certificate, and keeping it as the printed form would mean re-parsing to do that.
Implementations§
Source§impl Fingerprint
impl Fingerprint
Sourcepub fn of(certificate: &[u8], func: HashFunc) -> Self
pub fn of(certificate: &[u8], func: HashFunc) -> Self
The fingerprint of a DER-encoded certificate, taken with func.
Sourcepub fn parse(value: &str) -> Option<Self>
pub fn parse(value: &str) -> Option<Self>
Read an a=fingerprint value: <hash-func> SP <2UHEX *(":" 2UHEX)>.
Returns None for a hash sipx may not act on, a malformed digest, or a digest whose length
does not match the function named. The last check matters: a truncated digest that compared
equal against the first bytes of a certificate hash would be a fingerprint check that
verifies almost nothing.
Sourcepub fn to_value(&self) -> String
pub fn to_value(&self) -> String
Render as an a=fingerprint value.
Uppercase hex: §5’s UHEX rule is DIGIT / %x41-46, which is uppercase only. Lowercase is
what most implementations accept anyway, and is still not what the grammar says.
Sourcepub fn matches(&self, certificate: &[u8]) -> bool
pub fn matches(&self, certificate: &[u8]) -> bool
Whether a certificate is the one this fingerprint names (RFC 8122 §6.2).
Compared in constant time. The value is public, so this is not about protecting the digest — it is about not giving an attacker who can offer certificates a byte-at-a-time oracle for how far a forged one matched.
Trait Implementations§
Source§impl Clone for Fingerprint
impl Clone for Fingerprint
Source§fn clone(&self) -> Fingerprint
fn clone(&self) -> Fingerprint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Fingerprint
impl Debug for Fingerprint
Source§impl PartialEq for Fingerprint
impl PartialEq for Fingerprint
Source§fn eq(&self, other: &Fingerprint) -> bool
fn eq(&self, other: &Fingerprint) -> bool
self and other values to be equal, and is used by ==.