June 2014
Intermediate to advanced
696 pages
38h 52m
English
Creating a TLS client is almost exactly like creating a socket client, as discussed earlier in this chapter. The only difference is that there are additional options, shown in Table 8.8, that allow you to specify the security for the client. The most important options are key, cert, and ca.
Table 8.8 Additional options for tls.connect()
The key option specifies the private key used for SSL. The cert value specifies the x509 public key to use. If you are using a self-signed certificate, you need to point the ca property at the certificate for the server:
var options = { key: fs.readFileSync('test/keys/client.pem'), ...
Read now
Unlock full access