Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the valid use cases for client side encryption?

I just read about the Stanford Javascript Crypto Library (jsfiddle example) which supports SHA256, AES, and other standard encryption schemes entirely in javascript. The library seems very nifty, but I don't know of a reasonable use case for it.

As some questions have already pointed out, client side encryption is not a safe way to pass secure data to a server. HTTPS should be used instead. So, are there any projects that would benefit from or require client side encryption?

like image 687
Ben Haley Avatar asked Aug 19 '11 15:08

Ben Haley


People also ask

What is client-side data encryption?

Client-side encryption is the act of encrypting your data locally to ensure its security as it passes to the Amazon S3 service. The Amazon S3 service receives your encrypted data; it does not play a role in encrypting or decrypting it.

Why is client-side encryption important?

By remaining encrypted through each intermediary server, client-side encryption ensures that data retains privacy from the origin to the destination server. This prevents data loss and the unauthorized disclosure of private or personal files, providing increased peace of mind for its users.

Does client-side need encryption?

Client-side encryption is especially beneficial for organizations that store sensitive or regulated data, like intellectual property, healthcare records, or financial data. It can help meet data sovereignty requirements and compliance requirements for ITAR, CJIS, TISAX, IRS 1075, and EAR.


1 Answers

Use Case 1

How about local storage? You might want to store some data, but encrypt it so that other users of the computer cannot access it?

For example:

  • User connects to server over HTTPS.
  • Server authenticates user.
  • Server serves an encryption password specific to this user.
  • User does some stuff locally.
  • Some data is stored locally (encrypted with the password).
  • User wanders off
  • User comes back to site at later stage.
  • User connects over HTTPS.
  • Server authenticates user.
  • Server serves the user's encryption password.
  • Client-side JS uses encryption password to decrypt local data.
  • User does something or other locally with their now-decrypted, in-memory local data.

This could be useful in cases where you have a fat client, with lots of (sensitive) data that needs to be used across sessions, where serving the data from the server is infeasible due to size. I can't think of that many instances where this would apply...

It could also be useful in cases where the user of the application generates sensitive data and that data does not need to (or shouldn't) ever be sent to (or stored on) the server.

For an applied example, you could store the user's credit card details locally, encrypted and use JS to auto-enter it into a form. You could have done this by instead storing the data server side, and serving a pre-populated form that way, but with this approach you don't have to store their credit card details on the server (which in some countries, there are strict laws about). Obviously, it's debatable as to whether storing credit card details encrypted on the user's machine is more or less of a security risk than storing it server side.

There's quite probably a better applied example...

I don't know of any existing project which use this technique.

Use Case 2

How about for performance improvements over HTTPS, facilitated via password sharing?

For example:

  • User connects to server over HTTPS.
  • Server authenticates user.
  • Server serves an encryption password specific to this user.
  • Server then redirects to HTTP (which has much less of an overhead than HTTPS, and so will be much better in terms of performance).
  • Because both the server and the client have the encryption password (and that password was shared over a secure connection), they can now both send and receive securely encrypted sensitive data, without the overhead of encrypting / decrypting entire requests with HTTPS. This means that the server could serve a web page where only the sensitive parts of it are encrypted. The client could then decrypt the encrypted parts.

This use case is probably not all that worthwhile, because HTTPS generally has acceptable performance levels, but would help if you need to squeeze out a bit more speed.

Use Case 3

Host proof storage. You can encrypt data client side and then send it to the server. The server can store the data and share it, but without knowing the client's private key, it cannot decrypt it. This is thought to be the basis for services such as lastpass.

like image 181
Spycho Avatar answered Oct 21 '22 06:10

Spycho