[rabbitmq-discuss] Problem using SSL in .NET Client

Richard Jefferies richard.jefferies at energyavm.es
Tue Sep 17 10:39:00 BST 2013


Hi Everyone,

I am trying to build a .NET Client to connect to a RabbitMQ server and it requires authentication with a certificate and using SSL.

I have installed:

OpenSSL version 1.0.1
Erlang version 5.10.2
RabbitMQ version 3.1.3
RabbitMQ Dotnet Client version 2.4.1

All of this is installed on Windows XP.

In the RabbitMQ support for SSL page it suggests loading the certificate from the certificate store and setting ConnectionFactory's Ssl.Certs parameter. I am attempting to use code similar to the following, which I found on the internet, to achieve this:

X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);

X509Certificate cert = store.Certificates
                .Find(
                X509FindType.FindByThumbprint,
                "82 3a 7e 85 a1 cf ca 6f 83 29 4b 3b 91 02 4a d7 af 4c 7a 08",
                true
               )
        .OfType<X509Certificate>()
        .First();

oFactory.Ssl.Certs = new X509CertificateCollection(new X509Certificate[] { cert });
oFactory.Ssl.Certs.Add(cert);
oFactory.Ssl.ServerName = "servercertificatename";
oFactory.Ssl.Enabled = true;

The problem is that this code will not compile in Visual Studio because of this line:

oFactory.Ssl.Certs = new X509CertificateCollection(new X509Certificate[] { cert });

The compiler gives an error saying that the Certs property is read only.

I wonder if this is to do with not having the right version of one of the various platforms (OpenSSL, Erlang, RabbitMQ) or perhaps not having installed them in the right order or having missed some necessary configuration step.

I tried to determine if  there is an error in the configuration of OpenSSL by using werl.exe as recommended on RabbitMQ's SSL Troubleshooting page and typing in "ssl:versions()", but this gives no result at all - werl.exe just outputs "1>".

Can anyone see where the problem might be?

Thanks in advance for any help.
Richard



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130917/5b7c1773/attachment.htm>


More information about the rabbitmq-discuss mailing list