The message received was unexpected or badly formatted

Hi

Can someone please help?

I’ve created a solution to communication with the MESH API. The development was done using the SANDBOX solution and everything worked well.
Now that I’ve moved to the Integration environment, I am getting the below error. I have altered the Password, MailboxId and Sharekey as instructed\provided, but I’m still getting this error. Does anyone know what I have done wrong or missed?

“Authentication failed because the remote party sent a TLS alert: ‘HandshakeFailure’.” with the inner exception of {“The message received was unexpected or badly formatted.”}.

Thanks

P.S.
The solution is build in C# and is sending\attaching the cert using the below code

 private HttpClient GetHttpClientCertificate()
        {
            if (string.IsNullOrEmpty(_meshClientCertPassword) || string.IsNullOrEmpty(_meshClientCertPassword))
                return new HttpClient();

            var handler = new HttpClientHandler()
            {
                SslProtocols = System.Security.Authentication.SslProtocols.Tls12 | System.Security.Authentication.SslProtocols.Tls13 | System.Security.Authentication.SslProtocols.Tls11,
                UseDefaultCredentials = true
            };

            handler.ClientCertificates.Add(new X509Certificate2(_meshClientCertPath, _meshClientCertPassword));

            return new HttpClient(handler);
        }

Tried with Postman as well, but still no luck. Please can someone help?

Hi Chris.

I assume that you have the client key and cert and the CA chain for the NHS G2 PTL CA. Just to pare it back to basics, are you able to curl the endpoint using those files?

curl -s --cacert ca.pem --cert int.crt --key int.key --header 'accept: application/vnd.mesh.v2+json' https://msg.intspineservices.nhs.uk/messageexchange/endpointlookup/A20047/XML_DISCHARGE 

Many thanks,

Dave