tags:

views:

513

answers:

1

LS,

I was planning on writing a wrapper around the System.Net.Sockets.Socket class, because I don't feel like using the SSLStream class because of the negative impact on performance.

I found an article which does exactly what I want, but on Windows Mobile. (Link: Enable SSL for managed socket on windows mobile)

[Edit]

Apparently, there is no non-WinCE equivalent for the SO_SECURE socket option. So I'm wondering, is there an alternative for SslStream that uses raw sockets? Or is the only other way to go to implement most of it myself?

Kind regards,

Matthias Vance

A: 

What are you trying to accomplish? SSL always causes some slowdown, no matter what class or option you use. Of course, you can implement your custom encryption scheme, but you will most likely end up re-inventing SSL. If you don't like how SSLStream is implemented (it's really limited in functionality), you can take SSL/TLS components of SecureBlackbox and use them on top of Socket class of .NET framework. This way you'll be able to get SSL in asynchronous mode etc for both client-side and server-side sockets.

Eugene Mayevski 'EldoS Corp
I didn't mean to say that SSLwould cause the slowdown, but more the use of TcpClient/TcpServer after SslStream. Would it be better to use SslStream in combination with NetworkStream(Socket)?
Matthias Vance
As I understand it, SSLStream requires synchronous mode of the underlying socket. This is not always handy and in some usage scenarios (where asynchronous socket is prefered) would slow down operations. I don't think that TCpClient is much better or much worse than Socket class. For me it's just another view of the same egg.
Eugene Mayevski 'EldoS Corp
I think the only way to do this is to implement my own SSLSocket class. That's basically reinventing the wheel, but this is really a step I want to take. Your answer really helped me think everything through and test different scenarios.
Matthias Vance