I want to authenticate users to my WCF service using X509 certificates. I setup my service to use SSL and make all relevant WCF configuration. When I try to consume my service I get the following error:
The remote certificate is invalid according to the validation procedure.
If I take my certificate (self-signed) and add it to the Trusted People, then that error goes away. I believe this means I need to provide my certificate to all (external) consumers of my service. Is there any way around this?
Since we are using a self-signed certificate for dev purposes, I had to override the validation of the certificate. My code was:
if (validateServerCertificate)
{
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(ValidateRemoteCertificate);
}
private static bool ValidateRemoteCertificate(object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors policyErrors)
{
return true;
}