pub trait MessageEncrypter: Send + Sync {
// Required methods
fn encrypt(
&mut self,
msg: OutboundPlainMessage<'_>,
seq: u64,
) -> Result<OutboundOpaqueMessage, Error>;
fn encrypted_payload_len(&self, payload_len: usize) -> usize;
}
Expand description
Objects with this trait can encrypt TLS messages.
Required Methods§
Sourcefn encrypt(
&mut self,
msg: OutboundPlainMessage<'_>,
seq: u64,
) -> Result<OutboundOpaqueMessage, Error>
fn encrypt( &mut self, msg: OutboundPlainMessage<'_>, seq: u64, ) -> Result<OutboundOpaqueMessage, Error>
Encrypt the given TLS message msg
, using the sequence number
seq
which can be used to derive a unique Nonce
.
Sourcefn encrypted_payload_len(&self, payload_len: usize) -> usize
fn encrypted_payload_len(&self, payload_len: usize) -> usize
Return the length of the ciphertext that results from encrypting plaintext of
length payload_len