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.keyFor anything else (PKCS#12 directly, platform trust stores, custom
verification) build a rustls::ClientConfig yourself and use
TlsConfig::from_rustls.
Implementations§
Source§impl TlsConfig
impl TlsConfig
Sourcepub fn from_pem(
ca: &[u8],
client_cert: &[u8],
client_key: &[u8],
) -> Result<Self>
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.
Sourcepub fn from_pem_files(
ca: impl AsRef<Path>,
client_cert: impl AsRef<Path>,
client_key: impl AsRef<Path>,
) -> Result<Self>
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.
Sourcepub fn from_pem_any_name(
ca: &[u8],
client_cert: &[u8],
client_key: &[u8],
) -> Result<Self>
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.
Sourcepub fn from_rustls(config: Arc<ClientConfig>) -> Self
pub fn from_rustls(config: Arc<ClientConfig>) -> Self
Your own rustls client configuration.
Sourcepub fn rustls_config(&self) -> &Arc<ClientConfig> ⓘ
pub fn rustls_config(&self) -> &Arc<ClientConfig> ⓘ
The rustls client configuration in use.