Okay, last step for me to achieve my goal. The gadget successfully sends ssl messages as a client. So I know the SSL Seed has been updated. I created a digital certificate pem file using this wiki: GHI Electronics – Where Hardware Meets Software and placed it in the project resources. It loads fine. Last step to AuthenticateAsServer and I get the error below:
Exception System.Net.Sockets.SocketException - CLR_E_FAIL (7)
#### Message:
#### Microsoft.SPOT.Net.Security.SslNative::SecureAccept [IP: 0000] ####
#### Microsoft.SPOT.Net.Security.SslStream::Authenticate [IP: 0045] ####
#### Microsoft.SPOT.Net.Security.SslStream::AuthenticateAsServer [IP: 000d] ####
#### Microsoft.SPOT.Net.Security.SslStream::AuthenticateAsServer [IP: 0008] ####
#### GadgeteerApp1.Program::TCPServer [IP: 0061] ####
#### SocketException ErrorCode = 5
#### SocketException ErrorCode = 5
A first chance exception of type ‘System.Net.Sockets.SocketException’ occurred in Microsoft.SPOT.Net.Security.dll
#### SocketException ErrorCode = 5
#### SocketException ErrorCode = 5
#### SocketException ErrorCode = 5
#### SocketException ErrorCode = 5
A first chance exception of type ‘System.Net.Sockets.SocketException’ occurred in System.Net.Security.dll
#### SocketException ErrorCode = 5
#### SocketException ErrorCode = 5
Exception was thrown: System.Net.Sockets.SocketException
Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, relayPort);
server.Bind(localEndPoint);
server.Listen(1);
byte[] receive;
while (true)
{
try
{
Debug.Print("wait for Connect");
Socket clientSocket = server.Accept();
receive = new byte[100];
SslStream sslStream = new SslStream(server);
X509Certificate cert = new X509Certificate(Resources.GetBytes(Resources.BinaryResources.PemFileName), "PemPassword");
sslStream.AuthenticateAsServer(cert, SslVerification.NoVerification, SslProtocols.Default);