Enum noise::NoiseState
source · pub enum NoiseState<E: Ecdh, D: Digest> {
AwaitWrite(HandshakeState<E, D>),
Handshake(HandshakeState<E, D>),
Active {
sending_cipher: CipherState,
receiving_cipher: CipherState,
handshake_hash: HandshakeHash<D>,
remote_static_pubkey: Option<E::Pk>,
},
}
Variants§
AwaitWrite(HandshakeState<E, D>)
Handshake(HandshakeState<E, D>)
Active
Implementations§
source§impl<E: Ecdh, D: Digest> NoiseState<E, D>
impl<E: Ecdh, D: Digest> NoiseState<E, D>
pub fn initialize<const HASHLEN: usize>( handshake_pattern: HandshakePattern, is_initiator: bool, prologue: &[u8], keyset: Keyset<E> ) -> Self
sourcepub fn advance(&mut self, input: &[u8]) -> Result<Vec<u8>, NoiseError>
pub fn advance(&mut self, input: &[u8]) -> Result<Vec<u8>, NoiseError>
Takes incoming data from the remote peer, advances internal state machine
and returns a data to be sent to the remote peer for the next handshake
act. If the handshake is over, returns an empty vector. On subsequent
calls return NoiseError::HandshakeComplete
error.
pub fn advance_with_payload( &mut self, input: &[u8], payload: &[u8] ) -> Result<(Vec<u8>, Vec<u8>), NoiseError>
sourcepub fn next_read_len(&self) -> usize
pub fn next_read_len(&self) -> usize
Provides information about next message length which should be read from a network stream.
pub fn get_handshake_hash(&self) -> Option<HandshakeHash<D>>
pub fn get_remote_static_key(&self) -> Option<E::Pk>
Trait Implementations§
source§impl<E: Clone + Ecdh, D: Clone + Digest> Clone for NoiseState<E, D>
impl<E: Clone + Ecdh, D: Clone + Digest> Clone for NoiseState<E, D>
source§fn clone(&self) -> NoiseState<E, D>
fn clone(&self) -> NoiseState<E, D>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<E: PartialEq + Ecdh, D: PartialEq + Digest> PartialEq for NoiseState<E, D>
impl<E: PartialEq + Ecdh, D: PartialEq + Digest> PartialEq for NoiseState<E, D>
source§fn eq(&self, other: &NoiseState<E, D>) -> bool
fn eq(&self, other: &NoiseState<E, D>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<E: Eq + Ecdh, D: Eq + Digest> Eq for NoiseState<E, D>
impl<E: Ecdh, D: Digest> StructuralPartialEq for NoiseState<E, D>
Auto Trait Implementations§
impl<E, D> Freeze for NoiseState<E, D>
impl<E, D> RefUnwindSafe for NoiseState<E, D>
impl<E, D> Send for NoiseState<E, D>
impl<E, D> Sync for NoiseState<E, D>
impl<E, D> Unpin for NoiseState<E, D>
impl<E, D> UnwindSafe for NoiseState<E, D>
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