pub struct FingerprintKey { /* private fields */ }Expand description
The process-local secret that keys HeaderFingerprints, with the public
epoch that names it.
The key is random, lives in memory only and is zeroed on drop. There is no
Clone, no serde and Debug prints the epoch only. The epoch is not a
proof of anything: two keys may share one, and a fingerprint only verifies
when the key itself reproduces its tag.
Implementations§
Source§impl FingerprintKey
impl FingerprintKey
Sourcepub fn generate() -> Result<Self, Error>
pub fn generate() -> Result<Self, Error>
A fresh key and an independently drawn epoch from the OS generator.
Sourcepub fn from_parts(key: Zeroizing<[u8; 32]>, epoch: [u8; 16]) -> Self
pub fn from_parts(key: Zeroizing<[u8; 32]>, epoch: [u8; 16]) -> Self
Rebuild a key that has to survive a hot upgrade, or a known test key.
Sourcepub fn fingerprint(&self, name: &str, value: &SecretValue) -> HeaderFingerprint
pub fn fingerprint(&self, name: &str, value: &SecretValue) -> HeaderFingerprint
The fingerprint of value as the header name (case-insensitive).
Sourcepub fn verify(
&self,
name: &str,
value: &SecretValue,
fingerprint: &HeaderFingerprint,
) -> bool
pub fn verify( &self, name: &str, value: &SecretValue, fingerprint: &HeaderFingerprint, ) -> bool
Whether fingerprint was issued by this very key for this header and
value. A matching epoch is necessary, never sufficient: the full tag is
checked in constant time.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FingerprintKey
impl RefUnwindSafe for FingerprintKey
impl Send for FingerprintKey
impl Sync for FingerprintKey
impl Unpin for FingerprintKey
impl UnsafeUnpin for FingerprintKey
impl UnwindSafe for FingerprintKey
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more