BobbyDazzler
BobbyDazzler

Reputation: 1203

SSL/TLS WCF Issue

I'm currently working on integrating a third party API to our software. One requirement of this is the use of an OAuth style authentication system over SSL/TLS.

This isn't a problem, and it WAS working for about a day and a half. Then all of a sudden, it starts returning this error to me constantly, even when trying to authenticate.

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

The fact that it was working and now it isn't confuses the bag out of me, and I have no idea where to even begin looking to solve this.

The methods involved are called from our WCF service hosted in an HTTPS environment. We have a valid signed certificate from a provider. Nothing changed in the implementation, it simply stopped working.

Do any of you have any suggestions on why we would get an error like this? I have no idea where to even begin looking.

UPDATE

The certificate exists in the trusted store.

We currently have our website as www.mywebsite.co.uk, with a valid certificate for said website. Our services are located at www.mywebsite.co.uk/Services.

We also use a Windows Service, which consumes the appropriate WCF located at www.mywebsite.co.uk/Services. Could it be the Windows Service that is causing issues? The Windows Service application is located on the hosting server, which is Windows Server 2012.

UPDATE 2

In order to workaround this issue, we've decided to use the method to ignore the certificate validation errors. This code excerpt can be found on a tonne of other articles here, but here it is anyway for any reader.

ServicePointManager.ServerCertificateValidationCallback = (obj, certificate, chain, errors) => true;

UPDATE 3

Okay, after a bit more looking I managed to get these errors from the ServerCertificateValidationCallback. It tells me that there is this error

RemoteCertificateNameMismatch

The server we are trying to access for API calls has an odd web address, that doesn't match the issuer/subject of the certificate. Is this what is throwing it off?

Upvotes: 0

Views: 439

Answers (1)

Warren Dew
Warren Dew

Reputation: 8938

The server we are trying to access for API calls has an odd web address, that doesn't match the issuer/subject of the certificate. Is this what is throwing it off?

Yes, it is. Certificates are validated by checking for a match between the host name you are opening a connection to and the host name(s) identified in the certificate. The host name is the first part of the "web address" - e.g., stackoverflow.com or www.google.com.

Upvotes: 1

Related Questions