Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browser-based encryption/decryption with private key from browser keystore

My situation:

  1. Medical staff wants to enter sensitive data of patients into a web browser (!) in order to store it to some database and later retrieve it again.

  2. These data are not allowed to be seen by anyone else except the medical staff itself. This means that it must be encrypted using some secret token before it is transferred to the server. It also means that neither IT staff (having access to the server/database) nor anyone else should be able to decrypt it without the secret token. (If the token is lost, the data would never be accessible anymore.)

  3. No additional software should be installed on the client machine, except some token (e.g., a private key) that one would export once and import it into all browsers from which data access should be granted.

So my question is:

Is there a way to encrypt/decrypt data on the client-side (e.g., using JavaScript) using some secret browser token that can be exchanged between browsers easily (I.e., exported/imported similar to X.509 certificates)?

If not, which alternative solutions would be possible? Since conditions 1 and 2 are mandatory, only condition 3 may be modified, if necessary. However, still as little installation effort as possible should be necessary on the client-side.

EDIT: SSL is obviously only part of the answer to this question!

like image 791
Thomas Avatar asked Oct 06 '12 23:10

Thomas


3 Answers

Due to ProtonMail's efforts, there is now an open source PrivateKey implementation in the browser at: https://openpgpjs.org/

This has had multiple security audits and is the basis of protonmail.com, so it has a fairly good records and maintainer in place. They also have a good summary of important security browser models.

like image 163
Halcyon Avatar answered Oct 24 '22 16:10

Halcyon


Take a look at Web-browser encryption of personal health information, whose "Abstract" section seems to describe your same problem. However, their "passcode" that generates the encryption key must be shared, which wouldn't let you differentiate medial staff.

We describe a system for remote data entry that allows the data that would identify the patient to be encrypted in the web browser of the person entering the data. These data cannot be decrypted on the server by the staff at the data center but can be decrypted by the person entering the data or their delegate. We developed this system to solve a problem that arose in the context of clinical research, but it is applicable in a range of situations where sensitive information is stored and updated in a database and it is necessary to ensure that it cannot be viewed by any except those intentionally given access.

like image 43
Kevin Hakanson Avatar answered Oct 24 '22 17:10

Kevin Hakanson


There's a javascript implementation of AES encryption which encrypts the plaintext in the browser. If you build something around those tools, the server side would store only the encrypted text and would not have the passphrase.

http://www.fourmilab.ch/javascrypt/

Shouldn't require any extra installation on the client side, but probably will require some development effort to get the user experience right.

like image 27
Eric Dobbs Avatar answered Oct 24 '22 17:10

Eric Dobbs