SSL on TCP Socket, how in .NET 1.1?

Is there a way, using intrinsic .NET framework functionality, to open a TCP
connection over an SSL channel   I'd rather not get into buying libraries,
etc.  Java has the javax.net.ssl.* objects, and I'm not finding an
equivalent in .NET. I looked all over the Internet, but nowhere a pointer/solution can be found. Please note this is a socket connection, not an HTTPS connection. Also, it's about .NET version 1.1.

Any hints/tips/remarks/howto's (if even possible) would be greatly appreciated...


Answer this question

SSL on TCP Socket, how in .NET 1.1?

  • like .net

    Welll it is not super difficult to do some quick coding to do SSL
    on top of Sockets using 1.1. What is the time frame you are looking at
    We could, within sometime, whip up some sample



  • Erik Sorensen

    It looks more complicated than I thought to roll your own SSL client.
    I think you will be better off using a 3rd party component for now -
    or migrate to .NET 2.0

    .NET 2.0 supports full SSL functionality and you can install .ET 2.0 Side by Side
    with .NEt 1.1. Is there a reason you want to stay with .NEt 1.1

  • banksdenise

    Is anybody using Mentalis lib to implement an EPP client to talk with Eurid Willing to share info


  • M1A1

    here you will find a free library wihch supports SSL on .NET 1.1: www.mentalis.org


  • nunodonato

    A great place to start with SSL Stream is to look at the sample provided in the SDK.  Open the 2.0 SDK Documentation and navigate to the following:

    .Net Framework SDK > Samples and Quickstarts > Samples > Technology Samples > Networking Samples > Secure Streams Samples

    This page will provide you with a sample client and server using the SSLStream class as well as samples for another new stream called Negotiate stream.

  • ChrisMcV

    I can assure you that going to 2.0 is the best option. 2.0 is a significantly better product interms of the product features. The Visual studio 2005 is a very easy to use compared to Vs 2003. It has better denugging features. Even if you are
    notepad kind of a person, you will find 2.0 pleasant to work with.

    One thing I would say is that between 1.1 and 2.0 all the core concepts of
    the managed code are preserved so your learning and understanding of 1.1 will
    easily translate to 2.0. You might have to learn some new classes and methods.

    In any case rolling your own SSL on top of sockets is significatly more time
    consuming than using the SSLStream classes in 2.0. In fact within about 10 lines of code you have the SSL Sockets working. No kidding.


  • mark_hykurama

    In 1.1 there is no way to do SSL over Sockets.
    Sorry.



  • Alex Jauch

    And the best part of all this is that the 2.0 framework and SDK are free like 1.1
    If you have a reasonable editor or even notepad you can move to 2.0 without having to spend a penny. Of course you can send me $100 for gicing you the suggestion. You are welcome.

  • timg_msft

    Also based on the discussion above, I decided to develop an EPP client synch with the EURid using .NET v2. I haven't started with it yet; that'll be start 2006. .NET v2 support SSL sockets out of the box. So you can learn Mentalis, or immediately .NET 2 supporting SSL. I chose the latter.
  • Tweek

    .NET v2 is a great way to start the EPP project. It does not take long to adjust the standard example code to communicate with the epp server. But at this point there is a problem, I keep getting 'greetings' instead of results for my commands. Yes, I added the 4 bytes! ;-) Anybody had the same problem
  • Pinky Lano

    Okay, that shines some light. The reason I was asking, is that I have to develop an EPP client, which should send XML commands as byte arrays over a TCP socket using SSL.

    The EURid (which handles .eu registrations) requires such a (secured) mechanism for automatically registering such domain names. They published some code samples in several programming languages, but not in .NET. Now I know why. I guess I have to conclude .NET 1.1 is no option for building an .eu/EPP client


  • pschuur

    Thanks for your suggestions! The only reason I would stay with 1.1. would be because I've been working with it for a couple of years now, and know how to use it.

    Because it's a new project, using 2.0 could an reasonable option.  I think I need to your advice whether or not to migrate to .NET 2.0 considering my current skills.
    Would there be a lot of learning needed to gain 2.0 skills Consider the following (major) subjects needed by the project:

    - user authentication
    - user interfaces
    - data acces/manipulation (on SQL Server 2000)
    - extensive XML use (data, schemes, validation)
    - TCP networking using SSL

    As a matter of fact, I haven't worked extensively with XML and networking before (in 1.1). Do you think I would need a lot of time to get up and running using 2.0

  • ddefrain01

    If this is a .NET 2.0 issue, please start a new thead and post your code that is giving you this issue. If you can get the trace file, it would be even better.
    see http://blogs.msdn.com/dgorti/default.aspx for an example of the tracing

  • SRSWellnessOne

    If you could help, that would be great. I've got about six weeks to develop the complete application (networking is just a small, but essential part of it), but within a few work days I need to know whether or not I could even complete this project (by knowing if this SSL issue could be resolved).

    The code below is what I tried, but now it should use SSL on top of it. Is there an easy way to make it SSL enabled Unfortunately, I'm not quite a networking expert...

    Thanks in advance.

    <code>
    Private Sub Connect(ByVal server As String, ByVal message As String, ByVal port As Int32)

    Dim ep As EndPoint = New IPEndPoint(Dns.Resolve(server).AddressList(0), port)
    Dim sock As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
               
    sock.Connect(ep)
    If sock.Connected Then
     Dim ReceivedData As String
     Dim amountBytesSent As Int32 = sock.Send(String2bArray(message), String2bArray(message).Length, SocketFlags.None)

     Dim NumBytes As Int32 = sock.Available
     If NumBytes > 0 Then
      Dim buffer(NumBytes - 1) As Byte
      Dim Received As Int32 = sock.Receive(buffer)
      If Received > 0 Then
       ReceivedData  = bArray2String(buffer)
      End If
     End If

     Response.Write(ReceivedData)

     sock.Shutdown(SocketShutdown.Both)
     sock.Close()
    End If

    End Sub

    Private Function String2bArray(ByVal Data As String) As Byte()
     Return System.Text.Encoding.ASCII.GetBytes(Data)
    End Function
    Private Function bArray2String(ByVal bytes() As Byte) As String
     Return System.Text.Encoding.ASCII.GetString(bytes)
    End Function
    </code>


  • SSL on TCP Socket, how in .NET 1.1?