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.

Examples​

Certificate chain configuration​

let config = TlsServerConfig::new(
"test.com",
&Path::new("./certs/ca_chain/ca_cert.pem"),
&Path::new("./certs/ca_chain/entity2_cert.pem"),
&Path::new("./certs/ca_chain/entity2_key.pem"),
None, // no password
MinTlsVersion::V12,
CertificateMode::AuthorityBased,
)?;

let server = Server::new_tls_server(LinkErrorMode::Close, "127.0.0.1:20001".parse()?, config);

Self-signed certificate configuration​

let config = TlsServerConfig::new(
"test.com",
&Path::new("./certs/self_signed/entity1_cert.pem"),
&Path::new("./certs/self_signed/entity2_cert.pem"),
&Path::new("./certs/self_signed/entity2_key.pem"),
None, // no password
MinTlsVersion::V12,
CertificateMode::SelfSigned,
)?;

let server = Server::new_tls_server(LinkErrorMode::Close, "127.0.0.1:20001".parse()?, config);