Click here to Skip to main content
15,888,003 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an client/server solution into which I am trying to shoehorn SslStream. Everything looks good to me(obviously), but whenever my callback to BeginAuthenticateAsClient() is called, I get the message "The remote certificate is invalid according to the validation procedure."

Now, I've checked and re-checked my Personal certificate and the Trusted Root Certificate Authority certificate I used to create the Personal certificate that my server code uses. Both of them show as valid, the Personal certificate has a private key and the Personal cert "points" to the Trusted Root certificate. In my server code I open an X509Store to the LocalMachine store, which is where my certs are located. I find the Personal cert and create a local X509Certificate variable (_certificate = new X509Certificate(foundCert.RawData);) In the callback to BeginAuthenticateAsServer(), my call to EndAuthenticateAsServer(result) succeeds. But on the client side (running on the same PC, I might add), my call to EndAuthenticateAsClient(result) returns the error above.

Can someone who has expertise in this area give me some pointers to things I may have done incorrectly, please?
Posted

I'm no expert in this area but I've never had a problem using SSL streams.

Which SslStream constructor are you using? I would suggest using one that takes a RemoteCertificateValidationCallback delegate so you can check any policy errors if you're not already.
 
Share this answer
 
I'm getting the "RemoteCertificateNameMismatch" error. I'm not sure if it's because my test Client is running on the same machine as my test Server, since the local name for the PC is different than what the external DNS entry is (and the CN value I used when I created my test certificate).
 
Share this answer
 
Comments
DaveyM69 22-Nov-10 18:51pm    
Hi Tim, I never got a notification of your post because you added it as an answer instead of a comment!
Did you sort this out? If not, add a comment to my post and I'll help you through it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900