Questions tagged [sslstream]

.NET class that provides a stream used for client-server communication that uses TLS/SSL security protocols to authenticate the server and optionally the client.

Documentation: https://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx

231 questions
2
votes
1 answer

Is possible to use self signed certificate for testing on different machines?

I created self signed certificate for test purposes. I used this post: SSLStream example - how do I get certificates that work? I use code on client like this. AuthenticateAsClient("testName", null, SslProtocols.Default, false); and on…
user1711993
  • 271
  • 4
  • 20
2
votes
2 answers

TCP Client through multithreading in C#

I am connecting to Gmail account using TCP client for reading emails. It returns SslStream for the TCP connection. It works fine for single thread environment but performance is very poor in terms of speed. I need to optimize the project so that…
Mayuresh
  • 423
  • 1
  • 6
  • 24
2
votes
0 answers

AuthenticateAsClient doesn't throw Exception when providing invalid Certificate

I created a Server based on a TcpListener. Incoming Connections are beeing handled parallelized using ThreadPool. The Communication occurs mutually authentificated using SslStreams. Currently, when a Client with calls var sslStream = new…
nozzleman
  • 9,529
  • 4
  • 37
  • 58
2
votes
1 answer

SslStream AuthenticateAsServer with optional ClientCertificate

Considering the SslStream.AuthenticateAsServer method, the second parameter clientCertificateRequired: If it is set to true, a client certificate is required. It will throw an exception if not. The client certificate will be available in the…
Stijn Van Antwerpen
  • 1,840
  • 17
  • 42
2
votes
1 answer

SslStream error: Stream was not writable

I'm facing a strange error. Following code is always throwing exception (System.ArgumentException "Stream was not writable"): TcpClient socket = new TcpClient(); socket.Connect("serverIp", serverPort); //wrap networkstream with ssl SslStream…
Diallo
  • 109
  • 1
  • 9
2
votes
2 answers

Raw FTP SSL with C#

I'm trying to understand how SSL works. In my wish to make a small FTP client which supports SSL I've run into some problems: TcpClient FtpConnection = new TcpClient(FtpServer, FtpPort); NetworkStream FtpStream =…
Chuck
  • 125
  • 2
  • 6
2
votes
4 answers

SslStream.AuthenticateAsClient Exception when using iPhone Apple Push Notification Provider (apns-sharp)

I receive the following exception when using the Apple Push Notification Provider (apns-sharp). The push notifications work on my development machine however it will not work within the Rackspace Cloud hosting. I have the exact Rackspace Cloud…
Luke
  • 6,195
  • 11
  • 57
  • 85
2
votes
1 answer

Using SslStream Read Method Hangs on C#

I am trying to read a response from the server using SslStream. The server is Google IMAP and I am using the IMAP commands according to the google documentation. The first time, when I use the AuthenticateAsClient Method, this works, and I can read…
ShayR
  • 169
  • 1
  • 2
  • 10
2
votes
1 answer

How to add unencrypted framing header in front of encrypted payload (using Sslstream)

I am busy implementing ICE-TCP (RFC 6544 https://www.rfc-editor.org/rfc/rfc6544) using C# and .NET Framework 4.5. However, I am facing a very tough issue related to the protocol layering which is as follows. ICE-TCP RFC says: „ICE requires an agent…
Markus
  • 50
  • 1
  • 3
2
votes
1 answer

wrap in ssl stream with sslStream class

when i run this below code, an error occur string host = "www.google.com"; int proxyPort = 443;//443; byte[] buffer = new byte[2048]; int bytes; // Connect socket TcpClient client = new TcpClient(host, proxyPort); …
Kamyar Safari
  • 420
  • 2
  • 9
2
votes
1 answer

How can I connect a C# SSLStream client to an OpenSSL server?

I am currentry writing a C# client (with Mono using SSLStream) for an already existing OpenSSL server written in C++. I know that in theory, they should be able to communicate, but I always get an Exception: Authentication or decryption has…
Tiesselune
  • 1,701
  • 20
  • 27
2
votes
1 answer

Common class between Windows store app and WPF application

I'm developing two applications. One is a windows store app that will run on WinRT and one is a WPF application that will either run on Windows 7 or 8. The two applications are supposed to communicate through an SSL connection (Tcp). I would…
Orestis P.
  • 805
  • 7
  • 27
2
votes
2 answers

Using intermediate certificates with SslStream and X509Certificate2 in a server app

I am working on a .Net server application that uses SslStream to provide its SSL sockets. It works with some clients (such as those based on libcurl), but other clients throw errors due to the lack of the intermediate certificate(s). How can I…
Adam Preble
  • 2,162
  • 17
  • 28
2
votes
1 answer

Using SslStream with IOCP

I have written a TCP server using the Socket class's asynchronous/IOCP methods, BeginSend()/BeginRead()/etc. I would like to add SSL capability using SslStream, but from the interface it looks like Socket and SslStream are not intended to work…
Adam Preble
  • 2,162
  • 17
  • 28
2
votes
2 answers

Detecting SslStream socket disconnection

I am using SslStream on top of NetworkStream that wraps a Socket, how could i detect Socket disconnection at this situation. In another words i want to detect if the remote client closed the connection.
Daniel Eugen
  • 2,712
  • 8
  • 33
  • 56