Version: 1.1.1.0
Easily add SSL security and authentication to your Internet application in .NET. Includes components for TCP, Server, UDP, DNS, Ping, and Trace (trace route).
That any Microsoft certificate store can be easily accessed?
The CertificateStore object makes for easy access and selection of certificates contained in Microsoft certificate stores.
Code Sample:
//Show all certificates in the CurrentUser/MY Store
CertificateStore store = new CertificateStore(CertificateStoreLocation.CurrentUser, CertificateStoreName.My);
foreach (Certificate certificate in store)
    Debug.WriteLine(certificate.IssuedTo + ": " + certificate.IssuerName);
Back to Top
That the certificate received from a server can be examined?
During the secure handshake, the Certificate Received event will fire, providing the user with information about the server’s certificate, as well as an opportunity to accept or reject the certificate, if desired.
Code Sample:
//The certificate received event will fire when the component receives the server's certificate
private void myObject1_CertificateReceived(object sender, CertificateReceivedEventArgs e) 
{ 
    //Examine who the certificate was issued to, and whether its date is valid
    if (e.Certificate.IssuedTo == "MyPrivateServer" && e.ValidDate == true)
        e.Accept = true;
    else
        e.Accept = false; 
}
Back to Top
That the secure components can programmatically decide whether to accept a server certificate?
The secure components include a CertificateReceived event, which will fire when a certificate is received from a remote host. Code can be added to the event handler to programmatically determine whether a certificate should be accepted or not.
Code Sample:
private void myComponent_CertificateReceived(object sender, CertificateReceivedEventArgs e) 
{ 
    string msg = ""; 

    // Check to see if the certificate is from a trusted root. 
    if(!e.TrustedRoot) 
        msg += "This certificate is not from a trusted root\n"; 

    // Check to see if the certificate has a valid date. 
    if(!e.ValidDate) 
        msg += "This certificate does not have a valid date\n"; 

    // Check to see if the certificate has a valid name. 
    if(!e.ValidName) 
        msg += "This certificate does not have a valid name\n"; 

    if(msg != "") 
    { 
        msg += "Would you like to accept this certificate anyway?"; 
        if(MessageBox.Show(msg, "Invalid Cert Received", MessageBoxButtons.YesNo) == DialogResult.Yes) 
        { 
            // User wants to accept the invalid cert. Accept it. 
            e.Accept = true; 
        } 
    } 
}
Back to Top
That a component’s security can be enabled by setting a single property?
Simply setting the Security property allows the component to communicate with secure servers.
Code Sample:
// The component will be able to connect to an implicitly secure server
myComponent.Security = Security.Implicit;


Back to Top
That all the data sent and received between the client and the server is visible in a Trace event?
The Trace event is a handy tool for debugging applications. It will fire whenever the component sends or receives data, and is perfect for adding logging capabilities to your application.
Code Sample:
private void myComponent_Trace(object sender, SegmentEventArgs e) 
{ 
    // Append data to a file
    System.IO.FileStream file = new System.IO.FileStream("c:\\Test\\log.txt", System.IO.FileMode.Append); 
    file.Write(e.Segment.Buffer, 0, e.Segment.Count); 
    file.Close(); 
}
Back to Top
That every connection to the Server component is on a separate thread?
Each connection is handled by a Tcp object executing on its own thread, allowing the construction of truly multi-threaded server applications.
Code Sample:
private void button1_Click(object sender, System.EventArgs e)
{
    //When the button is pressed
    //Start starts listening on port 7 (default for an echo server)
    server1.Listen(7);
}

private void server1_Connection(object sender, ConnectionEventArgs e)
{
    //Execution of a very simple echo server
    //This loop is performed on its own worker thread, 
    //so the server can handle many connections
    Segment receivedData = e.Tcp.Receive();
    while (e.Tcp.Connected)
    {
        e.Tcp.Send(receivedData.ToString());
        receivedData = e.Tcp.Receive();
    }
}
Back to Top
That the Ping component can not only use the standard ICMP protocol for pinging other computers, but also TCP and UDP?
By simply setting the PingType property, a ping can be tried using ICMP, TCP, or UDP.
Code Sample:
//Try pinging a site using Tcp protocol
ping1.PingType = PingType.TCP;
EchoResult result = ping1.Send("www.dart.com");
MessageBox.Show(result.ToString());
Back to Top
That the Tcp and Server components can switch from non-secure to secure mode after a non-secure connection has been established?
The Tcp component can initially connect non-securely, and then switch to secure mode for an explicitly secure connection. To accomplish this, set the Security property after the connection has been established.
Code Sample:
//Connect non-securely
tcp1.SecureProtocol = SecureProtocol.None;
tcp1.Connect("mySecureFtpServer", 21);

//Receive the Secure Ftp server's greeting
bool found = false;
tcp1.Stream.Read("\r\n", 1024, ref found);

//Tell the server to switch to SSL and receive response
tcp1.Send("AUTH SSL\r\n");
tcp1.Stream.Read("\r\n", 1024, ref found);

//Switch to secure mode
tcp1.UseAuthentication = false; //always accept certificate in this demo
tcp1.SecureProtocol = SecureProtocol.Auto;

//Send the Ftp server the USER command and receive response
tcp1.Send("USER test\r\n");
tcp1.Stream.Read("\r\n", 1024, ref found);
Back to Top
That the Tcp component can easily read data from a server until a delimiter is found?
An enhanced Tcp.Stream object is exposed on the component, providing higher level streaming capabilities such as searching for a delimiter.
Code Sample:
//Connect to a POP server, and examine its greeting message
tcp1.Connect("mail", 110); //POP servers use port 110
tcp1.ReceiveTimeout = 10000;

//Read the first 1024 bytes returned, stopping when a CRLF is found
//The Tcp.Stream property provides this capability
bool found = false;
string greeting = tcp1.Stream.Read("\r\n", 1024, ref found);
tcp1.Close();
			
if (found == true)
    MessageBox.Show(greeting);
else
    MessageBox.Show("No greeting was found");
Back to Top
That authentication can be turned off, enabling the client or server to accept any certificate, regardless of validity?
When the component receives a certificate from the remote host, the CertificateReceived event will fire, providing validity information about the certificate. The certificate can be accepted or not programmatically when this event fires. Alternatively, to accept the certificate in all cases, the UseAuthentication property can be set to false.
Code Sample:
//Automatically accept the server's certificate always 
tcp1.UseAuthentication = false;
Back to Top