pub struct KemUpgradeProtocol {
pub local: KemConfig,
pub remote: KemConfig,
pub result: KemNegotiationResult,
}Expand description
KEM upgrade protocol: runs after Noise XX handshake completes, before sync streams are opened.
When both peers support ML-KEM-768, the upgrade must complete before any sync stream traffic begins, protecting against store-now-decrypt-later attacks.
Fields§
§local: KemConfigLocal KEM config.
remote: KemConfigRemote KEM config (from WeftHandshake).
result: KemNegotiationResultNegotiation result.
Implementations§
Source§impl KemUpgradeProtocol
impl KemUpgradeProtocol
Sourcepub fn new(local: KemConfig, remote: KemConfig) -> Self
pub fn new(local: KemConfig, remote: KemConfig) -> Self
Create a new KEM upgrade protocol from local and remote configs.
Sourcepub fn requires_upgrade(&self) -> bool
pub fn requires_upgrade(&self) -> bool
Whether sync streams should wait for KEM to complete.
Returns true when both sides support KEM, meaning the
PQ key exchange MUST finish before any sync traffic flows.
Sourcepub fn execute(&self, classical_secret: Vec<u8>) -> HybridKeyExchange
pub fn execute(&self, classical_secret: Vec<u8>) -> HybridKeyExchange
Execute the KEM exchange, combining the classical Noise secret with the post-quantum shared secret (when both sides support it).
In the current placeholder implementation, the PQ secret is derived deterministically from the remote KEM public key. A real implementation would use ML-KEM-768 encapsulate/decapsulate.
Auto Trait Implementations§
impl Freeze for KemUpgradeProtocol
impl RefUnwindSafe for KemUpgradeProtocol
impl Send for KemUpgradeProtocol
impl Sync for KemUpgradeProtocol
impl Unpin for KemUpgradeProtocol
impl UnsafeUnpin for KemUpgradeProtocol
impl UnwindSafe for KemUpgradeProtocol
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more