Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify a cipher for an SSL connection in .NET?

Tags:

.net

tcp

ssl

How can I specify a cipher suite to use in an SSL Connections?

I know that Mentalis Seclib got this feature however they don't maintain the project (and there are issues in that library with x64 OSes) as they say .NET Framework 2.0 introduced those features, however I couldn't find a way to do this in .NET Framework 3.5.

To be more specific I want to connect an HTTPS service by using NULL cipher, I would do the same thing with OpenSSL by using the following command:

openssl s_client -connect www.example.com:443 -cipher NULL 

How can I do this in .NET?

Also commercial or commercial friendly licensed library suggestions are welcome as well.

like image 990
dr. evil Avatar asked May 28 '10 20:05

dr. evil


1 Answers

(My previous answer was ill-informed, I did not notice at first that the property I was referring to was read-only.)

In .NET 4, the System.Net.Security.SslStream class supports a new constructor, allowing you to provide an EncryptionPolicy value, which could be NoEncryption. This allows no encryption and request that a NULL cipher be used if the other endpoint can handle a NULL cipher.

Unfortunately this did not exist even in 3.5.


Not really part of the question, but I assume (and this is really for future readers) that you are of course aware of the relevant risks, of using SSL with a NULL cipher? And, the benefits you miss out on?

like image 50
AviD Avatar answered Oct 27 '22 00:10

AviD