I need to connect to a server using only one cipher - "ADH-RC4-MD5". I'm looking for a generic solution which will enable me to check what cipher the server is using (I'm a provisioning server that acts as a client to many other application servers and need to connect and get data - each time it can be a different server).

The flow I had so far was:

TcpClient tcpClient = new TcpClient(serverName, port);
SslStream sslStream = new SslStream(tcpClient.GetStream(), false, null, null,                EncryptionPolicy.RequireEncryption);
sslStream.AuthenticateAsClient(HostName);

I keep on crash in the AuthenticateAsClient. The reason is that one AS is working only with the mentioned cipher.

I have verified this is the case with the SslScan tool.

I have tried to enter this cipher through the policy editor (gpedit.msc in the command line) but again with no luck.

Basically I'm looking for a way to use this cipher from code dynamically.

I have a working Java code:

sslsocket.setNeedClientAuth(true);
String[] list = new String[1];
list[0] = "ADH-RC4-MD5";
sslsocket.setEnabledCipherSuites(list);

Any idea of c# equivalent ?

c#
Edit
Report