Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 5th, 2012  |  syntax: None  |  size: 0.72 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. SslStream client unable to complete handshake with stunnel server
  2. X509Certificate cert = new X509Certificate2(filename, password);
  3. X509CertificateCollection certColl = new X509CertificateCollection();
  4. certColl.Add(cert);
  5.        
  6. sslStream.AuthenticateAsClient(serverName);
  7.  
  8. SslStream sslStream = new SslStream(
  9.   client.GetStream(),
  10.   false,
  11.   new RemoteCertificateValidationCallback(ValidateServerCertificate),
  12.   new LocalCertificateSelectionCallback(SelectLocalCertificate));
  13.        
  14. sslStream.AuthenticateAsClient(serverName);
  15.  
  16. sslStream.AuthenticateAsClient(serverName,
  17.   certColl,
  18.   SslProtocols.Tls,
  19.   true);
  20.        
  21. Element certificate is valid: False
  22. Element error status length: 1
  23.        
  24. error 18 at 0 depth lookup:self signed certificate
  25. OK