⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

TlsConnection

Struct TlsConnection 

Source
pub struct TlsConnection {
    pub early_data: EarlyDataState,
    pub last_alert: Option<TlsAlert>,
    /* private fields */
}
Expand description

TLS 1.3 connection state

Fields§

§early_data: EarlyDataState

Early data state

§last_alert: Option<TlsAlert>

Last alert received

Implementations§

Source§

impl TlsConnection

Source

pub fn new() -> Self

Create a new TLS connection (client mode)

Source

pub fn connect(&mut self, random: [u8; 32]) -> Result<Vec<u8>, TlsError>

Initiate the TLS handshake. Returns the ClientHello record to send.

Source

pub fn process_incoming(&mut self, data: &[u8]) -> Result<Vec<u8>, TlsError>

Process incoming data from the peer. Returns any response records to send.

Source

pub fn send(&mut self, data: &[u8]) -> Result<Vec<u8>, TlsError>

Send application data. Returns the encrypted record to transmit.

Source

pub fn recv(&mut self, buf: &mut [u8]) -> Result<usize, TlsError>

Read received application data from the internal buffer

Source

pub fn close(&mut self) -> Result<Vec<u8>, TlsError>

Close the TLS connection. Returns a close_notify alert record to send.

Source

pub fn state(&self) -> HandshakeState

Get the current handshake state

Source

pub fn is_connected(&self) -> bool

Check if the connection is established

Source

pub fn cipher_suite(&self) -> Option<CipherSuite>

Get the negotiated cipher suite

Source

pub fn session_ticket_count(&self) -> usize

Get the number of stored session tickets

Trait Implementations§

Source§

impl Default for TlsConnection

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for TlsConnection

§

impl RefUnwindSafe for TlsConnection

§

impl Send for TlsConnection

§

impl Sync for TlsConnection

§

impl Unpin for TlsConnection

§

impl UnwindSafe for TlsConnection

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.