´╗┐ Per-session TLS/SSL Settings : OnixS .NET FIX Engine
forwardSupported Certificates   Table of ContentTroubleshootingforward
Per-session TLS/SSL Settings

OnixS .NET 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 the Ssl property of the Session instance.

Note 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
C#
Engine.Init();

string targetCompID = "CNX";
string host = "TargetHost";

// Stream FIX Session.
{
    string streamSenderCompID = "str";

    Session streamSession = new Session(streamSenderCompID, targetCompID, ProtocolVersion.FIX44);
    streamSession.Encryption = EncryptionMethod.SSL;

    // If your counterparty performs the verification of your TLS/SSL certificate 
    // you need to set both TLS/SSL Certificate File and TLS/SSL Private Key File.

    string streamSslCertificateAndPrivateKeyFile = "str.pem"; 
    streamSession.Ssl.CertificateFile = streamSslCertificateAndPrivateKeyFile;
    streamSession.Ssl.PrivateKeyFile = streamSslCertificateAndPrivateKeyFile;

    int streamPort = 442;
    streamSession.LogonAsInitiator(host, streamPort, 30, true);

    Console.WriteLine("Stream session is established");

    streamSession.Logout();
}

// Trading FIX Session.
{ 
    string tradingSenderCompID = "tr";

    Session tradingSession = new Session(tradingSenderCompID, targetCompID, ProtocolVersion.FIX44);
    tradingSession.Encryption = EncryptionMethod.SSL;

    string tradingSslCertificateAndPrivateKeyFile = "tr.pem";

    // If your counterparty performs the verification of your TLS/SSL certificate 
    // you need to set both TLS/SSL Certificate File and TLS/SSL Private Key File.

    tradingSession.Ssl.CertificateFile = tradingSslCertificateAndPrivateKeyFile;
    tradingSession.Ssl.PrivateKeyFile = tradingSslCertificateAndPrivateKeyFile;

    int tradingPort = 443;
    tradingSession.LogonAsInitiator(host, tradingPort, 30, true);

    Console.WriteLine("Trading session is established");

    tradingSession.Logout();
}