pub struct CertCache { /* private fields */ }Expand description
In-memory certificate cache.
Certificates are just named Data packets — fetching one is a normal NDN Interest. The cache avoids re-fetching recently validated certificates.
Two indices are maintained: by certificate name (the canonical lookup
used when a packet’s KeyLocator carries a Name), and by SHA-256 of
the public key (used when the locator carries a KeyDigest). Both are
populated on insert so callers do not need to know which form a
future verification will use.
Implementations§
Source§impl CertCache
impl CertCache
pub fn new() -> Self
pub fn get(&self, key_name: &Arc<Name>) -> Option<Certificate>
Sourcepub fn get_by_key_digest(&self, digest: &[u8]) -> Option<Certificate>
pub fn get_by_key_digest(&self, digest: &[u8]) -> Option<Certificate>
Look up a certificate by the SHA-256 of its public key — used to
resolve KeyLocator → KeyDigest references. Only matches
certificates already in the cache: KeyDigest cannot be used to
fetch a certificate over the network because the cert’s name is
not known to the caller.
pub fn insert(&self, cert: Certificate)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CertCache
impl !RefUnwindSafe for CertCache
impl Send for CertCache
impl Sync for CertCache
impl Unpin for CertCache
impl UnwindSafe for CertCache
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
Mutably borrows from an owned value. Read more