468,161 Members | 1,946 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,161 developers. It's quick & easy.

sslstream with cipher (TLS_RSA_WITH_AES_128_CBC_SHA)

Hi all,

I want to use the SSLStream with the cipher
(TLS_RSA_WITH_AES_128_CBC_SHA) to get the handshake with my server,
but I not sure where I can start. I do it in C# 2.0

Here is my code:

X509Store store = new X509Store(StoreName.Root,
StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
X509CertificateCollection cert = store.Certificates.Find
(X509FindType.FindBySubjectName, "servertest",false);

// Instantiate a TcpClient with the target server and port number
TcpClient client = new TcpClient(myserverip, 443);
Byte[] sendText = Encoding.ASCII.GetBytes("hello server, message from
client");

RemoteCertificateValidationCallback callback = new
RemoteCertificateValidationCallback(OnCertificateV alidation);

SslStream stream = new SslStream(client.GetStream(), false,
callback);
stream.AuthenticateAsClient(servername, cert, SslProtocols.Tls,
false);

What do I do from here. How does I pass the cipher. How do check to
the handshake from the server. Does the cipher
(TLS_RSA_WITH_AES_128_CBC_SHA) I need to set in my test certificate.
if (stream.IsAuthenticated)
{
// Indicates whether the authentication was
successful.
Console.WriteLine("IsAuthenticated: {0}",
stream.IsAuthenticated);
// Indicates whether both the client and server
has been authenticated.
// In this example only the server is
authenticated.
Console.WriteLine("IsMutuallyAuthenticated: {0}",
stream.IsMutuallyAuthenticated);
// Indicates whether the SslStream uses data
encryption.
Console.WriteLine("IsEncrypted: {0}",
stream.IsEncrypted);
// Indicates whether the data sent is signed.
Console.WriteLine("IsSigned: {0}",
stream.IsSigned);
// Indicates whether the current side of the
connection is authenticated as a server.
Console.WriteLine("IsServer: {0}",
stream.IsServer);
}

Please help. Thanks in advance
Dec 20 '07 #1
0 1871

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jakob Nielsen | last post: by
2 posts views Thread by Julio C. Hernandez Castro | last post: by
1 post views Thread by Chris Mullins | last post: by
reply views Thread by John | last post: by
1 post views Thread by Dubravko Sever | last post: by
3 posts views Thread by =?Utf-8?B?VHJlY2l1cw==?= | last post: by
1 post views Thread by gcdp | last post: by
reply views Thread by gcreed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.