pub struct TlsConnection {
pub early_data: EarlyDataState,
pub last_alert: Option<TlsAlert>,
/* private fields */
}Expand description
TLS 1.3 connection state
Fields§
§early_data: EarlyDataStateEarly data state
last_alert: Option<TlsAlert>Last alert received
Implementations§
Source§impl TlsConnection
impl TlsConnection
Sourcepub fn connect(&mut self, random: [u8; 32]) -> Result<Vec<u8>, TlsError>
pub fn connect(&mut self, random: [u8; 32]) -> Result<Vec<u8>, TlsError>
Initiate the TLS handshake. Returns the ClientHello record to send.
Sourcepub fn process_incoming(&mut self, data: &[u8]) -> Result<Vec<u8>, TlsError>
pub fn process_incoming(&mut self, data: &[u8]) -> Result<Vec<u8>, TlsError>
Process incoming data from the peer. Returns any response records to send.
Sourcepub fn send(&mut self, data: &[u8]) -> Result<Vec<u8>, TlsError>
pub fn send(&mut self, data: &[u8]) -> Result<Vec<u8>, TlsError>
Send application data. Returns the encrypted record to transmit.
Sourcepub fn recv(&mut self, buf: &mut [u8]) -> Result<usize, TlsError>
pub fn recv(&mut self, buf: &mut [u8]) -> Result<usize, TlsError>
Read received application data from the internal buffer
Sourcepub fn close(&mut self) -> Result<Vec<u8>, TlsError>
pub fn close(&mut self) -> Result<Vec<u8>, TlsError>
Close the TLS connection. Returns a close_notify alert record to send.
Sourcepub fn state(&self) -> HandshakeState
pub fn state(&self) -> HandshakeState
Get the current handshake state
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if the connection is established
Sourcepub fn cipher_suite(&self) -> Option<CipherSuite>
pub fn cipher_suite(&self) -> Option<CipherSuite>
Get the negotiated cipher suite
Sourcepub fn session_ticket_count(&self) -> usize
pub fn session_ticket_count(&self) -> usize
Get the number of stored session tickets