The OnixS C++ FIX Engine provides an ability to localize TLS/SSL-related attributes to the bounds of a single FIX Session. Per-session TLS/SSL settings can be accessed, using OnixS::FIX::Session::sslCertificateFile and OnixS::FIX::Session::sslPrivateKeyFile members of the OnixS::FIX::Session class.
- Note
- Per-session TLS/SSL settings are supported only for initiator sessions. Acceptor sessions can work only with global FIX Engine TLS/SSL settings.
Example
const std::string TargetCompID = "CNX";
const std::string
Host =
"TargetHost";
{
const std::string StreamSenderCompID = "str";
const std::string StreamSslCertificateAndPrivateKeyFile = "str.pem";
const int StreamPort = 442;
streamSession.sslCertificateFile(StreamSslCertificateAndPrivateKeyFile)
.sslPrivateKeyFile(StreamSslCertificateAndPrivateKeyFile)
.logonAsInitiator(Host, StreamPort, 30, true);
std::clog << "Stream session is established." << std::endl;
streamSession.logout();
}
{
const std::string TradingSenderCompID = "tr";
const std::string TradingSslCertificateAndPrivateKeyFile = "tr.pem";
const int TradingPort = 443;
tradingSession.sslCertificateFile(TradingSslCertificateAndPrivateKeyFile)
.sslPrivateKeyFile(TradingSslCertificateAndPrivateKeyFile)
.logonAsInitiator(Host, TradingPort, 30, true);
std::clog << "Trading session is established." << std::endl;
tradingSession.logout();
}