Skip to main content

TlsConfig

Struct TlsConfig 

pub struct TlsConfig {
    pub cert: Vec<CertificateDer<'static>>,
    pub key: PrivateKeyDer<'static>,
    pub client_cert_verifier: Arc<dyn ClientCertVerifier>,
    pub server_cert_verifier: Arc<dyn ServerCertVerifier>,
    /* private fields */
}
Expand description

TLS configuration for both client and server connections Client authentication is always required

Fields§

§cert: Vec<CertificateDer<'static>>

Certificate in DER format

§key: PrivateKeyDer<'static>

Private key in DER format

§client_cert_verifier: Arc<dyn ClientCertVerifier>

Certificate verifier

§server_cert_verifier: Arc<dyn ServerCertVerifier>

Server certificate verifier

Implementations§

§

impl TlsConfig

pub fn new( cert: Vec<CertificateDer<'static>>, key: PrivateKeyDer<'static>, ) -> Self

Create a new TLS configuration from DER-encoded certificate and key data

pub fn from_pem(cert_pem: &[u8], key_pem: &[u8]) -> Result<Self, TlsError>

Create a TLS configuration from PEM-encoded data

pub fn from_pem_files<P: AsRef<Path>>( cert_path: P, key_path: P, ) -> Result<Self, TlsError>

Create a TLS configuration from PEM files

pub fn check_cert_validity_timestamp( cert_pem: &[u8], ts: i64, ) -> Result<bool, TlsError>

Check the certificate time validity for the provided unix timestamp in i64

pub fn cert_expiration_timestamp(cert_pem: &[u8]) -> Result<i64, TlsError>

Return leaf certificate expiration timestamp (unix seconds).

pub fn node_id(&self) -> NodeID

pub fn signing_key(&self) -> Arc<NodeSigningKey>

pub fn client_config(&self) -> Result<Arc<ClientConfig>, TlsError>

Create a client TLS configuration

The certificate will be used for both client authentication and server verification in mutual authentication.

pub fn server_config(&self) -> Result<Arc<ServerConfig>, TlsError>

Create a server TLS configuration with mandatory client authentication

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more