Skip to main content

TlsConfig

Struct TlsConfig 

Source
pub struct TlsConfig { /* private fields */ }
Expand description

How to reach a TAK Server TLS streaming input (usually port 8089): the CA that signed the server certificate, and your client certificate and key. TAK Server requires the client certificate by default.

TAK hands out .p12 files. Convert them to PEM once with OpenSSL (the default TAK password is often atakatak; OpenSSL 3 needs -legacy for the older encryption TAK uses):

openssl pkcs12 -legacy -in truststore-root.p12 -nokeys -out ca.pem
openssl pkcs12 -legacy -in user.p12 -clcerts -nokeys -out user.pem
openssl pkcs12 -legacy -in user.p12 -nocerts -nodes -out user.key

For anything else (PKCS#12 directly, platform trust stores, custom verification) build a rustls::ClientConfig yourself and use TlsConfig::from_rustls.

Implementations§

Source§

impl TlsConfig

Source

pub fn from_pem( ca: &[u8], client_cert: &[u8], client_key: &[u8], ) -> Result<Self>

From PEM bytes: the CA certificate(s) to trust, your client certificate chain, and its private key (PKCS#8, PKCS#1 or SEC1). The server certificate must name the host you connect to.

Source

pub fn from_pem_files( ca: impl AsRef<Path>, client_cert: impl AsRef<Path>, client_key: impl AsRef<Path>, ) -> Result<Self>

from_pem, reading the three PEM files.

Source

pub fn from_pem_any_name( ca: &[u8], client_cert: &[u8], client_key: &[u8], ) -> Result<Self>

Like from_pem, but a server certificate that does not name the host you dialled is accepted, as long as it chains to ca. Use it when you reach the server by an IP address or an internal name its certificate does not list: rustls (like browsers) does not fall back to the certificate’s common name, and a TAK Server certificate made with only a CN fails the name check. An untrusted, expired or self-signed-by-someone-else certificate still fails.

Source

pub fn from_rustls(config: Arc<ClientConfig>) -> Self

Your own rustls client configuration.

Source

pub fn rustls_config(&self) -> &Arc<ClientConfig> ⓘ

The rustls client configuration in use.

Trait Implementations§

Source§

impl Clone for TlsConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TlsConfig

Source§

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

Formats the value using the given formatter. Read more

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.