resolve_tls_settings

Function resolve_tls_settings 

Source
pub fn resolve_tls_settings(
    cert_path: Option<String>,
    key_path: Option<String>,
    client_ca_path: Option<String>,
) -> Result<Option<TlsSettings>, TlsError>
Expand description

Resolve TLS settings from the certificate, key and client-CA options.

§Arguments

  • cert_path - PEM certificate chain path, if configured
  • key_path - PEM private key path, if configured
  • client_ca_path - PEM client CA bundle path, if configured

§Returns

Ok(None) when no TLS material is configured — bindcar serves plaintext. Ok(Some(settings)) when the combination is coherent.

§Errors

Returns TlsError::IncompleteKeyPair when exactly one of the certificate and key is set, and TlsError::ClientCaWithoutTls when a client CA is set without a server key pair. Both fail closed rather than serving plaintext.