0 votes
by (150 points)
edited

I have a server side program that I want to protect with TLS. To do this I am creating a TlsSocket from a standard C# socket created by Socket.EndAccept:

tlsSocket = new TlsSocket(acceptedSocket);  
tlsSocket.Parameters.AllowedSuites = TlsCipherSuite.Secure;  
tlsSocket.Parameters.CertificatePolicy = TlsCertificatePolicy.NoClientCertificate;  
tlsSocket.Parameters.Certificate = CertificateChain.BuildFrom(serverCert);  
tlsSocket.Parameters.CommonName = "192.168.1.16";  
tlsSocket.Parameters.Entity = TlsConnectionEnd.Server;  
tlsSocket.Negotiate();

The Negotiate call throws a TlsException:

Rebex.Net.TlsException: This session was already added into session cache. --->   System.ArgumentException: This session was already added into session cache.  
   at Rebex.Net.TlsSession.uAZzG(String , TlsSession )  
   at wWGvS.AsKBXeZ.ByBAdgZ(Byte[] , Int32 , Int32 , cEEfuOZ )  
   at wWGvS.AsKBXeZ.OnHandshakeReceived(Byte[] buffer, Int32 offset, Int32 count)  
   at wWGvS.ckSCApZ.CzzDw(Byte[] , Int32 , Int32 )  
   at wWGvS.ckSCApZ.cDtmAOZ()  
   --- End of inner exception stack trace ---  
   at wWGvS.ckSCApZ.cDtmAOZ()  
   at wWGvS.ckSCApZ.ArwjUr()  
   at Rebex.Net.TlsSocket.Negotiate()

If I don't call Negotiate then the socket works fine and I can send and receive data (just insecurely). I have tried messing around with the Session Property of the parameters without success.

What I am missing?

1 Answer

0 votes
by (148k points)
edited
 
Best answer

Update: This was fixed in 2012 R3, disabling the session cache is no longer needed.


Thanks for reporting this issue, we will look into it.

In the meantime, please try disabling session caching by adding the following line:

tlsSocket.Parameters.Options |= TlsOptions.DoNotCacheSessions;

Does it work then?

by (150 points)
edited

Thanks for that, I didn't notice that option.

...