Struct boring::ssl::SslContext

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

A context object for TLS streams.

Applications commonly configure a single SslContext that is shared by all of its SslStreams.

Implementations§

source§

impl SslContext

source

pub fn builder(method: SslMethod) -> Result<SslContextBuilder, ErrorStack>

Creates a new builder object for an SslContext.

source

pub fn new_ex_index<T>() -> Result<Index<SslContext, T>, ErrorStack>
where T: 'static + Sync + Send,

Returns a new extra data index.

Each invocation of this function is guaranteed to return a distinct index. These can be used to store data in the context that can be retrieved later by callbacks, for example.

This corresponds to SSL_CTX_get_ex_new_index.

source

pub fn ciphers(&self) -> Option<&StackRef<SslCipher>>

Gets the list of supported ciphers for protocols before TLSv1.3.

See ciphers for details on the format

This corresponds to [SSL_CTX_get_ciphers].

Methods from Deref<Target = SslContextRef>§

source

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

Returns the certificate associated with this SslContext, if present.

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.

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 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.

This corresponds to SSL_CTX_add_session.

§Safety

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

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.

This corresponds to SSL_CTX_remove_session.

§Safety

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

source

pub fn session_cache_size(&self) -> u64

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 is_rpk(&self) -> bool

Available on crate feature rpk only.

Returns true if context was created for Raw Public Key verification

Trait Implementations§

source§

impl AsMut<SslContextRef> for SslContext

source§

fn as_mut(&mut self) -> &mut SslContextRef

Converts this type into a mutable reference of the (usually inferred) input type.
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 BorrowMut<SslContextRef> for SslContext

source§

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

Mutably borrows from an owned value. Read more
source§

impl Clone for SslContext

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SslContext

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for SslContext

§

type Target = SslContextRef

The resulting type after dereferencing.
source§

fn deref(&self) -> &SslContextRef

Dereferences the value.
source§

impl DerefMut for SslContext

source§

fn deref_mut(&mut self) -> &mut SslContextRef

Mutably dereferences the value.
source§

impl Drop for SslContext

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl ForeignType for SslContext

§

type CType = ssl_ctx_st

The raw C type.
§

type Ref = SslContextRef

The type representing a reference to this type.
source§

unsafe fn from_ptr(ptr: *mut SSL_CTX) -> SslContext

Constructs an instance of this type from its raw type. Read more
source§

fn as_ptr(&self) -> *mut SSL_CTX

Returns a raw pointer to the wrapped value.
source§

fn into_ptr(self) -> *mut Self::CType

Consumes the wrapper and returns the raw pointer.
source§

impl Send for SslContext

source§

impl Sync for SslContext

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

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

§

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>,

§

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.