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
- Rust
- C
- C++
- Java
- C#
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);
dnp3_tls_server_config_t config = dnp3_tls_server_config_init(
TLS_DOMAIN,
CA_CHAIN_CA_CERT,
CA_CHAIN_ENTITY_CERT,
CA_CHAIN_ENTITY_KEY,
"" // no password
);
dnp3_outstation_server_t *server = NULL;
dnp3_param_error_t err = dnp3_outstation_server_create_tls_server(runtime, DNP3_LINK_ERROR_MODE_CLOSE, endpoint, config, &server);
// check error
// defaults to CA mode
TlsServerConfig config(
TLS_DOMAIN,
CA_CHAIN_CA_CERT,
CA_CHAIN_ENTITY_CERT,
CA_CHAIN_ENTITY_KEY,
"" // no password
);
auto server = OutstationServer::create_tls_server(runtime, LinkErrorMode::close, endpoint, config);
TlsServerConfig config =
new TlsServerConfig(
"test.com",
CA_CERT,
CA_ENTITY_CERT,
CA_ENTITY_KEY,
"" // no password
);
OutstationServer server = OutstationServer.createTlsServer(runtime, LinkErrorMode.CLOSE, endpoint, config);
var config = new TlsServerConfig(
TlsDomain,
CaCert,
CaEntityCert,
CaEntityKey,
"" // no password
);
var server = OutstationServer.CreateTlsServer(runtime, LinkErrorMode.Close, endpoint, config);
Self-signed certificate configuration
- Rust
- C
- C++
- Java
- C#
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);
dnp3_tls_server_config_t config = dnp3_tls_server_config_init(
TLS_DOMAIN,
SELF_SIGNED_PEER_CERT,
SELF_SIGNED_ENTITY_CERT,
SELF_SIGNED_ENTITY_KEY,
"" // no password
);
config.certificate_mode = DNP3_CERTIFICATE_MODE_SELF_SIGNED;
dnp3_outstation_server_t *server = NULL;
dnp3_param_error_t err = dnp3_outstation_server_create_tls_server(runtime, DNP3_LINK_ERROR_MODE_CLOSE, endpoint, config, &server);
// check error
TlsServerConfig config(
TLS_DOMAIN,
SELF_SIGNED_PEER_CERT,
SELF_SIGNED_ENTITY_CERT,
SELF_SIGNED_ENTITY_KEY,
"" // no password
);
config.certificate_mode = CertificateMode::self_signed;
auto server = OutstationServer::create_tls_server(runtime, LinkErrorMode::close, endpoint, config);
TlsServerConfig config =
new TlsServerConfig(
"test.com",
SELF_SIGNED_PEER_CERT,
SELF_SIGNED_ENTITY_CERT,
SELF_SIGNED_ENTITY_KEY,
"" // no password
).withCertificateMode(CertificateMode.SELF_SIGNED);
OutstationServer server = OutstationServer.createTlsServer(runtime, LinkErrorMode.CLOSE, endpoint, config);
var config = new TlsServerConfig(
TlsDomain,
SelfSignedPeerCert,
SelfSignedEntityCert,
SelfSignedEntityKey,
"" // no password
).WithCertificateMode(CertificateMode.SelfSigned);
var server = OutstationServer.CreateTlsServer(runtime, LinkErrorMode.Close, endpoint, config);