4

This happens on the sslStream.AuthenticateAsServer(serverCertificate, true, SslProtocols.Default, true); call.

I'm trying to do client authentification. I control both client and server, both are c# via sslstream. When I use a nodejs server, it works perfectly. But I just cant get the serverside to reliably work in c# for some reason. Clearly the ssl authentification needs to wait for the client to choose the client certificate, but apparently this is not a built in feature for c# sslstream class? I already tried doing this before the call, but it still immediately errors out on the call:

enter image description here

I dont mind the security question in IE. That's fine. I'm concerned with the fact how sslstream does not seem to work at all with such a basic szenario.

Error from wcf trace:

System.Net Error: 0 : [7928] Exception in AppDomain#13869071::UnhandledExceptionHandler - Authentication failed because the remote party has closed the transport stream.. at System.Net.Security.SslState.ValidateCreateContext(Boolean isServer, String targetHost, SslProtocols enabledSslProtocols, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, Boolean remoteCertRequired, Boolean checkCertRevocationStatus, Boolean checkCertName) at System.Net.Security.SslStream.AuthenticateAsServer(X509Certificate serverCertificate, Boolean clientCertificateRequired, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)

Blub
  • 13,014
  • 18
  • 75
  • 102
  • may be because of this, not sure how to solve: The revocation function was unable to check revocation for the certificate – Blub Apr 28 '14 at 11:26
  • ok that was it, i disabled clr check. – Blub Apr 28 '14 at 11:28
  • hm no, IE still causes this problem on my serverside. I added the wcf trace – Blub Apr 28 '14 at 12:02
  • ok apparently this is an error that is thrown on any auth error. – Blub Apr 28 '14 at 13:44
  • Possible duplicate of [Authentication failed because remote party has closed the transport stream](https://stackoverflow.com/questions/30664566/authentication-failed-because-remote-party-has-closed-the-transport-stream) – Nisarg Shah Aug 08 '18 at 13:24

1 Answers1

3

Adding the below code helped me overcome the issue (I'm running the app in .NET 4.5.1).

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11;
muruge
  • 4,083
  • 3
  • 38
  • 45