Skip to content

Commit

Permalink
feat(encryption): add kms key management
Browse files Browse the repository at this point in the history
  • Loading branch information
yujingwei committed Feb 1, 2024
1 parent 2418970 commit 3544ea7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/security/kms_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ dsn::error_s kms_client::DecryptEncryptionKey(const dsn::replication::kms_info &
}
RETURN_NOT_OK(err);
http_status_code http_status;
client.get_http_status(http_status);
RETURN_NOT_OK(client.get_http_status(http_status));
if (http_status != http_status_code::kOk) {
LOG_WARNING("The http status is ({}), and url is ({})",
get_http_status_message(http_status),
Expand Down Expand Up @@ -126,13 +126,13 @@ dsn::error_s kms_client::GenerateEncryptionKeyFromKMS(const std::string &key_nam
RETURN_NOT_OK(client.set_url(url));
RETURN_NOT_OK(client.with_get_method());
std::string resp;
auto err = client.exec_method(&resp);
const auto &err = client.exec_method(&resp);
if (err.code() == ERR_NETWORK_FAILURE || err.code() == ERR_TIMEOUT) {
continue;
}
RETURN_NOT_OK(err);
http_status_code http_status;
client.get_http_status(http_status);
RETURN_NOT_OK(client.get_http_status(http_status));
if (http_status != http_status_code::kOk) {
LOG_WARNING("The http status is ({}), and url is ({})",
get_http_status_message(http_status),
Expand Down
4 changes: 2 additions & 2 deletions src/utils/env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ rocksdb::Env *NewEncryptedEnv()
{
// Create an encryption provider.
std::shared_ptr<rocksdb::EncryptionProvider> provider;
auto provider_id = fmt::format(
const auto &provider_id = fmt::format(
"id=AES;hex_instance_key={};method={}", FLAGS_server_key, FLAGS_encryption_method);
auto s = rocksdb::EncryptionProvider::CreateFromString(
const auto &s = rocksdb::EncryptionProvider::CreateFromString(
rocksdb::ConfigOptions(), provider_id, &provider);
CHECK(s.ok(), "Failed to create encryption provider: {}", s.ToString());

Expand Down

0 comments on commit 3544ea7

Please sign in to comment.