The OnixS C++ FIX Engine provides an ability to localize SSL-related attributes to the bounds of a single FIX Session. Per-session SSL settings can be accessed using OnixS::FIX::Session::setSslCertificateFile and OnixS::FIX::Session::setSslPrivateKeyFile members of the OnixS::FIX::Session class.
const string targetCompID = "CNX"; const string host = "TargetHost"; // Stream FIX Session. { const string streamSenderCompID = "str"; const string streamSslCertificateAndPrivateKeyFile = "str.pem"; ISessionListener listener; Session streamSession(streamSenderCompID, targetCompID, FIX_42, &listener); streamSession.setEncryptionMethod(Session::SSL); // If your counterparty performs the verification of your SSL certificate // you need to set both SSL Certificate File and SSL Private Key File. streamSession.setSslCertificateFile(streamSslCertificateAndPrivateKeyFile); streamSession.setSslPrivateKeyFile(streamSslCertificateAndPrivateKeyFile); const int streamPort = 442; streamSession.logonAsInitiator(host, streamPort, 30, true); std::clog << "Stream session is established." << std::endl; streamSession.logout(); } // Trading FIX Session. { const string tradingSenderCompID = "tr"; const string tradingSslCertificateAndPrivateKeyFile = "tr.pem"; ISessionListener listener; Session tradingSession(tradingSenderCompID, targetCompID, FIX_42, &listener); tradingSession.setEncryptionMethod(Session::SSL); // If your counterparty performs the verification of your SSL certificate // you need to set both SSL Certificate File and SSL Private Key File. tradingSession.setSslCertificateFile(tradingSslCertificateAndPrivateKeyFile); tradingSession.setSslPrivateKeyFile(tradingSslCertificateAndPrivateKeyFile); const int tradingPort = 443; tradingSession.logonAsInitiator(host, tradingPort, 30, true); std::clog << "Trading session is established." << std::endl; tradingSession.logout(); }