Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / June 2005

Tip: Looking for answers? Try searching our database.

.NET SSL Client creation with Mentalis.org libraries

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
zachg99@gmail.com - 22 Jun 2005 18:20 GMT
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;
}
zachg99@gmail.com - 22 Jun 2005 20:59 GMT
I found the problem, turns out the server although home built socket
server on unix, expects the HTTP/POST header.  All working well now.
William Stacey [MVP] - 22 Jun 2005 23:16 GMT
As an aside, I think fx2.0 also includes ssl socket class(es).

Signature

William Stacey [MVP]

>I found the problem, turns out the server although home built socket
> server on unix, expects the HTTP/POST header.  All working well now.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.