1

We have an interesting problem. We have customer that wants to use our web-based application (back-end / DB is with us). However they want to encrypt patient information, so no one in our company can see it. Would there be some kind of javascript solution for this? Or some way use their encryption before it is sent to us?

2 Answers 2

5

You can (although, in the security community, this is not seen as a viable solution1, 2) send a javascript crypto library to them, but it would not solve the issue.

Note: I'll assume in this answer that your connection uses SSL/TLS, because without it, you cannot securely communicate with the client.

The problem is that the client needs to trust you. They will download the javascript code from your server. So, the owner of the server will be always be able change how the javascript behaves. This is because, even if you send out a completely valid and well audited javascript crypto library to the client, the client cannot verify this. The only assurance they have is that they got something from a host, which theytheir browser choose to trust, based on the SSL/TLS certificate.

Usually, people start to bring up a malicious Man-in-the-Middle scenario at this point. This concern is mood though: either your connection is properly secured by SSL/TLS, or it is not. If the a Man-in-the-Middle scenario is possible, than the javascript crypto library that the client downloaded from the server is also suspect. In other words, if the SSL/TLS layers would somehow be compromised, the client side crypto should also be considered compromised.

If they trust the host enough, to trust that they do not tamper with the javascripts and indeed perform all the crypto on the client side, than they may as well trust you to not abuse their data on the server side. Which leaves out a lot of the (unneeded) complexity. Less complexity leads to a cleaner setup which is easier to audit.


Disclaimer: If you work with medical data, there is probably quite some laws you need to comply with (depending on your country/state). If you are not comfortable with questions at this level, you should probably either hire some specialists, or accept that this request is more complex than you could comfortably build and kindly inform your customer that they would be better served finding a company that has more experience in working sensitive data.

Sign up to request clarification or add additional context in comments.

1 Comment

Fully agree with this answer, well written. +1
-2

Well there is a problem. How do you want to implement the en/decryption without knowing how it happens? ;)

Some simplified basic encryption theory: (keep in mind that im also not an expert in this topic)

In todays cryptography we mostly use 2 different kinds of encryptions which are being either symmetric or asymmetric (Wikipedia: Public-key_cryptography), we are focusing on symmetric. You dont need to know how they actually encrypt the data but what you need to know is that its based on a given Key/Password. The difference between them is that symmetric encryption uses 1 key for both, en- and decrypting and asymmetric uses 2 kinds of key but currently thats nothing you need.

So there are many different algorithms for encrypting in one or another way, and knowing which algorithm is being used shouldnt be a problem as long as the used key is strong and random enough so that even a brutefoce of it will last many years.

Based on the used key, the output of the encrypted data will be different so that the string "foo" with the password "bar" is different than the same text (foo) with a different password. And so its not possible to get the value without knowing which key was being used.

I never used crypto-libs in JS so i cant recommend you any, but im sure there are plenty out there which can be used in a few lines. A very good algorithm based on symmetric encryption is AES which also has a lot of implementations out there which are ready to use ;)

So now you just have to add a button on the submit form which asks for the password to encrypt and then a button on the view/whatever page which wants the used password to decrypt the datas. When sending, you can send the encrypted data value next to its not encrypted data keys (not the encryption key!), so you know which value is what.

Here is a site where you can see it in action. Note how the encrypted value is completly different with a small change in the password. You can also find some code there. http://www.movable-type.co.uk/scripts/aes.html

I hope you understood it and that its not too messy. My english is not very good so please excuse my terrible grammer x)

9 Comments

Thanks for your help. Still a bit confused, but also not the top encryption star. Here is the exact scenario. We have a web application (frontend / backend). They want to use this application, but when they fill out the patient form and send it to us, we receive the patient information encrypted. We would then save the form values sent encrypted. When they request the patient (example for editing etc) it would have to be shown decrypted. The front-end belongs to us, but we should not know how encryption / decyption is being done. If you have time, can you please give a detailed idea.
I updated my post with more informations. Keep in mind that Jacco is mainly talking about the security of the connection itself which you should defently be aware of! In my post you will find one of many possible approaches to actually handle what your customer want.
You explanation was perfect. I got it!! Thank you so much, exactly what I was looking for!
"Send the encrypted data values with the not encrypted data keys" - Sooo... send the plaintext? This answer is full of bad recommendations.
My comment has nothing to do with your English language skills, don't take it so personally. Sending the encrypted data next to the plain keys is the same thing as sending the plaintext because anyone can decrypt the ciphertext. I appreciate the effort you put into writing your answer and thank you for contributing, I'm merely pointing out that you made mistakes, e.g. AES isn't an asymmetric algorithm, browser JavaScript shouldn't be used for crypto, and of course the massive security issue of sending the encryption keys with the ciphertext. Sorry to have upset you.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.