Let's break the problem into parts.
Regarding the error RemoteCertificateNameMismatch
, this is due to the fact that the name that must pass AuthenticateAsClient(...)
is the name of the server. That is, if the server is localhost
, you should pass that name this way:
sslStream.AuthenticateAsClient("localhost");
If you are generating your own certificate, you must ensure that the name that passes to AuthenticateAsClient
is the same as that in the "CN = [server name]" option.
For RemoteCertificateChainErrors
, if you are generating your own certificate, the algorithm that validates the certificate may not trust your certificate because it is not in a secure location.
One way to resolve the problem is to install the certificate in the certificate store of your computer or use the following code (source:
11.06.2014 / 16:48