Hi,
A mini HTTP server runs on FezDuino with success.
However I would like to secure it with TLS because most browsers refuse today to connect to insecured sources.
I implement the following code with TLS certificate and key placed inside the projects ServerResources :
_webServer = new HttpListener("https")
{
HttpsCert = new X509Certificate(ServerResources.GetBytes(ServerResources.BinaryResources.servercert))
{
PrivateKey = ServerResources.GetBytes(ServerResources.BinaryResources.serverkey)
}
};
When a client tries to connect to my HTTPS server this exception occurs :
#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (8) ####
#### Message:
#### GHIElectronics.TinyCLR.Devices.Network.Provider.NetworkControllerApiWrapper::AuthenticateAsServer [IP: 0000] ####
#### System.Net.Security.SslStream::AuthenticateAsServer [IP: 0011] ####
#### System.Net.HttpListener::AcceptThreadFunc [IP: 0096] ####
I’m looking for in “HttpListener” class the method “AcceptThreadFunc” and I see SSL Protocol is None. Is it the evidence of my exception ? What do you think ?
networkStream = new SslStream(socket);
((SslStream)networkStream).AuthenticateAsServer(m_httpsCert, SslProtocols.None);