Main Site Documentation

SSL server


#1

Hi!

I am using Fez Cobra.

I am trying to setup WWW server working with SSL support.

My code is:


HttpListener listener = new HttpListener("https");
byte[] bCert = Resource.GetBytes(Resource.BinaryResources.cert);
X509Certificate cert =  new X509Certificate(bCert);
listener.HttpsCert = cert;
listener.Start();

HttpListenerContext ctx;
while (true)
{
ctx = listener.GetContext();
try
{
new RequestProcess(ctx);
}
catch (Exception ex)
{
Debug.Print(ex.Message);
}
}

But it does not work. I’ve got exception:


 #### Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (6) ####
    #### Message: 
    #### Microsoft.SPOT.Net.Security.SslNative::SecureServerInit [IP: 0000] ####
    #### Microsoft.SPOT.Net.Security.SslStream::Authenticate [IP: 0037] ####
    #### Microsoft.SPOT.Net.Security.SslStream::AuthenticateAsServer [IP: 000d] ####
    #### Microsoft.SPOT.Net.Security.SslStream::AuthenticateAsServer [IP: 000a] ####
    #### System.Net.HttpListener::AcceptThreadFunc [IP: 0072] ####
A first chance exception of type 'System.NotSupportedException' occurred in Microsoft.SPOT.Net.Security.dll
A first chance exception of type 'System.NotSupportedException' occurred in System.Net.Security.dll
An unhandled exception of type 'System.NotSupportedException' occurred in System.Net.Security.dll

Http works great.
So what is wrong?

Regards,

Jacek


#2

SSL is available on Cobra (EMX) so I am not sure why.

Have you tried the Microsoft examples found in “my documents” folder?


#3

Hi!

I have tried and it is the same exception.

Can You help me?


#4

Did you update the seed in MFDeploy?


#5

Hi !

It works now. Thanks for help. It would be better if this information was included in readme.txt for this sample.

But I have made tests and SSL communication is very slow:
https://device.microsoft.com/ loads in 5.5 sec
http://device.microsoft.com/ loads in 0.25 sec

Why is it so slow?


#6

HTTPS is a heavy protocol and the encryption does impose impacts.