pub struct RetryingDecryptor<D> { /* private fields */ }Expand description
An AeadDecryptor that retries once after a
NoMatchingKey error by calling
try_refresh on the inner decryptor.
It covers cross-server key propagation during rotation (one server seals with a
freshly rotated key another has not loaded yet) and is the cipher analogue of
RetryingVerifier. Wrap the root
decryptor with it so any composition underneath — a
ScheduledRefreshCipher, a
MultiKeyDecryptor, or arbitrary nesting — gets one
retry without implementing it. The retry’s refresh is gated by the inner layer’s
policy, so a burst of unknown-kid bundles cannot force a burst of upstream
fetches.
The retry fires only on NoMatchingKey, so callers must pass a CipherMatch
with a kid and register kids on all keys in the set. A key with no
registered kid can never be ruled out: it falls back to a
ByAlgorithm match, is
attempted, and its authentication failure masks the miss as
Other — no retry fires. Likewise, with no
CipherMatch at all, a stale key set surfaces as an authentication failure
from try-all dispatch, indistinguishable from tampering and deliberately not
retried.
See composing crypto strategies for how this layer (additions) pairs with the scheduled layer (removals).
Implementations§
Source§impl<D: AeadDecryptor> RetryingDecryptor<D>
impl<D: AeadDecryptor> RetryingDecryptor<D>
Trait Implementations§
Source§impl<D: AeadDecryptor> AeadDecryptor for RetryingDecryptor<D>
impl<D: AeadDecryptor> AeadDecryptor for RetryingDecryptor<D>
Source§fn cipher_match(&self, m: &CipherMatch<'_>) -> Option<KeyMatchStrength>
fn cipher_match(&self, m: &CipherMatch<'_>) -> Option<KeyMatchStrength>
Source§fn decrypt<'a>(
&'a self,
cipher_match: Option<&'a CipherMatch<'a>>,
nonce: &'a [u8],
ciphertext: &'a [u8],
tag: &'a [u8],
aad: &'a [u8],
) -> MaybeSendBoxFuture<'a, Result<Vec<u8>, DecryptError>>
fn decrypt<'a>( &'a self, cipher_match: Option<&'a CipherMatch<'a>>, nonce: &'a [u8], ciphertext: &'a [u8], tag: &'a [u8], aad: &'a [u8], ) -> MaybeSendBoxFuture<'a, Result<Vec<u8>, DecryptError>>
Source§fn try_refresh(&self) -> MaybeSendBoxFuture<'_, bool>
fn try_refresh(&self) -> MaybeSendBoxFuture<'_, bool>
JwsVerifier::try_refresh. Read moreSource§impl<D: Clone> Clone for RetryingDecryptor<D>
impl<D: Clone> Clone for RetryingDecryptor<D>
Source§fn clone(&self) -> RetryingDecryptor<D>
fn clone(&self) -> RetryingDecryptor<D>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more