Struct openssl::ssl::SslSession
source · [−]pub struct SslSession(_);
Expand description
An encoded SSL session.
These can be cached to share sessions across connections.
Implementations
sourceimpl SslSession
impl SslSession
sourcepub fn from_der(der: &[u8]) -> Result<SslSession, ErrorStack>
pub fn from_der(der: &[u8]) -> Result<SslSession, ErrorStack>
Deserializes a DER-encoded session structure.
This corresponds to d2i_SSL_SESSION
.
Methods from Deref<Target = SslSessionRef>
sourcepub fn id(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
pub fn id(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Returns the SSL session ID.
This corresponds to SSL_SESSION_get_id
.
sourcepub fn master_key_len(&self) -> usize
pub fn master_key_len(&self) -> usize
Returns the length of the master key.
This corresponds to SSL_SESSION_get_master_key
.
sourcepub fn master_key(&self, buf: &mut [u8]) -> usize
pub fn master_key(&self, buf: &mut [u8]) -> usize
Copies the master key into the provided buffer.
Returns the number of bytes written, or the size of the master key if the buffer is empty.
This corresponds to SSL_SESSION_get_master_key
.
sourcepub fn max_early_data(&self) -> u32
pub fn max_early_data(&self) -> u32
Gets the maximum amount of early data that can be sent on this session.
Requires OpenSSL 1.1.1 or newer.
This corresponds to SSL_SESSION_get_max_early_data
.
sourcepub fn time(&self) -> i64
pub fn time(&self) -> i64
Returns the time at which the session was established, in seconds since the Unix epoch.
This corresponds to SSL_SESSION_get_time
.
sourcepub fn timeout(&self) -> i64
pub fn timeout(&self) -> i64
Returns the sessions timeout, in seconds.
A session older than this time should not be used for session resumption.
This corresponds to SSL_SESSION_get_timeout
.
sourcepub fn protocol_version(&self) -> SslVersion
pub fn protocol_version(&self) -> SslVersion
Returns the session’s TLS protocol version.
Requires OpenSSL 1.1.0 or newer.
This corresponds to SSL_SESSION_get_protocol_version
.
sourcepub fn to_der(&self) -> Result<Vec<u8>, ErrorStack>
pub fn to_der(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the session into a DER-encoded structure.
This corresponds to i2d_SSL_SESSION
.
Trait Implementations
sourceimpl AsRef<SslSessionRef> for SslSession
impl AsRef<SslSessionRef> for SslSession
sourcefn as_ref(&self) -> &SslSessionRef
fn as_ref(&self) -> &SslSessionRef
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Borrow<SslSessionRef> for SslSession
impl Borrow<SslSessionRef> for SslSession
sourcefn borrow(&self) -> &SslSessionRef
fn borrow(&self) -> &SslSessionRef
Immutably borrows from an owned value. Read more
sourceimpl Clone for SslSession
impl Clone for SslSession
sourcefn clone(&self) -> SslSession
fn clone(&self) -> SslSession
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Deref for SslSession
impl Deref for SslSession
type Target = SslSessionRef
type Target = SslSessionRef
The resulting type after dereferencing.
sourcefn deref(&self) -> &SslSessionRef
fn deref(&self) -> &SslSessionRef
Dereferences the value.
sourceimpl DerefMut for SslSession
impl DerefMut for SslSession
sourcefn deref_mut(&mut self) -> &mut SslSessionRef
fn deref_mut(&mut self) -> &mut SslSessionRef
Mutably dereferences the value.
sourceimpl Drop for SslSession
impl Drop for SslSession
sourceimpl ForeignType for SslSession
impl ForeignType for SslSession
type CType = SSL_SESSION
type CType = SSL_SESSION
The raw C type.
type Ref = SslSessionRef
type Ref = SslSessionRef
The type representing a reference to this type.
sourceunsafe fn from_ptr(ptr: *mut SSL_SESSION) -> SslSession
unsafe fn from_ptr(ptr: *mut SSL_SESSION) -> SslSession
Constructs an instance of this type from its raw type.
sourcefn as_ptr(&self) -> *mut SSL_SESSION
fn as_ptr(&self) -> *mut SSL_SESSION
Returns a raw pointer to the wrapped value.
impl Send for SslSession
impl Sync for SslSession
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more