Module sequoia_openpgp::packet::signature::cache

source ·
Expand description

A signature verification cache.

Signature verification is expensive. To mitigate this, Sequoia includes a signature verification cache. This is keyed on the hash of the signature’s context: the signature MPIs, the computed hash, and the key. Since this context is needed to use the cache, it’s hard to misuse the cache.

The signature cache also supports dumping and restoring the cache from disk (see SignatureVerificationCache::restore and SignatureVerificationCache::dump). This is particularly useful for one-shot programs, which don’t have enough time to warm the cache up.

The cache file needs to be managed carefully. In particular, you probably don’t want to allow it to grow without bound. To help manage the cache, the cache keeps track of whether an entry was added (Entry::inserted), and whether it was accessed (Entry::accessed).

Structs§