-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Encryption at rest support #2424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8d846d8
Merge pull request #1 from facebook/master
ewoutp 9d446a6
Encryption (wip) (#2)
ewoutp b452426
Added GenerateUniqueId override
ewoutp 66a5ef2
Imported changed from facebook-master
ewoutp 64fccc8
Merge pull request #5 from arangodb-helper/facebook-master
ewoutp 47c909b
Removed unwanted likes (see review https://github.com/facebook/rocksd…
ewoutp d677055
db_encryption_test.cc to TARGETS file (see review https://github.com/…
ewoutp 28d8074
Commented `std::cout` in test (see review https://github.com/facebook…
ewoutp c688186
Exclude encryption implementation on ROCKSDB_LITE
ewoutp 19ee74c
Excluded headers on ROCKSDB_LITE
ewoutp 49e5f81
Processed sagar0's review comments
ewoutp ae3ed39
Merge branch 'master' into master
sagar0 80920f5
Merge branch 'master' into master
sdwilsh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. | ||
// This source code is licensed under the BSD-style license found in the | ||
// LICENSE file in the root directory of this source tree. An additional grant | ||
// of patent rights can be found in the PATENTS file in the same directory. | ||
// This source code is also licensed under the GPLv2 license found in the | ||
// COPYING file in the root directory of this source tree. | ||
// | ||
#include "db/db_test_util.h" | ||
#include "port/stack_trace.h" | ||
#include "rocksdb/perf_context.h" | ||
#if !defined(ROCKSDB_LITE) | ||
#include "util/sync_point.h" | ||
#endif | ||
#include <iostream> | ||
#include <string> | ||
|
||
namespace rocksdb { | ||
|
||
class DBEncryptionTest : public DBTestBase { | ||
public: | ||
DBEncryptionTest() : DBTestBase("/db_encryption_test") {} | ||
}; | ||
|
||
#ifndef ROCKSDB_LITE | ||
|
||
TEST_F(DBEncryptionTest, CheckEncrypted) { | ||
ASSERT_OK(Put("foo567", "v1.fetdq")); | ||
ASSERT_OK(Put("bar123", "v2.dfgkjdfghsd")); | ||
Close(); | ||
|
||
// Open all files and look for the values we've put in there. | ||
// They should not be found if encrypted, otherwise | ||
// they should be found. | ||
std::vector<std::string> fileNames; | ||
auto status = env_->GetChildren(dbname_, &fileNames); | ||
ASSERT_OK(status); | ||
|
||
auto defaultEnv = Env::Default(); | ||
int hits = 0; | ||
for (auto it = fileNames.begin() ; it != fileNames.end(); ++it) { | ||
if ((*it == "..") || (*it == ".")) { | ||
continue; | ||
} | ||
auto filePath = dbname_ + "/" + *it; | ||
unique_ptr<SequentialFile> seqFile; | ||
auto envOptions = EnvOptions(CurrentOptions()); | ||
status = defaultEnv->NewSequentialFile(filePath, &seqFile, envOptions); | ||
ASSERT_OK(status); | ||
|
||
uint64_t fileSize; | ||
status = defaultEnv->GetFileSize(filePath, &fileSize); | ||
ASSERT_OK(status); | ||
|
||
std::string scratch; | ||
scratch.reserve(fileSize); | ||
Slice data; | ||
status = seqFile->Read(fileSize, &data, (char*)scratch.data()); | ||
ASSERT_OK(status); | ||
|
||
if (data.ToString().find("foo567") != std::string::npos) { | ||
hits++; | ||
//std::cout << "Hit in " << filePath << "\n"; | ||
} | ||
if (data.ToString().find("v1.fetdq") != std::string::npos) { | ||
hits++; | ||
//std::cout << "Hit in " << filePath << "\n"; | ||
} | ||
if (data.ToString().find("bar123") != std::string::npos) { | ||
hits++; | ||
//std::cout << "Hit in " << filePath << "\n"; | ||
} | ||
if (data.ToString().find("v2.dfgkjdfghsd") != std::string::npos) { | ||
hits++; | ||
//std::cout << "Hit in " << filePath << "\n"; | ||
} | ||
if (data.ToString().find("dfgk") != std::string::npos) { | ||
hits++; | ||
//std::cout << "Hit in " << filePath << "\n"; | ||
} | ||
} | ||
if (encrypted_env_) { | ||
ASSERT_EQ(hits, 0); | ||
} else { | ||
ASSERT_GE(hits, 4); | ||
} | ||
} | ||
|
||
#endif // ROCKSDB_LITE | ||
|
||
} // namespace rocksdb | ||
|
||
int main(int argc, char** argv) { | ||
rocksdb::port::InstallStackTraceHandler(); | ||
::testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.