pub async fn is_encrypted<'a, R>(reader: &mut R, offset: usize) -> boolwhere
R: Read<'a>,
Expand description
Determines whether a byte slice contains encrypted data at a specified offset.
This function leverages get_encrypted_packet_length
to analyze the provided byte slice, starting
from the given offset, to assess if it contains an encrypted packet according to recognized SSL/TLS,
GMSSL, and DTLS protocols. It effectively serves as a boolean helper to quickly identify encrypted data
without needing to parse or understand the specifics of the encryption protocol.
§Arguments
buffer
- A slice of bytes representing the buffer to be analyzed for encrypted data.offset
- The offset withinbuffer
from which to start the analysis.
§Returns
true
if the data at the specified offset is recognized as an encrypted packet, otherwise false
.
The determination is based on whether get_encrypted_packet_length
returns a packet length greater than 0
or if it encounters an error (e.g., NotEnoughDataError
or NotEncryptedError
), in which case it will
return false
.