# Struct openssl::ssl::SslContextRef [−] [src]

    pub struct SslContextRef(_);

Reference to `SslContext`

## Implementations

### `impl SslContextRef` [src]

#### `pub fn certificate(&self) -> Option<&X509Ref>` [src]

Returns the certificate associated with this `SslContext`, if present.

Requires OpenSSL 1.0.2 or newer.

This corresponds to `SSL_CTX_get0_certificate`.

#### `pub fn private_key(&self) -> Option<&PKeyRef<Private>>` [src]

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

Requires OpenSSL 1.0.2 or newer.

This corresponds to `SSL_CTX_get0_privatekey`.

#### `pub fn cert_store(&self) -> &X509StoreRef` [src]

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

This corresponds to `SSL_CTX_get_cert_store`.

#### `pub fn extra_chain_certs(&self) -> &StackRef<X509>` [src]

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

#### `pub fn ex_data<T>(&self, index: Index<SslContext, T>) -> Option<&T>` [src]

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

This corresponds to `SSL_CTX_get_ex_data`.

#### `pub fn max_early_data(&self) -> u32` [src]

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

Requires OpenSSL 1.1.1 or newer.

This corresponds to `SSL_CTX_get_max_early_data`.

#### `pub unsafe fn add_session(&self, session: &SslSessionRef) -> bool` [src]

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.

#### `pub unsafe fn remove_session(&self, session: &SslSessionRef) -> bool` [src]

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.

#### `pub fn session_cache_size(&self) -> i64` [src]

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

#### `pub fn verify_mode(&self) -> SslVerifyMode` [src]

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

This corresponds to `SSL_CTX_get_verify_mode`.

## Trait Implementations

### `impl AsRef<SslContextRef> for SslContext` [src]

#### `fn as_ref(&self) -> &SslContextRef` [src]

Performs the conversion.

### `impl Borrow<SslContextRef> for SslContext` [src]

#### `fn borrow(&self) -> &SslContextRef` [src]

Immutably borrows from an owned value. Read more

### `impl ForeignTypeRef for SslContextRef` [src]

#### `type CType = SSL_CTX`

The raw C type.

#### `pub unsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self` [src]

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

#### `pub unsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self` [src]

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

#### `pub fn as_ptr(&self) -> *mut Self::CType` [src]

Returns a raw pointer to the wrapped value.

### `impl Send for SslContextRef` [src]

### `impl Sync for SslContextRef` [src]

### `impl ToOwned for SslContextRef` [src]

#### `type Owned = SslContext`

The resulting type after obtaining ownership.

#### `fn to_owned(&self) -> Self::Owned` [src]

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

#### `pub fn clone_into(&self, target: &mut Self::Owned)` [src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into`)

recently added

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

## Auto Trait Implementations

### `impl !RefUnwindSafe for SslContextRef`

### `impl Unpin for SslContextRef`

### `impl UnwindSafe for SslContextRef`

## Blanket Implementations

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<T> From<T> for T` [src]

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

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

The type returned in the event of a conversion error.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.