Main Site Documentation

SSL and G120HDR


#1

Hello
I cannot run a Https request with my G120HDR by a wifi link or cellular radio link .
I have MF4.3 and GHI SDK 2014-R5

Initialy a Https request generate this error: "Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (1)"
I have updated the SSL Seed with MFDeploy.

I have also see this thread https://www.ghielectronics.com/community/forum/topic?id=17568&page=1
I have exported and used the “Equifax Secure Certificate Authority” (validity until 2018) as John says. My export is “509 encoded base64”.

After update SSL Seed:

  • All Http request run very well.
  • All Https request with or without certificate are blocking. GetResponse() never returns.

I use this code to request my server:

        
m_ca = Resources.GetBytes(Resources.BinaryResources.certificat_equifax);
m_caCerts = new X509Certificate[] { new X509Certificate(m_ca) };
  ...
var http = (HttpWebRequest)WebRequest.Create(new Uri(myUrl));
http.Headers.Add("Authorization", "Bearer " + myToken);
http.ContentLength = 0;
http.Method = "POST";
http.Timeout = 5000;
http.HttpsAuthentCerts = m_caCerts;

var response = http.GetResponse(); => never returns

but I have the same problem with the code of Microframework example HttpClient.cs with the url gives in the code.

    
myUrl = https://www.google.com/accounts/ManageAccount/;
HttpWebRequest request = HttpWebRequest.Create(myUrl) as HttpWebRequest;
request.HttpsAuthentCerts =  m_caCerts;
request.KeepAlive = true;

WebResponse resp = request.GetResponse(); => never returns

#2

@ ChristianJack - First I would try just a simple get request to say the home page of google or bing over SSL. If that works, can you try to either step into GetResponse (you’ll need the NETMF source) to see where it fails at or try to connect using plain NETMF sockets instead of the HTTP wrapper?


#3

@ John I have the same problem with “https://www.google.com”.
The blocking is in the method “‘Microsoft.SPOT.Net.Security.SslStream.Authenticate’”

I have debug without the NETFM source code.
I want try to use socket but I see that the class Socket is not accessible.
It is because for 2 years I use the G120HDR as a Gadgeteer project.

I have create a new MF project (not gadgeteer) and I have translated my code to try HttpWebRequest with a MF project and eventually if I have the same problem to use Socket.

I have defined the socket S to connnect my WifiRS21 but I do not know how to define the socket “Blue” to connect my LEDmatrix.
I have search on the forum the good syntax and I have verified with the schematic. Is there my socket S definition correct ? and where is the schematic name of the “Blue socket” X12, X13 or X14 ?

       private static void RegisterExtenderSockets()
        {
            // Define socket to connect WIFIRS21 module - Socket S
            var socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(6);
            socket.SupportedTypes = new char[] { 'S' };
            socket.CpuPins[3] = G120.P0_5;
            socket.CpuPins[4] = G120.P1_14;
            socket.CpuPins[5] = G120.P1_16;
            socket.CpuPins[6] = G120.P1_17;
            socket.CpuPins[7] = G120.P0_9;
            socket.CpuPins[8] = G120.P0_8;
            socket.CpuPins[9] = G120.P0_7;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            // Define socket to connect LedMatrix module - Socket 
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            socket.SupportedTypes = new[] { '???????' };
            socket.CpuPins[3] = 
            socket.CpuPins[4] = 
            socket.CpuPins[5] =         
            socket.CpuPins[6] = 
            socket.CpuPins[7] =
            socket.CpuPins[8] =
            socket.CpuPins[9] =
            GT.Socket.SocketInterfaces.RegisterSocket(socket);
        }

Thanks for your help.


#4

@ ChristianJack - My apologies, by socket I meant the System.Net.Sockets namespace. There is an issue with SSL that we are looking into. See https://www.ghielectronics.com/community/forum/topic?id=17568 We still do not have a fix, however.


#5

I was getting the CLR_E_NOT_SUPPORTED (1) when I had my proxy set wrong.

