4 ms·
One of my first jobs involved encrypting medical data in the client-side browser. The plan was to generate a new RSA private/public key pair whenever a new user
by aabajian 10y ago
One of my first jobs involved encrypting medical data in the client-side browser. The plan was to generate a new RSA private/public key pair whenever a new user joined. The keys themselves were encrypted using the user's password (w/AES) on the client side. We stored the encrypted RSA keys and the user's password hash on a server. When a user logged in we would validate the user's password hash, and return the user's encrypted keys. The user would have to know their password to decrypt the RSA key. The theory was that no medical data was visible on our server, even to us. We also used standard SSL for all connections.
The challenge was implementation. At the time there were no AES block-cipher JavaScript modules. My solution was to use GWT to compile BouncyCastle's Java library into JavaScript. I had to strip the library of all low-level I/O calls and replace the BigInteger class with a GWT-JSNI-wrapped version of the BigInteger class I found online. That BigInteger class was a side-project of a Stanford graduate student: http://www-cs-students.stanford.edu/~tjw/jsbn/ http://www-cs-students.stanford.edu/~tjw/jsbn/
He also included a JavaScript implementation of RSA. Long story short, within a year there were several cryptography libraries, but I like to think we were ahead of our time.
- tptacek 10y agoHow likely do you think it is that your implementation was safe? It's hard enough to use RSA safely in the best possibly circumstances --- and BouncyCastle isn't that! (I hope you're saying you compiled down BouncyCastle's RSA along with their OAEP support, and not that you did what a lot of front-end crypto people do, which is to implement RSA in pure Javascript).
- placebo 10y agoIf the goal was just end to end encryption, why was there a need for asymmetric keys? Couldn't the medical data have been directly encrypted via the password-derived AES key and stored on the server?