pub struct Confirmation { /* private fields */ }
Expand description
Key confirmation message used during the handshake.
This struct contains cryptographic proof that a party can correctly derive the shared secret from the Diffie-Hellman exchange. It prevents attacks where an adversary might forward Hello messages without actually knowing the corresponding private keys.
Implementations§
Source§impl Confirmation
impl Confirmation
Sourcepub fn create(
cipher: ChaCha20Poly1305,
transcript: &[u8],
) -> Result<Self, Error>
pub fn create( cipher: ChaCha20Poly1305, transcript: &[u8], ) -> Result<Self, Error>
Create a new Confirmation using the provided cipher and Hello transcript.
The confirmation encrypts the hello transcript to demonstrate knowledge of the shared secret and bind the confirmation to the entire hello exchange.
§Security
To prevent nonce-reuse, the cipher should not be the same cipher used for future encrypted messages, but should be generated from the same shared secret. The function takes ownership of the cipher to help prevent this.
Sourcepub fn verify(
&self,
cipher: ChaCha20Poly1305,
transcript: &[u8],
) -> Result<(), Error>
pub fn verify( &self, cipher: ChaCha20Poly1305, transcript: &[u8], ) -> Result<(), Error>
Verify the Confirmation using the provided cipher and Hello transcript.
Returns Ok(()) if the confirmation is valid, otherwise returns an error.
Trait Implementations§
Source§impl FixedSize for Confirmation
impl FixedSize for Confirmation
Auto Trait Implementations§
impl Freeze for Confirmation
impl RefUnwindSafe for Confirmation
impl Send for Confirmation
impl Sync for Confirmation
impl Unpin for Confirmation
impl UnwindSafe for Confirmation
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> Encode for Twhere
T: Write + EncodeSize,
impl<T> Encode for Twhere
T: Write + EncodeSize,
Source§impl<T> EncodeFixed for T
impl<T> EncodeFixed for T
Source§impl<T> EncodeSize for Twhere
T: FixedSize,
impl<T> EncodeSize for Twhere
T: FixedSize,
Source§fn encode_size(&self) -> usize
fn encode_size(&self) -> usize
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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