2

What is the difference between SslStream.AuthenticateAsClient and SslStream.AuthenticateAsServer methods?
When should I use what?
I checked many examples. But I can't understand what should be used by client and what should be used by server.

Lasitha Yapa
  • 4,309
  • 8
  • 38
  • 57

1 Answers1

2

AuthenticateAsServer is called from the server process. Both overloads to this method (and its Async sibling) take an X509Certificate object, which is the server authentication certificate.

AuthenticateAsClient is called from the client process. Both overloads to this method (and its Async sibling) take a string, which is the hostname to use for policy matching on the server's authentication certificate.

bartonjs
  • 30,352
  • 2
  • 71
  • 111
  • Still this is too complex for me to understand. Sorry. – Lasitha Yapa Nov 14 '16 at 12:45
  • @LasithaYapa Perhaps I'm misunderstanding your question, then. Maybe it would help if you clarify in the question 1) what you want to do, 2) what parts you understand, and 3) what parts you don't. – bartonjs Nov 15 '16 at 17:06
  • Actually this is what i wanted. I'm going to accept it. What i'm saying is that it's better if you can add more details to simplify understanding. – Lasitha Yapa Nov 16 '16 at 00:48