Page MenuHomePhabricator

Add an AES256 storage format for at-rest encryption
ClosedPublic

Authored by epriestley on Jun 15 2016, 6:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 3, 3:36 PM
Unknown Object (File)
Fri, Nov 29, 3:06 AM
Unknown Object (File)
Oct 28 2024, 8:35 PM
Unknown Object (File)
Oct 24 2024, 2:16 AM
Unknown Object (File)
Oct 21 2024, 2:11 AM
Unknown Object (File)
Oct 2 2024, 3:58 AM
Unknown Object (File)
Sep 18 2024, 3:16 PM
Unknown Object (File)
Sep 12 2024, 8:33 AM
Subscribers
None

Details

Summary

Ref T11140. This doesn't do anything yet since there's no way to enable it and no way to store master keys.

Those are slightly tougher problems and I'm not totally satisfied that I have an approach I really like for either problem, so I may wait for a bit before tackling them. Once they're solved, this does the mechanical encrypt/decrypt stuff, though.

This design is substantially similar to the AWS S3 server-side encryption design, and intended as an analog for it. The decisions AWS has made in design generally seem reasonable to me.

Each block of file data is encrypted with a unique key and a unique IV, and then that key and IV are encrypted with the master key (and a distinct, unique IV). This is better than just encrypting with the master key directly because:

  • You can rotate the master key later and only need to re-encrypt a small amount of key data (about 48 bytes per file chunk), instead of re-encrypting all of the actual file data (up to 4MB per file chunk).
  • Instead of putting the master key on every server, you can put it on some dedicated keyserver which accepts encrypted keys, decrypts them, and returns plaintext keys, and can send it 32-byte keys for decryption instead of 4MB blocks of file data.
  • You have to compromise the master key, the database, AND the file store to get the file data. This is probably not much of a barrier realistically, but it does make attacks very slightly harder.

The "KeyRing" thing may change once I figure out how I want users to store master keys, but it was the simplest approach to get the unit tests working.

Test Plan
  • Ran unit tests.
  • Dumped raw data, saw encrypted blob.
  • No way to actually use this in the real application yet so it can't be tested too extensively.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Add an AES256 storage format for at-rest encryption.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.
This revision is now accepted and ready to land.Jun 15 2016, 7:05 PM
This revision was automatically updated to reflect the committed changes.