diff options
author | Logan Smyth <loganfsmyth@gmail.com> | 2011-08-02 22:17:16 -0400 |
---|---|---|
committer | koichik <koichik@improvement.jp> | 2011-08-06 23:31:17 +0900 |
commit | 3056c2ca76c37ff03b24deb10e8dd538c70600f2 (patch) | |
tree | 04694fba9c83840a60babc9f1cf6cdefa3641803 /doc | |
parent | c72223e2a9aae2d5c20825562657c50a644d8a59 (diff) | |
download | nodejs-3056c2ca76c37ff03b24deb10e8dd538c70600f2.tar.gz nodejs-3056c2ca76c37ff03b24deb10e8dd538c70600f2.tar.bz2 nodejs-3056c2ca76c37ff03b24deb10e8dd538c70600f2.zip |
Add documentation for SecurePair and its 'secure' event.
Fixes #1443.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/tls.markdown | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/api/tls.markdown b/doc/api/tls.markdown index e4ded41a7..6cfb29b92 100644 --- a/doc/api/tls.markdown +++ b/doc/api/tls.markdown @@ -61,8 +61,30 @@ piped to the socket, the plaintext stream is what the user interacts with therea [Here is some code that does it.](http://gist.github.com/848444) +### pair = tls.createSecurePair([credentials], [isServer], [requestCert], [rejectUnauthorized]) +Creates a new secure pair object with two streams, one of which reads/writes encrypted data, and one reads/writes cleartext data. +Generally the encrypted one is piped to/from an incoming encrypted data stream, and the cleartext one +is used as a replacement for the initial encrypted stream. + - `credentials`: A credentials object from crypto.createCredentials( ... ) + + - `isServer`: A boolean indicating whether this tls connection should be opened as a server or a client. + + - `requestCert`: A boolean indicating whether a server should request a certificate from + a connecting client. Only applies to server connections. + + - `rejectUnauthorized`: A boolean indicating whether a server should automatically + reject clients with invalid certificates. Only applies to servers with `requestCert` enabled. + +`tls.createSecurePair()` returns a SecurePair object with `cleartext` and `encrypted` stream properties. + +#### Event: 'secure' + +The event is emitted from the SecurePair once the pair has successfully established a secure connection. + +Similarly to the checking for the server 'secureConnection' event, pair.cleartext.authorized should be +checked to confirm whether the certificate used properly authorized. ### tls.Server |