rocksdb/include/rocksdb
Ewout Prangsma 51778612c9 Encryption at rest support
Summary:
This PR adds support for encrypting data stored by RocksDB when written to disk.

It adds an `EncryptedEnv` override of the `Env` class with matching overrides for sequential&random access files.
The encryption itself is done through a configurable `EncryptionProvider`. This class creates is asked to create `BlockAccessCipherStream` for a file. This is where the actual encryption/decryption is being done.
Currently there is a Counter mode implementation of `BlockAccessCipherStream` with a `ROT13` block cipher (NOTE the `ROT13` is for demo purposes only!!).

The Counter operation mode uses an initial counter & random initialization vector (IV).
Both are created randomly for each file and stored in a 4K (default size) block that is prefixed to that file. The `EncryptedEnv` implementation is such that clients of the `Env` class do not see this prefix (nor data, nor in filesize).
The largest part of the prefix block is also encrypted, and there is room left for implementation specific settings/values/keys in there.

To test the encryption, the `DBTestBase` class has been extended to consider a new environment variable called `ENCRYPTED_ENV`. If set, the test will setup a encrypted instance of the `Env` class to use for all tests.
Typically you would run it like this:

```
ENCRYPTED_ENV=1 make check_some
```

There is also an added test that checks that some data inserted into the database is or is not "visible" on disk. With `ENCRYPTED_ENV` active it must not find plain text strings, with `ENCRYPTED_ENV` unset, it must find the plain text strings.
Closes https://github.com/facebook/rocksdb/pull/2424

Differential Revision: D5322178

Pulled By: sdwilsh

fbshipit-source-id: 253b0a9c2c498cc98f580df7f2623cbf7678a27f
2017-06-26 16:56:24 -07:00
..
utilities Optimize for serial commits in 2PC 2017-06-24 14:11:29 -07:00
advanced_options.h fixed wrong type for "allow_compaction" parameter 2017-06-23 09:41:19 -07:00
c.h Add missing index type to C-API 2017-06-01 11:27:04 -07:00
cache.h Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
cleanable.h Pinnableslice (2nd attempt) 2017-03-13 11:54:10 -07:00
compaction_filter.h Fix interaction between CompactionFilter::Decision::kRemoveAndSkipUnt… 2017-06-02 15:11:38 -07:00
compaction_job_stats.h Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
comparator.h Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
convenience.h Allow ignoring unknown options when loading options from a file 2017-06-13 16:58:01 -07:00
db_bench_tool.h Separeate main from bench functionality to allow cusomizations 2016-02-16 06:17:31 -08:00
db_dump_tool.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
db.h Optimize for serial commits in 2PC 2017-06-24 14:11:29 -07:00
env_encryption.h Encryption at rest support 2017-06-26 16:56:24 -07:00
env.h Encryption at rest support 2017-06-26 16:56:24 -07:00
experimental.h Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
filter_policy.h Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
flush_block_policy.h Configure index partition size 2017-03-28 12:09:12 -07:00
iostats_context.h using ThreadLocalPtr to hide ROCKSDB_SUPPORT_THREAD_LOCAL from public… 2017-06-02 17:26:19 -07:00
iterator.h Pinnableslice (2nd attempt) 2017-03-13 11:54:10 -07:00
ldb_tool.h Allow Users to change customized ldb tools' header in help printing 2017-03-21 17:39:12 -07:00
listener.h Introduce OnBackgroundError callback 2017-06-22 19:41:50 -07:00
memtablerep.h Improve write buffer manager (and allow the size to be tracked in block cache) 2017-06-02 14:26:56 -07:00
merge_operator.h [rocksdb][PR] Remove option min_partial_merge_operands and verify_checksums_in_comp… 2017-02-23 15:09:12 -08:00
metadata.h Sample number of reads per SST file 2017-06-12 07:12:08 -07:00
options.h Optimize for serial commits in 2PC 2017-06-24 14:11:29 -07:00
perf_context.h revert perf_context and io_stats to __thread 2017-06-26 15:27:17 -07:00
perf_level.h using ThreadLocalPtr to hide ROCKSDB_SUPPORT_THREAD_LOCAL from public… 2017-06-02 17:26:19 -07:00
persistent_cache.h Dump persistent cache options 2016-12-19 14:09:12 -08:00
rate_limiter.h Call RateLimiter for compaction reads 2017-06-13 14:56:46 -07:00
slice_transform.h default implementation for InRange 2017-06-18 12:42:42 -07:00
slice.h Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
snapshot.h Add GPLv2 as an alternative license. 2017-04-27 18:06:12 -07:00
sst_dump_tool.h Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
sst_file_manager.h Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
sst_file_writer.h fixed typo 2017-06-13 16:58:01 -07:00
statistics.h Synchronize statistic enumeration values between statistics.h and java API 2017-06-14 16:59:42 -07:00
status.h Limit maximum memory used in the WriteBatch representation 2017-04-10 15:42:26 -07:00
table_properties.h record index partition properties 2017-06-13 11:21:32 -07:00
table.h Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
thread_status.h Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
threadpool.h New API for background work in single thread pool 2017-05-23 11:12:27 -07:00
transaction_log.h Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
types.h Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
universal_compaction.h Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
version.h bump version to 5.6 2017-06-05 16:15:21 -07:00
wal_filter.h Avoid overloaded virtual function 2016-03-22 17:10:31 -07:00
write_batch_base.h Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
write_batch.h Fixed some spelling mistakes 2017-05-17 23:12:36 -07:00
write_buffer_manager.h WriteBufferManager will not trigger flush if much data is already being flushed 2017-06-21 10:41:37 -07:00