Struct internet2::NoiseTranscoder
source · [−]pub struct NoiseTranscoder {
pub encryptor: NoiseEncryptor,
pub decryptor: NoiseDecryptor,
}
Expand description
Returned after a successful handshake to encrypt and decrypt communication
with peer nodes. It should not normally be manually instantiated.
Automatically handles key rotation.
For decryption, it is recommended to call decrypt_message_stream
for
automatic buffering.
Fields
encryptor: NoiseEncryptor
decryptor: NoiseDecryptor
Implementations
sourceimpl NoiseTranscoder
impl NoiseTranscoder
sourcepub fn new(
sending_key: [u8; 32],
receiving_key: [u8; 32],
chaining_key: [u8; 32]
) -> Self
pub fn new(
sending_key: [u8; 32],
receiving_key: [u8; 32],
chaining_key: [u8; 32]
) -> Self
Instantiate a new Conduit with specified sending and receiving keys
sourcepub fn encrypt_buf(&mut self, buffer: &[u8]) -> Result<Vec<u8>, Error>
pub fn encrypt_buf(&mut self, buffer: &[u8]) -> Result<Vec<u8>, Error>
Encrypt data to be sent to peer
pub fn read_buf(&mut self, data: &[u8])
sourcepub fn decrypt_single_message(
&mut self,
new_data: Option<&[u8]>
) -> Result<Option<Vec<u8>>, Error>
pub fn decrypt_single_message(
&mut self,
new_data: Option<&[u8]>
) -> Result<Option<Vec<u8>>, Error>
Decrypt a single message. If data containing more than one message has been received, only the first message will be returned, and the rest stored in the internal buffer. If a message pending in the buffer still hasn’t been decrypted, that message will be returned in lieu of anything new, even if new data is provided.
Trait Implementations
sourceimpl Bipolar for NoiseTranscoder
impl Bipolar for NoiseTranscoder
sourceimpl Debug for NoiseTranscoder
impl Debug for NoiseTranscoder
sourceimpl Decrypt for NoiseTranscoder
impl Decrypt for NoiseTranscoder
sourceimpl Encrypt for NoiseTranscoder
impl Encrypt for NoiseTranscoder
sourceimpl Transcode for NoiseTranscoder
impl Transcode for NoiseTranscoder
type Encryptor = NoiseEncryptor
type Decryptor = NoiseDecryptor
Auto Trait Implementations
impl RefUnwindSafe for NoiseTranscoder
impl Send for NoiseTranscoder
impl Sync for NoiseTranscoder
impl Unpin for NoiseTranscoder
impl UnwindSafe for NoiseTranscoder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more