Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

SslStream.AuthenticateAsClient Issue (Microsoft.SPOT.Net.Security class)


  • Please log in to reply
14 replies to this topic

#1 Christopher Gilmore

Christopher Gilmore

    Member

  • Members
  • PipPip
  • 12 posts
  • LocationBurlington, MA

Posted 07 December 2010 - 12:39 AM

I am brand new to the Netduino Community and have started trying to write an application that will have the netduino plus send an email from my gmail account. Part of this is connecting to gmail's smtp server, but they require the use of SSL. I have acquired some example code from this site ( http://bansky.net/bl...icro-framework/ ) and have modified it to include SSL support (using the Microsoft.SPOT.Net.Security.SslStream Class). The code seems to run fine when I used the emulator, however tonight i tried loading it onto my Netduino Plus.

When i tried to run the following i got an exception:

// Get server's IP address.
IPHostEntry hostEntry = Dns.GetHostEntry(this.Host);
// Create socket and connect to the server's IP address and port
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(new IPEndPoint(hostEntry.AddressList[0], this.Port));

SslSet = new SslStream(socket);
SslSet.AuthenticateAsClient(this.Host, SslProtocols.SSLv3); <-- Error occured on this line.


The error:
#### Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (4) ####
#### Message:
#### Microsoft.SPOT.Net.Security.SslStream::Authenticate [IP: 0051] ####
#### Microsoft.SPOT.Net.Security.SslStream::AuthenticateAsClient [IP: 000c] ####
#### Microsoft.SPOT.Net.Security.SslStream::AuthenticateAsClient [IP: 0009] ####
#### DoorBuzzer.SmtpClient::Send [IP: 008e] ####
#### DoorBuzzer.Program::SendDoorRingNotification [IP: 0070] ####
#### DoorBuzzer.Program::DoorBellPort_OnInterrupt [IP: 001a] ####
A first chance exception of type 'System.NotSupportedException' occurred in System.Net.Security.dll
A first chance exception of type 'System.NotSupportedException' occurred in System.Net.Security.dll


Am I doing something wrong or will SSL never really work on the Netduino Plus?
Thanks in advance...

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 December 2010 - 01:06 AM

Hi Christopher, SSL is too big for the Netduino Plus. We'll revisit the SSL scenario in the future, but for now Netduino Plus is HTTP only when it comes to web pages. It would be cool to find a way to squeeze it in there... Welcome to the Netduino community, Chris

#3 Coding Smackdown

Coding Smackdown

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationLewisville, TX USA

Posted 07 April 2011 - 06:40 PM

Chris, Is there any way to squeeze it in by leaving other pieces out. Could I conditionally recompile the firmware and say leave out the portions I wouldn't be using? I'm looking to purpose the Netduino Plus as a print agent for Point of Sale and would only really need the IP Stack, not a lot of the other low level interfaces.
Brewing Award Winning Beer with a Netduino!
http://diybrewery.com

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 07 April 2011 - 08:42 PM

Hi Coding Smackdown, OpenSSL is really big. It might be possible to put another smaller SSL stack on there (or even squeeze OpenSSL in), but that would probably be a big project. Not to deter you... We'll look into it with the .NET MF 4.2 firmware though. There's some new security mechanisms built into that...perhaps we can leverage some of those. Chris

#5 mpenna

mpenna

    New Member

  • Members
  • Pip
  • 2 posts

Posted 10 August 2011 - 06:01 PM

Hi, I hope I'm not hijacking this thread, but I've seen here in the forums people stating that it's not possible (yet) to implement a SERVER on the Netduino Plus and have it support HTTPS. I'm not sure if this equates to the same problem, but I've been looking for some guidance towards using the Netduino PLus as a CLIENT for an external webserver, and have it accessing this server through the HTTPS protocol for GET and POST operations. Is this possible? Marcos

#6 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 10 August 2011 - 07:53 PM

Hi Marcos and welcome to the Netduino forums! SSL support is too big for the Netduino Plus. I can't say anything about SSL support in the future, but for now Netduino Plus is HTTP only when it comes to web pages.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#7 mpenna

mpenna

    New Member

  • Members
  • Pip
  • 2 posts

Posted 10 August 2011 - 08:38 PM

