DOMCrypt is a Firefox extension that adds 'window.mozCipher' to each browser window. With 'mozCipher', you can generate a public and private key pair, encrypt data and decrypt data. All of the encryption operations are handled by low-level NSS libraries written in C. This is not a javascript-in-content solution. (
NSS handles all of the SSL operations in many modern browsers.)
Try out the demo: