pub struct QuantumKeyEvolution { /* private fields */ }Expand description
Quantum-resistant key evolution system.
Drop is implemented manually below because VecDeque<[u8; 32]>
and StdRng don’t impl Zeroize in the derive form. The wrapped
QuantumKeyPair and MlKemKeyPair zero themselves on their own
drops; we only need to scrub the history buffer here.
Implementations§
Source§impl QuantumKeyEvolution
impl QuantumKeyEvolution
pub fn new(params: LatticeParams, seed: u64) -> Self
Sourcepub fn new_with_algorithm(
params: LatticeParams,
seed: u64,
algorithm: KemAlgorithm,
) -> Self
pub fn new_with_algorithm( params: LatticeParams, seed: u64, algorithm: KemAlgorithm, ) -> Self
Create with a specific KEM algorithm
Sourcepub fn evolve(&mut self) -> [u8; 32]
pub fn evolve(&mut self) -> [u8; 32]
Evolve the key forward (one-way function)
Uses HKDF to derive a new seed from the current key material, then generates a fresh RLWE keypair that maintains the b=a*s+e invariant.
Sourcepub fn encapsulate(&mut self) -> (Vec<u8>, [u8; 32])
pub fn encapsulate(&mut self) -> (Vec<u8>, [u8; 32])
Encapsulate a shared secret using the current KEM algorithm
Sourcepub fn decapsulate(&self, ciphertext: &[u8]) -> Option<[u8; 32]>
pub fn decapsulate(&self, ciphertext: &[u8]) -> Option<[u8; 32]>
Decapsulate to recover shared secret using the current KEM algorithm
Sourcepub fn get_key_hash(&self) -> [u8; 32]
pub fn get_key_hash(&self) -> [u8; 32]
Get current key hash for synchronization
Sourcepub fn verify_evolution(&self, expected_hash: &[u8; 32]) -> bool
pub fn verify_evolution(&self, expected_hash: &[u8; 32]) -> bool
Verify key chain integrity (constant-time comparison)
Sourcepub fn get_evolution_counter(&self) -> u64
pub fn get_evolution_counter(&self) -> u64
Get evolution counter for synchronization
Sourcepub fn export_public_key(&self) -> Vec<u8> ⓘ
pub fn export_public_key(&self) -> Vec<u8> ⓘ
Export public key for key exchange
Trait Implementations§
Source§impl Clone for QuantumKeyEvolution
impl Clone for QuantumKeyEvolution
Source§fn clone(&self) -> QuantumKeyEvolution
fn clone(&self) -> QuantumKeyEvolution
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more