empiredan commented on code in PR #1706: URL: https://github.com/apache/incubator-pegasus/pull/1706#discussion_r1472821865
########## src/replica/kms_key_provider.h: ########## @@ -0,0 +1,56 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include <string> +#include <utility> +#include <vector> + +#include "security/kms_client.h" +#include "utils/errors.h" + +namespace dsn { +namespace replication { +struct kms_info; +} // namespace replication + +namespace security { +// This class generates EEK IV KV from KMS (a.k.a Key Management Service) and retrieves DEK from +// KMS. +class KMSKeyProvider Review Comment: ```suggestion class kms_key_provider ``` ########## src/replica/replica_stub.h: ########## @@ -459,6 +462,7 @@ class replica_stub : public serverlet<replica_stub>, public ref_counter std::unique_ptr<duplication_sync_timer> _duplication_sync_timer; std::unique_ptr<replica_backup_server> _backup_server; + std::unique_ptr<dsn::security::KMSKeyProvider> key_provider; Review Comment: ```suggestion std::unique_ptr<dsn::security::KMSKeyProvider> _key_provider; ``` ########## src/security/kms_client.h: ########## @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include <algorithm> +#include <string> +#include <utility> +#include <vector> + +#include "utils/errors.h" + +namespace dsn { +namespace replication { +struct kms_info; +} // namespace replication + +namespace security { +// A class designed to generate an encryption key from KMS for file writing, +// implemented using an HTTP client. +// This class is not thread-safe. Thus maintain one instance for each thread. +class KMSClient Review Comment: ```suggestion class kms_client ``` ########## src/replica/replication_app_base.h: ########## @@ -85,6 +85,24 @@ class replica_app_info error_code store(const std::string &fname); }; +// This class stores and loads EEK, IV, and KV from KMS as a JSON file. +// To get the decrypted key, should POST EEK, IV, and KV to KMS. +struct kms_info +{ + std::string eek; // a.k.a encrypted encryption key + std::string iv; // a.k.a initialization vector + std::string kv; // a.k.a key version Review Comment: These abbr. were confusing, `kv` are usually means key/value. Use `key_version`, `encrypted_key` instead. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
