Discovery generated call table (918 rows), typed services, /google/data demo. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
51 lines
2.7 KiB
C++
51 lines
2.7 KiB
C++
#pragma once
|
|
|
|
// Cloud KMS v1: key rings, crypto keys, versions, public keys, encrypt,
|
|
// decrypt, asymmetric sign, MAC sign. Key creation, rotation and destruction
|
|
// are not typed here: use ApiService::invoke("cloudkms....") deliberately.
|
|
|
|
#include <string>
|
|
|
|
#include "google/data/project_service.h"
|
|
|
|
namespace molo::google::data {
|
|
|
|
class Kms : public ProjectService {
|
|
public:
|
|
explicit Kms(std::shared_ptr<GoogleClient> client, CloudContext context)
|
|
: ProjectService(std::move(client), Api::kKms, std::move(context)) {}
|
|
|
|
std::string key_ring_name(const std::string& location, const std::string& ring) const;
|
|
std::string key_name(const std::string& location, const std::string& ring,
|
|
const std::string& key) const;
|
|
std::string version_name(const std::string& location, const std::string& ring,
|
|
const std::string& key, const std::string& version) const;
|
|
|
|
clients::body::Json list_locations(int page_size) const;
|
|
clients::body::Json list_key_rings(const std::string& location, int page_size) const;
|
|
clients::body::Json get_key_ring(const std::string& location, const std::string& ring) const;
|
|
clients::body::Json list_keys(const std::string& location, const std::string& ring,
|
|
int page_size) const;
|
|
clients::body::Json get_key(const std::string& location, const std::string& ring,
|
|
const std::string& key) const;
|
|
clients::body::Json list_versions(const std::string& location, const std::string& ring,
|
|
const std::string& key, int page_size) const;
|
|
clients::body::Json get_public_key(const std::string& location, const std::string& ring,
|
|
const std::string& key, const std::string& version) const;
|
|
|
|
// Symmetric: plaintext and ciphertext are raw bytes here, base64 on the wire.
|
|
// The ciphertext in the response stays base64 (field "ciphertext").
|
|
clients::body::Json encrypt(const std::string& location, const std::string& ring,
|
|
const std::string& key, const std::string& plaintext,
|
|
const std::string& aad) const;
|
|
clients::body::Json decrypt(const std::string& location, const std::string& ring,
|
|
const std::string& key, const std::string& ciphertext_base64,
|
|
const std::string& aad) const;
|
|
// Asymmetric sign over a SHA-256 digest (32 raw bytes).
|
|
clients::body::Json sign_digest(const std::string& location, const std::string& ring,
|
|
const std::string& key, const std::string& version,
|
|
const std::string& sha256_digest) const;
|
|
};
|
|
|
|
} // namespace molo::google::data
|