Skip to content

SignalR with HTTPS - Invalid Cer #11408

@weirdyang

Description

@weirdyang

If you believe you have an issue that affects the security of the platform please do NOT create an issue and instead email your issue details to secure@microsoft.com. Your report may be eligible for our bug bounty but ONLY if it is reported through email.

Describe the bug

A clear and concise description of what the bug is.

Hi, I'm trying to connect to a server which uses self-signed certificates.
The clients on the tablets are unable to do so, but the clients I deployed on laptops are able to.

This is the error I get when I run my clients on a tablet:

The SSL connection could not be established, see inner exception. --> System.Security.AuthenticationException: The remote certificate is invalid according to the validation procedure

https://stackoverflow.com/questions/48560175/signalr-aspnetcore-unable-to-connect-to-the-remote-server-system-net-webexc
The thread above mentioned .WithWebSocketsOptions, but I am able to access it. What can I do to accept self-signed certificates?

            _connection = new HubConnectionBuilder()
                .WithUrl(_hubRoot, Microsoft.AspNetCore.Http.Connections.HttpTransportType.WebSockets, options =>
                {
                    options.WebSocketConfiguration = sockets =>
                    {
                        sockets.RemoteCertificateValidationCallback += new RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return true; });
                    };
                })
                .Build();

I have tried to do set a RemoteCertificationValidationCallBack, however it did not solve the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions