openssl::ssl

Struct SslContextRef

source
pub struct SslContextRef(/* private fields */);
Expand description

Reference to SslContext

Implementations§

source§

impl SslContextRef

source

pub fn certificate(&self) -> Option<&X509Ref>

Returns the certificate associated with this SslContext, if present.

Requires OpenSSL 1.0.2 or LibreSSL 2.7.0 or newer.

This corresponds to SSL_CTX_get0_certificate.

source

pub fn private_key(&self) -> Option<&PKeyRef<Private>>

Returns the private key associated with this SslContext, if present.

Requires OpenSSL 1.0.2 or LibreSSL 3.4.0 or newer.

This corresponds to SSL_CTX_get0_privatekey.

source

pub fn cert_store(&self) -> &X509StoreRef

Returns a shared reference to the certificate store used for verification.

This corresponds to SSL_CTX_get_cert_store.

source

pub fn extra_chain_certs(&self) -> &StackRef<X509>

Returns a shared reference to the stack of certificates making up the chain from the leaf.

This corresponds to SSL_CTX_get_extra_chain_certs.

source

pub fn ex_data<T>(&self, index: Index<SslContext, T>) -> Option<&T>

Returns a reference to the extra data at the specified index.

This corresponds to SSL_CTX_get_ex_data.

source

pub fn max_early_data(&self) -> u32

Gets the maximum amount of early data that will be accepted on incoming connections.

Requires OpenSSL 1.1.1 or LibreSSL 3.4.0 or newer.

This corresponds to SSL_CTX_get_max_early_data.

source

pub unsafe fn add_session(&self, session: &SslSessionRef) -> bool

Adds a session to the context’s cache.

Returns true if the session was successfully added to the cache, and false if it was already present.

§Safety

The caller of this method is responsible for ensuring that the session has never been used with another SslContext than this one.

This corresponds to SSL_CTX_add_session.

source

pub unsafe fn remove_session(&self, session: &SslSessionRef) -> bool

Removes a session from the context’s cache and marks it as non-resumable.

Returns true if the session was successfully found and removed, and false otherwise.

§Safety

The caller of this method is responsible for ensuring that the session has never been used with another SslContext than this one.

This corresponds to SSL_CTX_remove_session.

source

pub fn session_cache_size(&self) -> i64

Returns the context’s session cache size limit.

A value of 0 means that the cache size is unbounded.

This corresponds to SSL_CTX_sess_get_cache_size.

source

pub fn verify_mode(&self) -> SslVerifyMode

Returns the verify mode that was set on this context from SslContextBuilder::set_verify.

This corresponds to SSL_CTX_get_verify_mode.

source

pub fn num_tickets(&self) -> usize

Gets the number of TLS 1.3 session tickets that will be sent to a client after a full handshake.

Requires OpenSSL 1.1.1 or newer.

This corresponds to SSL_CTX_get_num_tickets.

source

pub fn security_level(&self) -> u32

Get the context’s security level, which controls the allowed parameters and algorithms.

Requires OpenSSL 1.1.0 or newer.

This corresponds to SSL_CTX_get_security_level.

Trait Implementations§

source§

impl AsRef<SslContextRef> for SslContext

source§

fn as_ref(&self) -> &SslContextRef

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<SslContextRef> for SslContext

source§

fn borrow(&self) -> &SslContextRef

Immutably borrows from an owned value. Read more
source§

impl ForeignTypeRef for SslContextRef

source§

type CType = SSL_CTX

The raw C type.
source§

unsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self

Constructs a shared instance of this type from its raw type.
source§

unsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self

Constructs a mutable reference of this type from its raw type.
source§

fn as_ptr(&self) -> *mut Self::CType

Returns a raw pointer to the wrapped value.
source§

impl ToOwned for SslContextRef

source§

type Owned = SslContext

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl Send for SslContextRef

source§

impl Sync for SslContextRef

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

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

source§

type Error = Infallible

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

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

Performs the conversion.
source§

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

source§

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

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

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

Performs the conversion.