Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac OS : PlatformNotSupportedException while doing certificate custom validation callback with WebSocketSharp at client side in a console application #3

Open
vyomdixit19 opened this issue Jan 31, 2018 · 1 comment

Comments

@vyomdixit19
Copy link

vyomdixit19 commented Jan 31, 2018

Hi All,

   We have used WebSocketSharp Core library in our .netcore console application. We are also doing SSL handshaking and cert authentication/validation using WebSocket class SslConfiguration property - ServerCertificateValidationCallback assignment.

Code Block for Reference :

Securty.cs

public static bool ServerCertificateCustomValidation(object prmSender, X509Certificate prmCertificate, X509Chain prmChain, SslPolicyErrors prmSslPolicyErrors)
{
// for testing purpose..for signed CSR.
return true;
}

Usage :

          var uriBuilder = new UriBuilder("ws" + (prmIsSecure ? "s" : ""), prmUri);

            var objWsClient = new WebSocket(uriBuilder.Uri.AbsoluteUri)
            {
                SslConfiguration =
                {
                    EnabledSslProtocols = SslProtocols.Tls12,
                    ServerCertificateValidationCallback = Security.ServerCertificateCustomValidation,
                },
                EnableRedirection = true
            };

We are facing error while running published copy executable on Mac Sierra ( osx.10.12-x64).

Exception Detail :

Unhandled Exception: System.AggregateException: One or more errors occurred. (The handler does not support client authentication certificates with this combination of libcurl (7.54.0) and its SSL backend ("LibreSSL/2.0.20").) ---> System.PlatformNotSupportedException: The handler does not support client authentication certificates with this combination of libcurl (7.54.0) and its SSL backend ("LibreSSL/2.0.20").
at System.Net.Http.CurlHandler.SslProvider.SetSslOptions(EasyRequest easy, ClientCertificateOption clientCertOption)
at System.Net.Http.CurlHandler.EasyRequest.InitializeCurl()
at System.Net.Http.CurlHandler.MultiAgent.ActivateNewRequest(EasyRequest easy)
--- End of stack trace ---

@vyomdixit19
Copy link
Author

For HttpClient , we are able to resolve this issue using following statement -

httpClientHandler.ServerCertificateCustomValidationCallback += HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;

By using "DangerousAcceptAnyServerCertificateValidator" callback assignment on HttpClientHandler. Issue is resolved on MAC for HttpClient. But for WebSocket, it still exists. Is there any same work around for the WebSocket as well like HttpClient ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant