[rabbitmq-discuss] SSL connection issue from .net client

Paul Smith Paul.Smith at edftrading.com
Fri Apr 13 13:17:26 BST 2012


Hi,

Any help on this problem is greatly appreciated. I am getting an error when I try to connect to a broker on an SSL connection. The error I get is:

RabbitMQ.Client.Exceptions.PossibleAuthenticationFailureException: Possibly caused by authentication failure ---> RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Library, code=0, text="End of stream", classId=0, methodId=0, cause=System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
   at RabbitMQ.Client.Impl.Frame.ReadFrom(NetworkBinaryReader reader)
   at RabbitMQ.Client.Impl.SocketFrameHandler_0_9.ReadFrame()
   at RabbitMQ.Client.Impl.ConnectionBase.MainLoopIteration()
   at RabbitMQ.Client.Impl.ConnectionBase.MainLoop()
   at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply()
   at RabbitMQ.Client.Impl.ModelBase.ConnectionStartOk(IDictionary clientProperties, String mechanism, Byte[] response, String locale)
   at RabbitMQ.Client.Impl.ConnectionBase.StartAndTune()
   --- End of inner exception stack trace ---
   at RabbitMQ.Client.Impl.ConnectionBase.StartAndTune()
   at RabbitMQ.Client.Framing.Impl.v0_9_1.Connection.Open(Boolean insist)
   at RabbitMQ.Client.Impl.ConnectionBase..ctor(ConnectionFactory factory, Boolean insist, IFrameHandler frameHandler)
   at RabbitMQ.Client.Framing.Impl.v0_9_1.Connection..ctor(ConnectionFactory factory, Boolean insist, IFrameHandler frameHandler)
   at RabbitMQ.Client.Framing.Impl.v0_9_1.ProtocolBase.CreateConnection(ConnectionFactory factory, Boolean insist, IFrameHandler frameHandler)
   at RabbitMQ.Client.ConnectionFactory.FollowRedirectChain(Int32 maxRedirects, IDictionary connectionAttempts, IDictionary connectionErrors, AmqpTcpEndpoint[]& mostRecentKnownHosts, AmqpTcpEndpoint endpoint)}

Here is the background:

The AMQP broker/server is hosted on a network external to my network. I am unaware of its implementation (i.e. if its java etc)
They gave me a lot of detail of how to connect to the system from a java application. This includes a test app so that I can test the connection and the intended functionality.
This works correctly when I use the test app (which is in Java) but when I try to simply create the connection from within a .Net client it fails with the above error.

They supplied me a Java Key Store file and a pk12 certifcate and its password. As I said when I use these in Java it works fine.

For my .net implementation, I have followed the client connection example on : http://www.rabbitmq.com/ssl.html

Below is my code:

            RabbitMQ.Client.ConnectionFactory cf = new ConnectionFactory();
            cf.Ssl.ServerName = "remoteserver";
            cf.Ssl.CertPath = "C:\cert\CXAPIT10.p12";
            cf.Ssl.CertPassphrase = "password";
            cf.Ssl.AcceptablePolicyErrors = SslPolicyErrors.RemoteCertificateChainErrors |
                                            SslPolicyErrors.RemoteCertificateNameMismatch |
                                            SslPolicyErrors.RemoteCertificateNotAvailable;

            cf.VirtualHost = @"/blah/cute";
            cf.Port = 5671;
            cf.HostName = "remoteserver";
            cf.Ssl.Enabled = true;
            cf.CreateConnection(); -- error is thrown here

Can you see anything wrong with the above?

An obvious difference between the java code example they gave me and the .net app is that I don't get to use the keystore. I don't know if this is required.
Please note, I have also added an entry to my host file so the ip address that I want to go to is the same as the cn name in the cert.

Any help is greatly appreciated!

Regards,

Paul




________________________________
This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any commodities, financial risk management products, or other physical or financial product or service, an official confirmation of any transaction, or an official statement of EDF Trading Limited, EDF Trading Markets Limited, EDF Trading North America, LLC, or any of the EDF Group family of companies. Any views or opinions presented are solely those of the author and do not necessarily represent those of the foregoing entities. EDF Trading Markets Limited is authorised and regulated by the Financial Services Authority. VAT number: GB 735 5479 07. EDF Trading Markets Limited and EDF Trading North America, LLC are members of the EDF Group of companies. EDF Trading Markets Limited maintains its registered office at 80 Victoria Street, 3rd Floor, Cardinal Place, London, SW1E 5JL. A Company registered in England No. 4255974. EDF Trading North America, LLC is headquartered in the United States at 4700 W. Sam Houston Pkwy., Suite 250, Houston, TX 77041

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120413/824ae9d0/attachment.htm>


More information about the rabbitmq-discuss mailing list