Struct diem_sdk::crypto::noise::NoiseSession
pub struct NoiseSession { /* private fields */ }
Expand description
A NoiseSession is produced after a successful Noise handshake, and can be use to encrypt and decrypt messages to the other peer.
Implementations§
§impl NoiseSession
impl NoiseSession
pub fn new_for_testing() -> NoiseSession
pub fn new_for_testing() -> NoiseSession
create a dummy session with 0 keys
pub fn get_remote_static(&self) -> PublicKey
pub fn get_remote_static(&self) -> PublicKey
obtain remote static public key
pub fn write_message_in_place(
&mut self,
message: &mut [u8]
) -> Result<Vec<u8, Global>, NoiseError>
pub fn write_message_in_place( &mut self, message: &mut [u8] ) -> Result<Vec<u8, Global>, NoiseError>
encrypts a message for the other peers (post-handshake) the function encrypts in place, and returns the authentication tag as result
pub fn read_message_in_place<'a>(
&mut self,
message: &'a mut [u8]
) -> Result<&'a [u8], NoiseError>
pub fn read_message_in_place<'a>( &mut self, message: &'a mut [u8] ) -> Result<&'a [u8], NoiseError>
decrypts a message from the other peer (post-handshake) the function decrypts in place, and returns a subslice without the auth tag