pub struct InboundOpaqueMessage<'a> {
pub typ: ContentType,
pub version: ProtocolVersion,
pub payload: BorrowedPayload<'a>,
}
Expand description
A TLS frame, named TLSPlaintext in the standard.
This inbound type borrows its encrypted payload from a buffer elsewhere. It is used for joining and is consumed by decryption.
Fields§
§typ: ContentType
§version: ProtocolVersion
§payload: BorrowedPayload<'a>
Implementations§
Source§impl<'a> InboundOpaqueMessage<'a>
impl<'a> InboundOpaqueMessage<'a>
Sourcepub fn new(
typ: ContentType,
version: ProtocolVersion,
payload: &'a mut [u8],
) -> Self
pub fn new( typ: ContentType, version: ProtocolVersion, payload: &'a mut [u8], ) -> Self
Construct a new InboundOpaqueMessage
from constituent fields.
payload
is borrowed.
Sourcepub fn into_plain_message(self) -> InboundPlainMessage<'a>
pub fn into_plain_message(self) -> InboundPlainMessage<'a>
Force conversion into a plaintext message.
This should only be used for messages that are known to be in plaintext. Otherwise, the
InboundOpaqueMessage
should be decrypted into a PlainMessage
using a MessageDecrypter
.
Sourcepub fn into_plain_message_range(
self,
range: Range<usize>,
) -> InboundPlainMessage<'a>
pub fn into_plain_message_range( self, range: Range<usize>, ) -> InboundPlainMessage<'a>
Force conversion into a plaintext message.
range
restricts the resulting message: this function panics if it is out of range for
the underlying message payload.
This should only be used for messages that are known to be in plaintext. Otherwise, the
InboundOpaqueMessage
should be decrypted into a PlainMessage
using a MessageDecrypter
.
Sourcepub fn into_tls13_unpadded_message(
self,
) -> Result<InboundPlainMessage<'a>, Error>
pub fn into_tls13_unpadded_message( self, ) -> Result<InboundPlainMessage<'a>, Error>
For TLS1.3 (only), checks the length msg.payload is valid and removes the padding.
Returns an error if the message (pre-unpadding) is too long, or the padding is invalid, or the message (post-unpadding) is too long.