HttpWebRequest.DefaultWebProxy =
                new WebProxy("itgproxy.dns.microsoft.com", true);

It’s up to you whether this code needs to be added at all (home vs work network?) or has anything to do with your issue, but I mention it for consideration.

But now I am getting CLR_E_FAIL (4) and so far not identified a resolution (not even sure if its a gadgeteer or netmf issue or user issue)
https://www.ghielectronics.com/community/forum/topic?id=17568


#6

@ John - OK for the namespace System.Net.Sockets, but I want to try to make a MF project with my G120HDR and have you a response for my sockets definition ?


#7

@ ChristianJack - The G120HDR is not a Gadgeteer mainboard and is not meant to be used with Gadgeteer. There is a community G120HDR mainboard project on the Code Share that you can look into, but it is not supported. I believe the socket type you want for the LED Matrix is XY.


#8

@ John - I am confused you do not understand my question.
I always use G120HDR as a gadgeteer mainboard with MF4.2 and now with MF4.3 and the CodeShare MikeCormier template.
I use G120HDR with Ledmatrix and WifiRs21 or Cellular radio without problem (with MF4.3 Gadgeteer project) except SSL blocking in SslStream.

Now, I want “to go to the right way”. For this I have create a new MF project (not a Gadgeteer project) and I have translate all my code (change some references)

My question "How to define the connector “Blue” on the G120HDR to connect and manage LedMatrix. I have see the shematic of the mainboard but I don’t know the name of the connector “Blue” if it is X12, X13 or X14. I suppose it is X12 but I am not sure.
I want to define the pins of connector “Blue” for a socket “X,Y” but I don’t know how this connector is wire and how to define I2C for the DaisyLink ?
I have found some example but it is for MF4.2 and for an old syntax.
How replace old syntax “socket.NativeI2CWriteRead = nativeI2C” with “socket.I2CBusIndirector = ???”. Is there a sample somewhere ?

It is OK for the “SPI” connector and WifiRs21. My wifi module runs on MF project.

       private static void RegisterExtenderSockets()
        {
            // Define socket to connect WIFIRS21 module - Socket S
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(6);
            socket.SupportedTypes = new char[] { 'S' };
            socket.CpuPins[3] = G120.P0_5;
            socket.CpuPins[4] = G120.P1_14;
            socket.CpuPins[5] = G120.P1_16;
            socket.CpuPins[6] = G120.P1_17;
            socket.CpuPins[7] = G120.P0_9;
            socket.CpuPins[8] = G120.P0_8;
            socket.CpuPins[9] = G120.P0_7;
            socket.SPIModule = SPI.SPI_module.SPI2;
            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            //// Define socket to connect LedMatrix module - Socket Y
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            socket.SupportedTypes = new char[] { 'X', 'Y' };
            socket.CpuPins[3] = G120.P2_13;
            socket.CpuPins[4] = G120.P1_26;
            socket.CpuPins[5] = G120.P1_27;
            socket.CpuPins[6] = G120.P1_28;
            socket.CpuPins[7] = G120.P1_29;
            socket.CpuPins[8] = G120.P2_4;
            socket.CpuPins[9] = G120.P2_2;

            //socket.NativeI2CWriteRead = nativeI2C;  Old syntax
            socket.I2CBusIndirector = ???????

            GT.Socket.SocketInterfaces.RegisterSocket(socket);
        }

#9

@ ChristianJack - On the G120 the blue socket/pins can be used as GPIO. You can see how we define the sockets and I2CBusIndirector for our mainboards in https://bitbucket.org/ghi_elect/gadgeteer/raw/0a3dd5081b0bcfc25d57c6e35663a91550eecbc1/Mainboards/GHIElectronics/FEZCobraIIEco/FEZCobraIIEco_43/FEZCobraIIEco_43.cs

Based on the code you posted it looks like you are trying to define Gadgeteer sockets inside NETMF. That can lead to hard to track down issues if you don’t use the entire Gadgeteer framework, which the G120HDR is not designed for.