82
Views
4
Comments
Solved
Certificate issue HTTP request to https

 

Dears

 I have to consume soap service with certificate i have followed steps of this link 

the certificate i am providing in .p12

i got the below error on certificate

Error

An error occurred while making the HTTP request to https:// **api.client. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server  

UserImage.jpg
_Asif
Solution

Resolved issue by allowing access link from security team.

2022-08-03 04-32-50
Ravi Punjwani

Hi Asif

This could be due to using SSL instead of TLS

https://stackoverflow.com/questions/2013880/wcf-error-this-could-be-due-to-the-fact-that-the-server-certificate-is-not-conf

UserImage.jpg
_Asif

still having same error for this code


public void MssCertificateAuthentication(byte[] ssClientCertificateContent) {
            ISOAPClient client = SoapRequest.GetCurrentClient();

 
            var binding = client.Endpoint.Binding;
            if (ServicePointManager.SecurityProtocol == (SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls))
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;

            if (binding is BasicHttpBinding)
            {
                ((BasicHttpBinding)binding).Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
            }
            else if (binding is CustomBinding)
            {
                var httpsElement = ((CustomBinding)binding).Elements.Find<HttpsTransportBindingElement>();
                if (httpsElement != null)
                {
                    httpsElement.RequireClientCertificate = true;
                }
            }
           
 
            var cert = new X509Certificate2(ssClientCertificateContent);
            client.ClientCredentials.ClientCertificate.Certificate = cert;
        }  


UserImage.jpg
_Asif

The error log in service center

UserImage.jpg
_Asif
Solution

Resolved issue by allowing access link from security team.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.