1

The problem was that SslStream always read 0 bytes because the chrome web browser cannot validate the server's certificate.

Refer to the msdn sample code: https://msdn.microsoft.com/en-us/library/system.net.security.sslstream(v=vs.110).aspx

I created the server side certificate with makecert.exe:

makecert    
    -pe                                     Exportable private key
    -n "CN=Test"                            Subject name
    -ss my                                  Certificate store name
    -sr LocalMachine                        Certificate store location
    -a sha1                                 Signature algorithm
    -sky signature                          Subject key type is for signature purposes
    -r                                      Make a self-signed cert
    "output.cer"                            Output filename

2. I've successfully installed the generated cert file in Local Computer -> Trusted Root Certification Authorities.

  1. Launch the server and access https://localhost from the web browser

When calling the Read method from SslStream (which created based on a network stream), it always return 0 bytes.

Is there any steps missing so as to let the browser talk with the SslStream successfully?

mind1n
  • 1,196
  • 3
  • 15
  • 34

1 Answers1

1

Change CN from test to localhost, then the chrome web browser was able to talk to the sslstream.

mind1n
  • 1,196
  • 3
  • 15
  • 34