Using secure sockets and servers
In this recipe, we describe the steps to make your web server encrypt its communication with clients using Secure Sockets Layer (SSL) on the HTTPS protocol.
Getting ready
Dart uses SSL/TSL security; it relies on X.509 certificates to validate servers and (optionally) clients. The server provides a certificate that will verify itself as a trusted server to the client. When the client accepts the certificate, symmetric session keys will be exchanged and used to encrypt the communications between the server and the client. So, in order for your server to provide a secured connection, it has to have a security certificate installed, provided by a Certificate Authority (CA).
Dart uses a Network Security Services (NSS) database to store the server's private key and certificate. For our example, we will use the test certificate database in the subfolder pkcert
, which is also provided as an illustration in the tutorial at https://www.dartlang.org/docs/tutorials/httpserver...