FEZCerbuinoBee netmf 4.3 HTTPS Issues

Hello,
I’m trying to ping a website with the CerbuioBee using the ENC28. Here is how I’m initializing the module and connection:

public void InitializeNetwork()
        {
            GT.Socket socket = GT.Socket.GetSocket(1, true, null, null);

            Microsoft.SPOT.Hardware.Cpu.Pin intPin = socket.CpuPins[3];
            Microsoft.SPOT.Hardware.Cpu.Pin resetPin = socket.CpuPins[4];
            Microsoft.SPOT.Hardware.Cpu.Pin csPin = socket.CpuPins[6];
           // Microsoft.SPOT.Hardware.SPI.SPI_module spiModule = socket.SPIModule;
            //ethernetENC28 = new EthernetENC28(socket.SocketNumber);

            Eth

            Debug.Print("Connecting...");

            ethernetENC28.NetworkInterface.Open();
            ethernetENC28.NetworkInterface.EnableDhcp();
            ethernetENC28.NetworkInterface.EnableDynamicDns();
            ethernetENC28.UseDHCP();
            
            Thread.Sleep(250);

            if (!ethernetENC28.NetworkInterface.CableConnected)
            {
                Debug.Print("No cable!");            
            }

            while (ethernetENC28.NetworkInterface.IPAddress == "0.0.0.0")
            {
                Thread.Sleep(250);
            }

            Debug.Print("Net: " + ethernetENC28.NetworkInterface.IPAddress);
            Thread.Sleep(1000);
        }

But when I try to do an HTTPS Request as follows:


void makeGenericHTTPRequest()
        {
            try
            {
                string url = "https://www.contoso.com/";
                using (var req = System.Net.HttpWebRequest.Create(url))
                {
                    using (var res = req.GetResponse())
                    {
                        Debug.Print("HTTP Response length: " + res.ContentLength.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }

I get these errors:
A first chance exception of type ‘System.Net.Sockets.SocketException’ occurred in Microsoft.SPOT.Net.dll
A first chance exception of type ‘System.Net.WebException’ occurred in System.Http.dll
A first chance exception of type ‘System.Net.WebException’ occurred in System.Http.dll

I have no idea why…but I’m pretty rusty with HTTP Stuff. Any help is appreciated.
Thanks,
~Shane

There is no SSL on cerb

For completeness I tried the code here: https://www.ghielectronics.com/docs/30/networking#3123

     void makeGenericHTTPRequest()
        {
            byte[] result = new byte[640]; //< This number does not work in my CerbuioBee. I get a failed allocation error.
            int read = 0;
            try
            {
                using (var req = HttpWebRequest.Create("https://www.contoso.com/") as HttpWebRequest)
                {
                    using (var res = req.GetResponse() as HttpWebResponse)
                    {
                        using (var stream = res.GetResponseStream())
                        {
                            do
                            {
                                read = stream.Read(result, 0, result.Length);

                                Thread.Sleep(20);
                            } while (read != 0);
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
            Debug.Print(read.ToString());
        }

Hi Gus,
Does this mean I cannot use HTTPS on the CerbuioBee?

should the code here: https://www.ghielectronics.com/docs/30/networking#3123 work on the cerbuionBee?
Thanks,
~Shane

@ shanekirkbride - As Gus notes, there is no support for SSL on Cerberus/Cerbuino Bee, so no, you won’t be able to use HTTPS.

For SSL support, you’ll need a FEZ Spider (or Spider II), FEZ Cobra II, or FEZ Raptor if you’re doing Gadgeteer.

For non-Gadgeteer stuff, the G120 and G400 SoC support SSL, too.

Yes, there is no SSL/HTTPS support for Cerberus/CerbuinoBee/CerbuinoNet.

I want to use this small Devices for Azure Event Hub.

But you need HTTPS.

I tried it… :wall:

It is better to read the Board specification before. :’(

1 Like

You can throw money at the problem and get a new https-enabled board, or you can create a proxy service on a nearby device or in the cloud (which may or may not cost you).

On a ‘nearby device’ (a PC, RPi or whatever) you can spin up a service that gateways your http requests to Azure Event Hub via HTTPS.

OR, You may be able to create a free Azure Web App that exposes an api that your board can talk to over HTTP, and which then proxies the requests to the event hub over HTTPS. I have not personally done this, but if I had to accomplish this without https, a cloud proxy would probably be one of the first solutions I would attempt (so long as you are not worried about the exposed traffic between your devices and the proxy).

1 Like

@ mcalsyn

Thanks mcalsyn for the information.

I know the solution with the proxy and the other way with the Azure web app.

But on the beginning i learned it on a hard way.

Try --> Error, the normal Developer day… Every Day 8)

@ mcalsyn -
So when you guys say there is no support for https on the bee, does that mean there is not enough memory to hold the ssl bits, or is there some other limitation that does not allow https?

Would your answer hold true for the FezCerbNet board?

Thanks.

Actually, it wasn’t me that said that. I understand that the issue with SSL is that it requires a lot of supporting code in the firmware and that code is left out on some boards so that there is enough room left over for your code to run in. As for which models do and don’t have SSL, someone else will have to answer.

@ terrence

I dont´t know if the ARM STM32F405 can´t do that.

The Mounteer Group has a Prime Firmeware with TLS. They use the STM32F407.

[url]http://www.mountaineer-boards.com/prime/firmware/[/url]

I think you must ask GHI or other hardware specialists.

@ andre.m - Yes, I read that, being new to this area, I was just trying to figure out what is the limiting factor. His list of boards did not make that obvious. It is clear to me now.

Thanks for the clarification.