32#include <unordered_map>
49 std::vector<uint8_t> key;
50 std::vector<uint8_t> wrapped_key;
57 const std::unordered_map<std::string, std::string>& ) {
65 std::string_view wrapping_key_id) = 0;
69 std::string_view wrapping_key_id) = 0;
76 return NotSupported(
"Key generation is not supported by this KMS client");
95 static constexpr std::string_view kKmsType =
"encryption.kms-type";
96 static constexpr std::string_view kKmsImpl =
"encryption.kms-impl";
97 static constexpr std::string_view kKmsTypeAws =
"aws";
98 static constexpr std::string_view kKmsTypeGcp =
"gcp";
99 static constexpr std::string_view kKmsTypeAzure =
"azure";
101 using Properties = std::unordered_map<std::string, std::string>;
102 using Factory = std::function<Result<std::unique_ptr<KeyManagementClient>>()>;
108 static void Register(std::string name, Factory factory);
112 const Properties& properties);
119 const Properties& properties);
Wraps and unwraps secret keys with master keys kept in a KMS.
Definition key_management_client.h:45
virtual bool SupportsKeyGeneration() const
Whether the KMS can generate keys (GenerateKey).
Definition key_management_client.h:72
virtual Result< GeneratedKey > GenerateKey(std::string_view)
Generate a new key in the KMS, returned in plain and wrapped form.
Definition key_management_client.h:75
virtual Status Initialize(const std::unordered_map< std::string, std::string > &)
Initialize the client with the catalog properties.
Definition key_management_client.h:56
virtual Result< std::vector< uint8_t > > UnwrapKey(std::span< const uint8_t > wrapped_key, std::string_view wrapping_key_id)=0
Unwrap a key returned by WrapKey.
virtual Result< std::vector< uint8_t > > WrapKey(std::span< const uint8_t > key, std::string_view wrapping_key_id)=0
Wrap (encrypt) a secret key with the master key wrapping_key_id.
Creates KMS clients by name.
Definition key_management_client.h:93
static Result< std::shared_ptr< KeyManagementClient > > Load(std::string_view name, const Properties &properties)
Create and initialize the client registered under name.
static void Register(std::string name, Factory factory)
Register a client factory under name, replacing any previous one.
static Result< std::shared_ptr< KeyManagementClient > > FromCatalogProperties(const Properties &properties)
Create the KMS client configured by catalog properties.
Definition expected.h:1199
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:34
Define Result, Status, and error helpers.
A generated key and its wrapped form.
Definition key_management_client.h:48