Working on 2 layer security in the cloud (AWS). Have multiple clients pushing files to S3 document storage which are then retrieved by one EC2 instance.

Multiple external customers each requiring their own encryption (PUT files to S3). Have 1 internal instance that must be able to GET files from S3 and decrypt.

How can we manage multiple keys in an easy way?
3 legs of our problem

  1. Transport encrypted - solved via SSL
  2. Encrypt at rest - solved via S3 SSE
  3. Client side encryption

Is it possible for each client to encrypt (CSE), transport and then decrypt by S3 which then encrypts (SSE)? Any other thoughts or references that might help?

  • Please clarify. Is the EC2 instance unique to each client or is there just one instance which processes all the data submitted by clients? What is the specific risk/threat your trying to protect against? – Tim X Apr 22 '16 at 0:06
  • EC2 instance is in VPC and shared across all clients. Trying to ensure that data is encrypted client side, sent via encrypted in transit, encrypted at rest. Goal is 2 layer security / "rule of two" – csi Apr 22 '16 at 14:35
  • OK, so wouldn't it be easy to just have a gpg private/pub key pair where the EC2 instance has the private key and each client uses the public key to encrypt the data. This will ensure that only the EC2 instance is able to decrypt the data. – Tim X Apr 29 '16 at 21:03
  • What is the model here? Are you sharing access to the documents with clients? Are clients sharing with other clients? When you talk about a single client are you talking about a single user or a group? – symcbean Jul 31 '17 at 20:40

I am not sure if you want to only decrypt the files at the internal instance, or each client also has to be able to decrypt its own data.

Anyways, the solution is to use a hybrid encryption scheme with public keys.

Each client encrypts the data with a symmetric cipher like AES and a random key for each file. The random key is then encrypted with the public key of the internal instance. If the client also has to decrypt the file, the AES key is additionally encrypted with the public key of the client.

If you need to ensure authenticity, the file is also signed with the private key of the client.

You need, depending on your exact requirements, either one keypair for the internal instance or n+1 keypairs (internal instance and each client) for n clients.

One software which is able to do exactly what I described is the GNU Privacy Guard.

| improve this answer | |

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.