How would I implement AES encryption in SpiderMonkey? How would I get a shared key between client & server?
You would have to write your own transport to do this. Spider Monkey currently assumes that encryption is done either on the messages themselves or through a separate connection.
And key management (even with SSL) is why Spider Monkey doesn’t do any of this out of the box. It’s hard enough to explain networking basics without throwing the complexities of key managements into things. If someone ever came up with a decent solution then we’d be glad to include it… but I doubt we will see it.