Struct tlspuffin::tls::rustls::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>,
}

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

source

pub fn new() -> Self

source

pub fn is_encrypting(&self) -> bool

source

pub fn is_decrypting(&self) -> bool

source

pub fn doing_trial_decryption(&mut self, requested: usize) -> bool

source

pub 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.

source

pub 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.

source

pub fn start_encrypting(&mut self)

Start using the MessageEncrypter previously provided to the previous call to prepare_message_encrypter.

source

pub fn start_decrypting(&mut self)

Start using the MessageDecrypter previously provided to the previous call to prepare_message_decrypter.

source

pub fn set_message_encrypter(&mut self, cipher: Box<dyn MessageEncrypter>)

Set and start using the given MessageEncrypter for future outgoing message encryption.

source

pub fn set_message_decrypter(&mut self, cipher: Box<dyn MessageDecrypter>)

Set and start using the given MessageDecrypter for future incoming message decryption.

source

pub 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.

source

pub fn finish_trial_decryption(&mut self)

source

pub fn wants_close_before_decrypt(&self) -> bool

Return true if the peer appears to getting close to encrypting too many messages with this key.

Perhaps if we send an alert well before their counter wraps, a buggy peer won’t make a terrible mistake here?

Note that there’s no reason to refuse to decrypt: the security failure has already happened.

source

pub fn wants_close_before_encrypt(&self) -> bool

Return true if we are getting close to encrypting too many messages with our encryption key.

source

pub fn encrypt_exhausted(&self) -> bool

Return true if we outright refuse to do anything with the encryption key.

source

pub fn decrypt_incoming( &mut self, encr: OpaqueMessage, ) -> Result<PlainMessage, 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.

source

pub 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.

Trait Implementations§

source§

impl Default for RecordLayer

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsAny for T
where T: 'static,

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<Tail, T> Prepend<T> for Tail

§

type PreprendResult = Tail

The Resulting [TupleList], of an [Prepend::prepend()] call, including the prepended entry.
§

fn prepend(self, value: T) -> (T, <Tail as Prepend<T>>::PreprendResult)

Prepend a value to this tuple, returning a new tuple with prepended value.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> MaybeHasScalabilityMonitor for T

§

impl<T> UnsafeAny for T
where T: Any,