In the double wrapping mode, each "data encryption key" (DEK) is encrypted with a “key encryption key” (KEK), that in turn is encrypted with a "master encryption key" (MEK). In a writer process, a random KEK is generated for each MEK ID, and cached in a map. This allows to perform an interaction with a KMS server only once for each MEK, in order to wrap its KEK. "Data encryption key
| 32 | // MEK, in order to wrap its KEK. "Data encryption key" (DEK) wrapping is performed |
| 33 | // locally, and does not involve an interaction with a KMS server. |
| 34 | class KeyEncryptionKey { |
| 35 | public: |
| 36 | KeyEncryptionKey(::arrow::util::SecureString kek_bytes, std::string kek_id, |
| 37 | std::string encoded_wrapped_kek) |
| 38 | : kek_bytes_(std::move(kek_bytes)), |
| 39 | kek_id_(std::move(kek_id)), |
| 40 | encoded_kek_id_(::arrow::util::base64_encode(kek_id_)), |
| 41 | encoded_wrapped_kek_(std::move(encoded_wrapped_kek)) {} |
| 42 | |
| 43 | const ::arrow::util::SecureString& kek_bytes() const { return kek_bytes_; } |
| 44 | |
| 45 | const std::string& kek_id() const { return kek_id_; } |
| 46 | |
| 47 | const std::string& encoded_kek_id() const { return encoded_kek_id_; } |
| 48 | |
| 49 | const std::string& encoded_wrapped_kek() const { return encoded_wrapped_kek_; } |
| 50 | |
| 51 | private: |
| 52 | ::arrow::util::SecureString kek_bytes_; |
| 53 | std::string kek_id_; |
| 54 | std::string encoded_kek_id_; |
| 55 | std::string encoded_wrapped_kek_; |
| 56 | }; |
| 57 | |
| 58 | } // namespace parquet::encryption |
no outgoing calls
no test coverage detected