Hi Stefan, Thanks for your fast response. I haven't tried them yet, but the NETMF 4.1 SDK comes with a couple of samples which demonstrate the client/server capabilities of the framework, more specifically in regards to the development of WCF4 services. Does this mean that it's possible to develop a client application on the Netduino Plus, and have it communicate with an external WCF4 service through the secure WS-*/SOAP message protocols? Security in this case would be applied to the message layer, instead of the transport layer (HTTPS), right? If this is not possible on the Netduino Plus, could you then point me to what level of security can one rely on when developing a web client for this device? Marcos

#8 Cinelli

Cinelli

    Member

  • Members
  • PipPip
  • 17 posts

Posted 23 August 2011 - 09:47 PM

Hi Stefan - Is this still the case with 4.2, no SSL? We had a memory issue doing something else, but once I removed a bunch of references we didn't need we had plenty of memory to spare.

#9 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 24 August 2011 - 07:26 AM

As far as I know the Netduino still has no SSL stack. Perhaps Chris could confirm this.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#10 habakuk

habakuk

    New Member

  • Members
  • Pip
  • 8 posts

Posted 07 September 2012 - 08:44 AM

As far as I know the Netduino still has no SSL stack. Perhaps Chris could confirm this.


I tired it today with Netduino plus and MF 4.2 but there is still no support. Would have been nice to know this before I purchased it... (as ethernet is rather useless without SSL) - Are there any other limitations (that are also not listed on http://www.netduino....oplus/specs.htm).

#11 nakchak

nakchak

    Advanced Member

  • Members
  • PipPipPip
  • 404 posts
  • LocationBristol, UK

Posted 07 September 2012 - 09:05 AM

Its unlikely that you will ever get SSL on the ND+ as the open SSL stack is to large to fit in flash. It may be possible with the GO though. If you need encryption on your ethernet connections simple encryptions (XOR etc) are all that is really available to you for the time being. Nak.

#12 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 07 September 2012 - 09:07 AM

I tired it today with Netduino plus and MF 4.2 but there is still no support. Would have been nice to know this before I purchased it... (as ethernet is rather useless without SSL) - Are there any other limitations (that are also not listed on http://www.netduino....oplus/specs.htm).


I have to disagree a bit. In my opinion ethernet isn't necessarily useless w/o SSL. I agree it would be a nice feature, but it just won't fit the devices memory.

Also, it's not common to list limitations. Instead features are listed. You won't be able to stream 1080p videos with a Netduino Plus too, for example. In my opinion that's obvious. The processor speed and RAM just won't allow it.


Depending on your application maybe other security measurements could be used, instead of SSL?
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#13 habakuk

habakuk

    New Member

  • Members
  • Pip
  • 8 posts

Posted 07 September 2012 - 09:34 AM

I have to disagree a bit. In my opinion ethernet isn't necessarily useless w/o SSL.


If you want to do something that requires login or to send data over public networks (aka Internet) you should encrypt it. And the webservice that i wanted to use only allows https-secured connections...

Also, it's not common to list limitations. Instead features are listed. You won't be able to stream 1080p videos with a Netduino Plus too, for example. In my opinion that's obvious. The processor speed and RAM just won't allow it.


I think that's a bit different as .Net Micro supports SslStream.AuthenticateAsClient but the Netduino throws a NotSupportedException. :net Micro doesn't promise to show video at all.

#14 nakchak

nakchak

    Advanced Member

  • Members
  • PipPipPip
  • 404 posts
  • LocationBristol, UK

Posted 07 September 2012 - 10:52 AM

Use a proxy server on your lan or on the cloud to forward requests from the ND (it also makes it an order of magnitude easier to debug comms, rather than using wire shark and hoping to catch the error response on the nd, i.e. i had a lot of bother with a project when the standard iis error page (YSOD) was to big for the available memory and would cause a out of memory exception, preventing me from see the returned error message), using full .net framework, you would also gain other useful things like async socket connectivity etc. The ND has limited resources and synchronous networking only so IMHO you can only reliably use REST based web services as the verbose payload for SOAP is to much for it to handle, without a lot of buffering and such forth. Whilst i see your point that netmf does indeed support SSL, it is actually up to the device manufacturer to decide which features they include in their firmwares, much the same as any web browser doesn't fully implement W3C spec's Nak.

#15 herron

herron

    New Member

  • Members
  • Pip
  • 3 posts

Posted 01 July 2013 - 02:19 PM

Hello,

I am new to all of this and I cannot find source code that actually works without flaw. I have to figure out how to send an emil via ethernet with the .netmf. I downloaded the http://netmftoolbox.codeplex.com/ toolbox and now I am stuck. using VS 2010. please help. my knowledge is very limited so please have patience. thank you






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.