Struct rustls::internal::record_layer::RecordLayer
source · pub struct RecordLayer {
message_encrypter: Box<dyn MessageEncrypter>,
message_decrypter: Box<dyn MessageDecrypter>,
write_seq: u64,
read_seq: u64,
encrypt_state: DirectionState,
decrypt_state: DirectionState,
trial_decryption_len: Option<usize>,
}
Expand description
Record layer that tracks decryption and encryption keys.
Fields§
§message_encrypter: Box<dyn MessageEncrypter>
§message_decrypter: Box<dyn MessageDecrypter>
§write_seq: u64
§read_seq: u64
§encrypt_state: DirectionState
§decrypt_state: DirectionState
§trial_decryption_len: Option<usize>
Implementations§
source§impl RecordLayer
impl RecordLayer
pub(crate) fn is_encrypting(&self) -> bool
fn doing_trial_decryption(&mut self, requested: usize) -> bool
sourcepub(crate) fn prepare_message_encrypter(
&mut self,
cipher: Box<dyn MessageEncrypter>,
)
pub(crate) fn prepare_message_encrypter( &mut self, cipher: Box<dyn MessageEncrypter>, )
Prepare to use the given MessageEncrypter
for future message encryption.
It is not used until you call start_encrypting
.
sourcepub(crate) fn prepare_message_decrypter(
&mut self,
cipher: Box<dyn MessageDecrypter>,
)
pub(crate) fn prepare_message_decrypter( &mut self, cipher: Box<dyn MessageDecrypter>, )
Prepare to use the given MessageDecrypter
for future message decryption.
It is not used until you call start_decrypting
.
sourcepub(crate) fn start_encrypting(&mut self)
pub(crate) fn start_encrypting(&mut self)
Start using the MessageEncrypter
previously provided to the previous
call to prepare_message_encrypter
.
sourcepub(crate) fn start_decrypting(&mut self)
pub(crate) fn start_decrypting(&mut self)
Start using the MessageDecrypter
previously provided to the previous
call to prepare_message_decrypter
.
sourcepub(crate) fn set_message_encrypter(
&mut self,
cipher: Box<dyn MessageEncrypter>,
)
pub(crate) fn set_message_encrypter( &mut self, cipher: Box<dyn MessageEncrypter>, )
Set and start using the given MessageEncrypter
for future outgoing
message encryption.
sourcepub(crate) fn set_message_decrypter(
&mut self,
cipher: Box<dyn MessageDecrypter>,
)
pub(crate) fn set_message_decrypter( &mut self, cipher: Box<dyn MessageDecrypter>, )
Set and start using the given MessageDecrypter
for future incoming
message decryption.
sourcepub(crate) fn set_message_decrypter_with_trial_decryption(
&mut self,
cipher: Box<dyn MessageDecrypter>,
max_length: usize,
)
pub(crate) fn set_message_decrypter_with_trial_decryption( &mut self, cipher: Box<dyn MessageDecrypter>, max_length: usize, )
Set and start using the given MessageDecrypter
for future incoming
message decryption, and enable “trial decryption” mode for when TLS1.3
0-RTT is attempted but rejected by the server.
pub(crate) fn finish_trial_decryption(&mut self)
sourcepub(crate) fn wants_close_before_encrypt(&self) -> bool
pub(crate) fn wants_close_before_encrypt(&self) -> bool
Return true if we are getting close to encrypting too many messages with our encryption key.
sourcepub(crate) fn encrypt_exhausted(&self) -> bool
pub(crate) fn encrypt_exhausted(&self) -> bool
Return true if we outright refuse to do anything with the encryption key.
sourcepub(crate) fn decrypt_incoming(
&mut self,
encr: OpaqueMessage,
) -> Result<Option<Decrypted>, Error>
pub(crate) fn decrypt_incoming( &mut self, encr: OpaqueMessage, ) -> Result<Option<Decrypted>, Error>
Decrypt a TLS message.
encr
is a decoded message allegedly received from the peer.
If it can be decrypted, its decryption is returned. Otherwise,
an error is returned.
sourcepub(crate) fn encrypt_outgoing(
&mut self,
plain: BorrowedPlainMessage<'_>,
) -> OpaqueMessage
pub(crate) fn encrypt_outgoing( &mut self, plain: BorrowedPlainMessage<'_>, ) -> OpaqueMessage
Encrypt a TLS message.
plain
is a TLS message we’d like to send. This function
panics if the requisite keying material hasn’t been established yet.