TlsException, unexpected message ProtocolCode = 10

0 votes
asked Nov 5 by reedmi1 (120 points)

I have a Windows .Netframework 4.5 app that I am trying to connect to a Python TLS server using a simple TlsClientSocket(). After successfully connecting, I call the socket.Negotiate() function and receive a TlsException with an ProtocolCode of 10 and a message of 'Unexpected Message'

What does this normally imply? I can successfully connect my python server to a python client and negotiate to TLS 1.3 but every time I try it using the Rebex libraries I can only get 1.2 or this error.

Any assistance would be greatly appreciated,
reedmi1

1 Answer

0 votes
answered Nov 5 by renestein (3,990 points)
edited Nov 5 by renestein

Hi reedmi1,
welcome to the Rebex forum.
Could you please send a communication log (DEBUG level) to support@rebex.net?
The log can be created like this.

client.LogWriter = new Rebex.FileLogWriter(@"c:\temp\log.txt", Rebex.LogLevel.Debug);

https://www.rebex.net/kb/logging/

commented Nov 5 by reedmi1 (120 points)
Thanks.  I sent everything you asked for and more to that email.
commented Nov 5 by renestein (3,990 points)
Thanks, I can confirm that we have received your message.
commented Nov 5 by reedmi1 (120 points)
Thanks.  I got your second email and replied with everything you asked for.  :)
commented Nov 5 by renestein (3,990 points)
Thanks. I already sent the answer to your address, and I hope that the mystery is solved. ;)
commented Nov 8 by renestein (3,990 points)
For other visitors of the Rebex forum.  Reedmi1 confirmed that the problem is solved.
The problem was caused by the doubled TLS negotiation. One TLS handshake was initiated by the instance of the TlsSocket and then independent instance of the TlsStream had started the second handshake. Both TlsStream and TlsSocket instances were initialized using the same (reference equals) instance of the .NET socket in their constructors.
...