I have a self-signed certificate (.cer) file from a third party. I'd like to use that certificate in code to connect to their webservice (over HTTPS), without installing it in my cert store in Windows. Specifically this is so all the other developers on the team won't have to install this cert locally in order for the connection to work for them.
Is there a way to do this in code? It can use either old-fashioned webservice-client code (using wsdl.exe or VS's Add Web Reference) or WCF client code (using svcutil.exe or VS's Add Service Reference) - we haven't nailed down which way we want to go yet.
I've tried:
proxy.ClientCertificates.Add(X509Certificate.CreateFromCertFile(@"d:\temp\mycert.cer"));
with old-school webservice code, no luck - it still fails with Could not establish trust relationship for the SSL/TLS secure channel.
until I actually install the cert in the cert store. Same thing for:
<identity>
<certificate encodedValue="the base64 encoded contents of the file" />
</identity>
in the endpoint in app.config using the WCF client techology.
Thanks