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

SSL Authentication issues


  • Please log in to reply
3 replies to this topic

#1 dbelcham

dbelcham

    New Member

  • Members
  • Pip
  • 2 posts

Posted 13 August 2015 - 03:58 PM

When I'm running my Netduino 3 WiFi I get the following error trying to connect to an Azure Mobile Services endpoint to do a POST

Microsoft.SPOT.Net.Security.SslStream::Authenticate
Microsoft.SPOT.Net.Security.SslStream::AuthenticateAsClient
System.Net.HttpWebRequest::EstablishConnection
System.Net.HttpWebRequest::SubmitRequest
System.Net.HttpWebRequest::GetRequestStream
Igloocoder.MF.AzureMobileServices.MobileServiceEndpoint::Insert
Igloocoder.BbqDuino.Program::TakeTemperatureReading

The code being executed is as follows:

        public HttpWebResponse Insert(string table, string json)
        {
            var request = (HttpWebRequest) WebRequest.Create("https://myazuremobileservice.azure-mobile.net/tables/" + table);
            request.Method = "POST";
            request.Accept = "application / json";
            request.ContentType = "application / json; charset = UTF-8 ";
            request.ContentLength = json.ToCharArray().Length;
            request.Headers.Add("X-ZUMO-APPLICATION", "myApplicationKey");

            using (var streamWriter = new StreamWriter(request.GetRequestStream()))
            {
                streamWriter.Write(json);
                streamWriter.Flush();
                streamWriter.Close();
            }

            using (var response = (HttpWebResponse) request.GetResponse())
            {
                return response;
            }
        }

The exception is being thrown on the line with "using (var streamWriter" at the start of it. The only thing available is the stack trace at the start of this post. There is no inner exception and the message is "Exception was thrown: System.Exception"

 

I did some research and found a few posts on this forum but none of them seem to have any confirmed fixes. The closest I got was to use MFDeploy and do "Target | Manage Device Keys | Update SSL Seed" which outputs the following

Updating SSL seed...
request configured
Update Complete!

Any guidance, ideas or general thoughts would be appreciated.



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 14 August 2015 - 07:01 PM

Hi dbelcham,

What version of firmware are you running? Can you upgrade to the latest firmware really quickly (if you're no already on it), which should give you a more specific Exception? And also, importantly, a socket exception error code.

If you're already on the latest firmware (posted sticky at the top of the Netduino 3 forum and posted on the download page)...can you provide an exact code sample (<=10 lines of code is best, but a few more are fine) that we can test out locally?

Thank you, and welcome to the Netduino community.

Chris

#3 dbelcham

dbelcham

    New Member

  • Members
  • Pip
  • 2 posts

Posted 14 August 2015 - 07:08 PM

The exception thrown is "SystemException" and there is no error code that I'm able to find. I'll take care of updating the firmware later today and post back those results.

 

20388319349_afddac2b84_z.jpg



#4 pdii

pdii

    Member

  • Members
  • PipPip
  • 29 posts

Posted 14 August 2015 - 08:29 PM

I'll start a separate thread because I don't want to hijack this one, but I wanted to leave a quick note that I too am facing some interesting issues with SSL on my N3W that are very similar to this.






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.