0

I need to develop a system where a user can upload a file via browser which encrypts the file and stores it on my server. After the file is uploaded other user can download the file with an iOS or android app and decrypt it to view it. The problem is I shouldn't be able to decrypt the file on my server, because the files are potentially very sensitive. Now, I don't have any real knowledge about encryption and don't know where to start. Do you have any hint what is best practice for this kind of end to end encryption?

I have come up with an idea of how my security scheme should look like.

  1. The CMS client logs in and his password is used from now on as upload key (later used)
  2. On the CMS side, later app user (potential file receiver) are created, with a login password (for the app) and a download key (later used) to decrypt the downloaded files.
  3. The CMS client sends the app users their login password and download key in separate mail (no email)
  4. The CMS client uploads a file which gets encrypted with a random key (later used) in the browser and stored on server 1. The random key and the reference to the file are getting encrypted with the upload key and stored on server 2.
  5. The CMS client selects app user (one ore more) to view the uploaded files. In this moment, the random key and the file reference (from the 3. step) are getting decrypted with the upload key. This decrypted package gets duplicated and encrypted with the download key of the selected app user (this step is done for every selected app user, therefor we will have multiple packages for every app user)

Is this approach close or am I heading in the wrong direction?

  • You could use the NaCl library's SecretBox to encrypt the data on the client side and then upload it. The password would be derived by passing a password that they provide through Scrypt. That way any client (android, Linux, iOS, etc) would just need them to enter the original password that they used to encrypt the file. – Awn Nov 13 '16 at 17:02
  • 1
    That you are asking the question casts some doubt on your ability to implement a solution securely; most security fails occur not in the algorithms used (some helpful suggestions below) but in the way they are implemented. The way you have asked the question does nothing to allay my concerns - as long as the data is encrypted by a web delivered component or on the server itself, the data may be compromised. You would need to encrypt/devrypt independently of your application and at that point your service offers little more than drop box orsimilar cloud service. – symcbean Nov 13 '16 at 23:06
1

I need to develop a system where a user can upload a file via browser which encrypts the file and stores it on my server. After the file is uploaded other user can download the file with an iOS or android app and decrypt it to view it. The problem is I shouldn't be able to decrypt the file on my server, because the files are potentially very sensitive.

People do this frequently with cloud storage systems like Dropbox: encrypt a file, store it on the host, then decrypt it elsewhere. You can re-use any common, well-tested encryption system (GPG, TrueCrypt, etc.), and to the host it's just an encrypted blob.

If you provide this as a product, you should re-use existing file encryption software, and re-use existing cloud storage systems (S3, for instance, is quite cheap and provides excellent availability and durability guarantees); the only bit you have to do yourself is the UX on top of them.

0

You will want authenticated encryption. AES-GCM with a key derived from something like PBKDF2 is probably your best bet.

The problem here is that if you don't know crypto well it's easy to shoot yourself in the foot. AES-GCM helps with that a bit but it's not bulletproof.

Publish your encryption scheme so others will be able to review it and confirm it's secure.

  • As I understand it, OP's concern is not creating a custom encryption scheme but doing everything on the client side. – Arminius Nov 13 '16 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.