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
6
votes
1 answer

SslStream: An unknown error occurred while processing the certificate

I'm trying to establish a TCP connection to a remote server using SslStream and TLS 1.2 protocol. The code is as follows: _tcpClient.Connect(endPoint); var certificate = new X509Certificate2(_settings.CertificateFilePath,…
holdenmcgrohen
  • 1,031
  • 2
  • 9
  • 30
6
votes
1 answer

APN fails with "Authentication failed because the remote party has closed the transport stream"

I am trying to send APN from C# using SslStream.AuthenticateAsClient method by passing server IP, SslProtocols.Tls and X509Certificate2Collection. But I am getting an error message: Authentication failed because remote party has closed the transport…
6
votes
1 answer

TCP protocol instead of SSL/TLS in Wireshark

I am trying to use .NET implementation of SslStream by this tutorial. I did everything like in this article, but I have some question. I downloaded RawCap and captured packets from the localhost, after that I opened dump file(.pcap) using Wireshark,…
konstantin_doncov
  • 2,725
  • 4
  • 40
  • 100
6
votes
2 answers

How to allow a Server to accept both SSL and plain text (insecure) connections?

I am trying to create a server that can accept both secure SSL and insecure plain text connection (for backwards compatibility). My code is almost working except the first transmitted data received from an insecure client loses the first 5 bytes…
Jerren Saunders
  • 1,188
  • 1
  • 8
  • 26
6
votes
1 answer

SslStream client unable to complete handshake with stunnel server

I have a fully operational system where openssl based clients interact with an openssl server. Each client have its own certificate that is validated by the server. Certificates have been generated with openssl (X509, pem). They are self-signed. I…
Philippe A.
  • 2,885
  • 2
  • 28
  • 37
6
votes
1 answer

Packet fragmentation when sending data via SSLStream

When using an SSLStream to send a 'large' chunk of data (1 meg) to a (already authenticated) client, the packet fragmentation / dissasembly I'm seeing is FAR greater than when using a normal NetworkStream. Using an async read on the client (i.e.…
Ive
  • 457
  • 5
  • 19
5
votes
1 answer

Does .NET Core 3 support TLS 1.3

I am using .NET Core 3.0 to make a proxy which support only TLS 1.3, I saw that Tls13 = 12288 is defined in SslProtocols. But during my test it only throws exception "The client and server cannot communicate, because they do not possess a common…
user8882898
5
votes
2 answers

SslStream Authentication fails under LOCAL SYSTEM account

I have this code: string certificateFilePath = @"C:\Users\Administrator\Documents\Certificate.pfx"; string certificateFilePassword = "Some Password Here"; X509Certificate clientCertificate = new X509Certificate(certificateFilePath,…
Rojan Gh.
  • 1,062
  • 1
  • 9
  • 32
5
votes
1 answer

SSL certificate setup for SslStream

I have a situation where I need to generate SSL certificates for clients using SslStream as a server. I know how to do that (makecert.exe), but I run into a problem when trying to ensure that both sides of the connection are…
Ayende Rahien
  • 22,925
  • 1
  • 36
  • 41
5
votes
2 answers

SslStream TcpClient - Received an unexpected EOF or 0 bytes from the transport stream

I'm trying to connect to a server via a SslStream / Tcp Client. Everytime I do I get an exception stating: Received an unexpected EOF or 0 bytes from the transport stream at the AuthenticateAsClient line. I've enabled Trace logging and am getting…
RagtimeWilly
  • 5,265
  • 3
  • 25
  • 41
5
votes
3 answers

SslStream.WriteAsync "The BeginWrite method cannot be called when another write operation is pending"

How to prevent this issue when writing data to the client Asynchronously The BeginWrite method cannot be called when another write operation is pending MYCODE public async void Send(byte[] buffer) { if (buffer == null) return; …
Daniel Eugen
  • 2,712
  • 8
  • 33
  • 56
4
votes
1 answer

SslStream on TCP Server fails to validate client certificate with RemoteCertificateNotAvailable

This question is all about solving a SslPolicyError.RemoteCertificateNotAvailable error. I have developed a TCP Server with SSLStream and a TCP Client for the other end. I authenticate the server with: sslStream.BeginAuthenticateAsServer I…
cdpnet
  • 580
  • 2
  • 7
  • 23
4
votes
1 answer

.NET SslStream: How to extract session key?

I'm writing a desktop application and wish to give users ability to verify network traffic, so they know they are not being abused. My application establishes a TLS connection to servers using .NET's SslStream with the AuthenticateAsClient method.…
fernacolo
  • 7,012
  • 5
  • 40
  • 61
4
votes
0 answers

How to get the requested target host from an SslStream as a server

With this code, for example: private static void OnConnect(IAsyncResult ar) { var clientConnection = listener.EndAcceptTcpClient(ar); listener.BeginAcceptTcpClient(OnConnect, ar.AsyncState); try …
Simoyd
  • 506
  • 4
  • 11
4
votes
2 answers

.NET SslStream is not working

I am trying inialise a tls tunnel with the .net SslStream but after opening the stream I always get the following error: "Unable to read data from the transport connection: An established connection was aborted by the software in your host…
Marcom
  • 4,621
  • 8
  • 54
  • 78
1
2
3
15 16