|
Forums -> Security Library Forum
.NET SSL Client creation with Mentalis.org libraries |
|
|
by ProZach [zachg99 at gmail dot com] posted on 2005/06/22 |
|
Ok, I'm sure I'm doing something wrong, i just dont know what. I'm
attemting to create a test client that connects to an existing ssl
server that runs on a socket on an unix server. It uses ssl to encrypt
the connections so I need such functionality in .NET C#.
I'm watching the log file which writes both the connection information
and requests recieved as well as the response data, yet I never see my
request get to the server. I dont see any exceptions either when i run
it. I have the close elsewhere, but when I close the connection still
nothing happens.
url is an instance of the Url class provided in the code examples by
mentalis.org.
Here is my code:
private SecureTcpClient mySecureClient;
private SecureNetworkStream mySecureNetStream;
SecureProtocol sp = SecureProtocol.Tls1 | SecureProtocol.Ssl3;
try
{
SecurityOptions options = new SecurityOptions(sp);
options.Certificate = null;
options.Entity = ConnectionEnd.Client;
options.CommonName = url.Host;
options.VerificationType = CredentialVerification.None;
options.Verifier = null;
options.Flags = SecurityFlags.Default;
options.AllowedAlgorithms = SslAlgorithms.ALL;
mySecureClient = new SecureTcpClient(url.Host, url.Port,options);
}
catch (Exception execpt)
{
MessageBox.Show("Exception occurred while connecting: " +
execpt.ToString());
return;
}
try
{
string request = "Hello";
byte[] reqBytes = Encoding.ASCII.GetBytes(request);
mySecureNetStream = mySecureClient.GetStream();
mySecureNetStream.Write(reqBytes,0,reqBytes.Length);
}
catch (Exception except)
{
MessageBox.Show("Exception occured while sending: " +
except.ToString());
return; |
by Prozach [zach99 at gmail dot com] posted on 2005/06/22 |
|
Oh, and i forgot to mention, i've tried it by implementing a securesocket instead of the securetcpclient and usign that in the constructor for the securenetstream and i get the same results. I see the connection happen on the server side, just no data flows to the server. |
by ProZach [zach99 at gmail dot com] posted on 2005/06/22 |
|
I found the problem, turns out the server although home built socket server on unix, expects the HTTP/POST header. All working well now. |
|
|