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>>
Trait Implementations§
source§impl<E: Clone + Ecdh, D: Clone + Digest> Clone for NoiseState<E, D>where
E::Pk: Clone,
impl<E: Clone + Ecdh, D: Clone + Digest> Clone for NoiseState<E, D>where
E::Pk: Clone,
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<NoiseState<E, D>> for NoiseState<E, D>where
E::Pk: PartialEq,
impl<E: PartialEq + Ecdh, D: PartialEq + Digest> PartialEq<NoiseState<E, D>> for NoiseState<E, D>where
E::Pk: PartialEq,
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 ==.