I came across this thread Node.js HTTPS Secure Error which mentions that the tls module is the way to do TLS on node now. It seems that setSecure() has been dropped. I'm trying to do a STARTTLS for XMPP. This means that the socket will be upgraded midway. How do I go about doing this on node.js > 0.4.0?
Asked
Active
Viewed 1,163 times
2 Answers
2
Try this: https://gist.github.com/848444

TooTallNate
- 1,477
- 3
- 20
- 41
-
so, I tried doing that, but the thing is that event handlers have already been attached on the socket and after TLS, the don't seem to be firing on it again. Do I need to reattach these handlers or attach handlers on something else (return value of pipe)? – dhruvbird Mar 01 '11 at 12:51
-
1okay. got it working!! I need to reattach all handlers to the cleartext object returned by starttls(). node-xmpp should have SSL support in node.js>=0.4.0 now. – dhruvbird Mar 01 '11 at 19:44
1
Take a close look at the lib/tls.js file in the Node Github repo.
https://github.com/joyent/node/blob/master/lib/tls.js#L949-992
Another resource that you really might like is here:

BMiner
- 16,669
- 12
- 53
- 53