Skip to main content

TLS server

Creating a TLS server for outstation instances is exactly the same process as a TCP server, except that an extra TlsServerConfig is required. For more details about TLS support and the configuration options, check the TLS general information page.

Certificate chain configuration​

let config = TlsServerConfig::full_pki(
Some(domain.to_string()),
ca_cert,
entity_cert,
entity_key,
None, // no password
MinTlsVersion::V12,
)?;

let server = Server::new_tls_server(LinkErrorMode::Close, endpoint, config);

Self-signed certificate configuration​

let config = TlsServerConfig::self_signed(
peer_cert,
entity_cert,
entity_key,
None, // no password
MinTlsVersion::V12,
)?;

let server = Server::new_tls_server(LinkErrorMode::Close, endpoint, config);