| 112 | } |
| 113 | |
| 114 | KeyEncryptionKey FileKeyWrapper::CreateKeyEncryptionKey( |
| 115 | const std::string& master_key_id) { |
| 116 | SecureString kek_bytes(kKeyEncryptionKeyLength, '\0'); |
| 117 | RandBytes(kek_bytes.as_span().data(), kKeyEncryptionKeyLength); |
| 118 | |
| 119 | std::string kek_id(kKeyEncryptionKeyIdLength, '\0'); |
| 120 | RandBytes(reinterpret_cast<uint8_t*>(kek_id.data()), kKeyEncryptionKeyIdLength); |
| 121 | |
| 122 | // Encrypt KEK with Master key |
| 123 | std::string encoded_wrapped_kek = kms_client_->WrapKey(kek_bytes, master_key_id); |
| 124 | |
| 125 | return KeyEncryptionKey(std::move(kek_bytes), std::move(kek_id), |
| 126 | std::move(encoded_wrapped_kek)); |
| 127 | } |
| 128 | |
| 129 | } // namespace parquet::encryption |
no test coverage detected