Jump to content

I am desperately trying to figure out how to connect the EMS with the .NET API, when the connection is SSL, but there is no certificate in use, or we want to ignore the cert.


Mark Hartley

Recommended Posts

My company has a Java version of the of our app that uses two properties/methods to accomplish this, com.tibco.tibjms.TibjmsConnectionFactory().setSSLEnableVerifyHost(false) and com.tibco.tibjms.TibjmsConnectionFactory().setSSLEnableVerifyHostName(false). The .NET API does not appear to have these properties/methods. Can anyone give me code samples of how to connect via SSL but not use a cert?

Link to comment
Share on other sites

  • 1 year later...

In .NET, if you're using the TIBCO EMS messaging system, you can use the 'Tibco.EMS.dll' library for EMS connections. To connect via SSL without verifying the host name or certificate, you can set the appropriate properties in the 'Tibco.EMS.ConnectionFactory' class.

Here is an example of how you can achieve this in C#:

 

using System;
using Tibco.EMS; // Make sure to add reference to Tibco.EMS.dll

class Program
{
    static void Main()
    {
        // Set your EMS server URL
        string serverUrl = "tcp://your.ems.server:7222";

        // Create connection factory
        Tibco.EMS.ConnectionFactory factory = new Tibco.EMS.ConnectionFactory(serverUrl);

        // Set SSL properties to disable certificate verification
        factory.SetIntProperty(Tibco.EMS.ConnectionProperty.SSL_TRACE_LEVEL, Tibco.EMS.SSLTraceLevel.DATA);
        factory.SetBoolProperty(Tibco.EMS.ConnectionProperty.SSL_ENABLE_VERIFY_HOST, false);
        factory.SetBoolProperty(Tibco.EMS.ConnectionProperty.SSL_ENABLE_VERIFY_HOSTNAME, false);

        // Create connection
        Tibco.EMS.Connection connection = factory.CreateConnection();

        try
        {
            // Start the connection
            connection.Start();

            // Perform your messaging operations here

        }
        catch (Tibco.EMS.EMSException ex)
        {
            Console.WriteLine($"Error: {ex.Message}");
        }
        finally
        {
            // Close the connection when done
            connection.Close();
        }
    }
}

Make sure to replace ' "tcp://your.ems.server:7222" ' with your actual EMS server URL.

Note that if you disabling SSL verification that can introduces security risks, and it is crucial to understand the implications before using this in a production environment. If possible, it is recommended to use proper SSL certificate validation for secure communication. Disabling SSL verification should be done cautiously and only in scenarios where security constraints allow for it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...