pub struct KeyDerivedDecoy;Expand description
Decoy strategy that produces bytes via BLAKE3’s extendable-output (XOF) mode, seeded by the key and a fresh CSPRNG nonce.
Threat profile. A middle ground between RandomDecoy
and SelfReferenceDecoy:
- The output passes general statistical tests like a CSPRNG would, so
simple entropy/chi-squared distinguishers cannot tell decoy bytes from
RandomDecoyoutput. - Because the seed includes the key, downstream cryptographic analysis that looks for “uniform-random vs. structured” patterns sees the same thing it sees for the real key (which is itself a hashed/derived blob in most modern protocols).
- Less aggressive than
SelfReferenceDecoyfor keys with very non-uniform byte distributions (e.g. DER-encoded RSA keys), but strictly stronger thanRandomDecoy.
Use KeyDerivedDecoy when you want CSPRNG-like output but seeded by the
real key so the resulting profile correlates with it.
§Examples
use key_vault::decoy::{DecoyStrategy, KeyDerivedDecoy};
use key_vault::RawKey;
let key = RawKey::new(b"the key".to_vec());
let decoy = KeyDerivedDecoy.generate(&key, 32).unwrap();
assert_eq!(decoy.len(), 32);Trait Implementations§
Source§impl Clone for KeyDerivedDecoy
impl Clone for KeyDerivedDecoy
Source§fn clone(&self) -> KeyDerivedDecoy
fn clone(&self) -> KeyDerivedDecoy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KeyDerivedDecoy
impl Debug for KeyDerivedDecoy
Source§impl DecoyStrategy for KeyDerivedDecoy
impl DecoyStrategy for KeyDerivedDecoy
Source§impl Default for KeyDerivedDecoy
impl Default for KeyDerivedDecoy
Source§fn default() -> KeyDerivedDecoy
fn default() -> KeyDerivedDecoy
Returns the “default value” for a type. Read more
impl Copy for KeyDerivedDecoy
Auto Trait Implementations§
impl Freeze for KeyDerivedDecoy
impl RefUnwindSafe for KeyDerivedDecoy
impl Send for KeyDerivedDecoy
impl Sync for KeyDerivedDecoy
impl Unpin for KeyDerivedDecoy
impl UnsafeUnpin for KeyDerivedDecoy
impl UnwindSafe for KeyDerivedDecoy
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