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
1
vote
2 answers

C# Read from SslStream continuously (long connection, last for up to days) and Efficiently without infinite loop

I am completely new to C#, and need to encrypt the data sent and received between client and server, after googled it for two days, learnt the best way is to use SslStream, some answers I found give good examples but they all somehow assume we just…
Qiu Zhou
  • 1,235
  • 8
  • 12
1
vote
1 answer

Why won't SslStream send my client certificate?

I have been trying to get this to work for many hours now, but I can't find any information on what is going wrong. Stepping through my code, I eventually reach a part like like this: clientCerts = new X509CertificateCollection(new[] { as…
borrrden
  • 33,256
  • 8
  • 74
  • 109
1
vote
0 answers

This operation is only allowed using a successfully authenticated context

I want to make client-server application with tcp encryption, but i have error when i try to send any message: This operation is only allowed using a successfully authenticated context. I already have: Certificate = new…
1
vote
1 answer

How to get port number from sslstream in C#

I would like to get the portnumber from a sslstream in C#. When you have TcpClient you can extract this like: TcpClient client = listener.AcceptTcpClient(); var endpoint = ((IPEndPoint)client.Client.RemoteEndPoint);
1
vote
1 answer

Can't compile code with two ssl_stream that wrap different next layers

I want to understand why when creating two ssl_streams wrapping different objects for the tcp layer, I get the following compilation errors: ------ Build started: Project: test, Configuration: Debug x64 ------ >Microsoft (R) C/C++ Optimizing…
parean
  • 305
  • 3
  • 13
1
vote
0 answers

Can not handle servername indication with openssl library from server

I've develepted some windows server side socket in c and want to add sni server name indication to support sni but servername callback never called and cant get servername is there any suggestion? I've defined some functions for initializing ssl…
Reza Akraminejad
  • 1,412
  • 3
  • 24
  • 38
1
vote
1 answer

Root Certificate Pinning in C#/.NET

I want to implement certificate/public key pinning in my C# application. I already saw a lot of solutions that pin the certificate of the server directly as e.g. in this question. However, to be more flexible I want to pin the root certificate only.…
PraMiD
  • 162
  • 2
  • 15
1
vote
0 answers

sslStream.AuthenticateAsClientAsync does not accepts client certificate

I am trying to use SslStream to establish TLS connection to server. When I don't provide the certificate, everything is working as expected. However when I try to use self signed client certificate with same server, it does not works. When I use…
Yulian Oifa
  • 111
  • 7
1
vote
1 answer

Stuck on AuthenticateAsServer method in mitm https proxy

I'm trying to write a simple https mitm proxy, and the problem arises when I handle the request: public async Task Run(NetworkStream client, NetworkStream host) { try { //getting the cert var certificate = new…
Original
  • 11
  • 3
1
vote
1 answer

client and server cannot communicate, because they do not possess a common algorithm - SSLStream

There are lot of similar questions already answered and none of the answers help my current scenario. In the windows service we have TCPL SSL stream and client connecting to the stream. I have created a .NET Client and am able to access the server…
Peru
  • 2,871
  • 5
  • 37
  • 66
1
vote
1 answer

SslStream.AuthenticateAsClient is not working

I'm trying to connect to an https server using the SslStream class (the server uses a trusted root certificate), but when i use the SslStream.AuthenticateAsClient(String, X509CertificateCollection, SslProtocols, Boolean), the program stands there…
A. Maccanti
  • 25
  • 1
  • 7
1
vote
0 answers

Big delay on SSL Connection before "Enumerating security packages" stage

I have C# tcp client (using .NET Framework 4.0) based on this MSDN article. Like that: _tcp = new TcpClient(_host, _port); NetworkStream ns = _tcp.GetStream(); sslStream = new SslStream( ns, true, new…
1
vote
1 answer

XMPP TLS connection with SslStream

I am trying to create a simple xmpp client that connects to Gtalk. The first part of the handshake seems to work. Ror the TLS handshake I created a client SslStream, connected to the intended server (talk.google.com) and successfully got…
Marcom
  • 4,621
  • 8
  • 54
  • 78
1
vote
1 answer

.Net SslStream works normally in desktop but not in session 0 (Windows Service Session)

I have this code, which establishes a SSL encrypted Stream to a server over TCP: var client = new TcpClient(host, port); var stream = new SslStream(client.GetStream(), false, ValidateServerCertificate); var clientCertificates = new…
Rojan Gh.
  • 1,062
  • 1
  • 9
  • 32
1
vote
2 answers

How do I disable encryption with the SslStream class?

I'm connecting to an FTPS server via TLS/SSL using the SslStream class. Everything is going fine. However I need to support a command called "CCC" which basically disables encryption. If I simply…
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607