canonical: https://jentic.com/apis/googleapis.com/cloudkms

# Google Cloud Key Management Service (KMS) API

Google Cloud KMS is the managed service for cryptographic keys and operations on Google Cloud. The API exposes key rings, crypto keys, key versions, import jobs, and EKM connections, along with cryptographic operations such as encrypt, decrypt, asymmetric sign, asymmetric decrypt, and MAC sign and verify. Agents can rotate keys, restore destroyed key versions within the destruction window, generate cryptographically random bytes, and retrieve a key version's public key for asymmetric verification.

## For AI agents

Manage Google Cloud encryption keys and perform encrypt, decrypt, sign, verify, and key-rotation operations. Useful for at-rest encryption, signing, and secrets-protection workflows on GCP.

## Scope

Does not store application secrets, manage user credentials, or issue TLS certificates - use for cryptographic key management and crypto operations only.

## Capabilities

- Encrypt and decrypt arbitrary payloads with a symmetric key version
- Sign and verify payloads using asymmetric crypto keys
- Asymmetrically decrypt ciphertext using a private key version
- Rotate, destroy, restore, and disable individual key versions
- Generate cryptographically random bytes via the dedicated random endpoint
- Retrieve a key version's public key for offline verification
- Configure import jobs and EKM connections for external key material

## Use cases

### Application-Level Envelope Encryption

Backend services use Cloud KMS to encrypt a per-record data encryption key (DEK) under a KMS-managed key encryption key (KEK), then store the wrapped DEK alongside the ciphertext. The encrypt and decrypt endpoints handle the wrap and unwrap; the underlying KEK never leaves Google's HSMs. Setup is small, and the pattern scales to millions of records without exposing key material to the application.

Example prompt: Call POST /v1/{name}:encrypt on the crypto key with the plaintext DEK, store the returned ciphertext, then POST /v1/{name}:decrypt when the DEK is needed

### Programmatic Key Rotation

Compliance pipelines rotate encryption keys on a fixed schedule by patching the crypto key to set a new primary version, or by creating a new version and updating dependent services. Cloud KMS retains old versions so previously encrypted data continues to decrypt, and the rotation event is audit-logged for compliance evidence.

Example prompt: Call PATCH on the crypto key resource with primaryVersion set to the new version name, then verify with GET on the crypto key

### Asymmetric Signing for JWTs and Code

Services that issue JWTs or sign release artefacts use asymmetricSign with an EC or RSA key version. The private key never leaves Google's HSMs; verifiers download the public key once via getPublicKey and verify offline. This eliminates a class of key-leakage risk and gives a fully audit-logged signing surface.

Example prompt: Call POST /v1/{name}:asymmetricSign on the EC key version with the digest, then publish the public key returned by /v1/{name}/publicKey

### AI Agent Crypto Operator via Jentic

An agent invoked by a security engineer searches Jentic for the right Cloud KMS operation, performs an encrypt or sign on behalf of a calling service, and returns the result. Through Jentic, the agent never holds the underlying service account key - Jentic injects a scoped token at execution time so cryptographic operations leave a clear audit trail.

Example prompt: Search Jentic for 'encrypt with google cloud kms', execute against POST /v1/{name}:encrypt with the plaintext, and return the resulting ciphertext

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /v1/{+name}:encrypt | Encrypt plaintext with a crypto key |
| POST | /v1/{+name}:decrypt | Decrypt ciphertext with a crypto key |
| POST | /v1/{+name}:asymmetricSign | Sign a digest with an asymmetric key version |
| POST | /v1/{+name}:asymmetricDecrypt | Decrypt with an asymmetric private key version |
| POST | /v1/{+name}:destroy | Schedule a crypto key version for destruction |
| POST | /v1/{+location}:generateRandomBytes | Generate cryptographically random bytes |
| GET | /v1/{+name}/publicKey | Retrieve the public key of an asymmetric key version |
| PATCH | /v1/{+name} | Update a crypto key, including its primary version |

## Key resources

- **KeyRings** — Containers that group crypto keys within a region
- **CryptoKeys** — Logical encryption keys with one or more versions and rotation policy
- **CryptoKeyVersions** — Specific versions of a crypto key used for individual cryptographic operations
- **ImportJobs** — Jobs that import externally generated key material into Cloud KMS
- **EkmConnections** — Connections to External Key Manager services for customer-managed external keys

## Why Jentic

- **Setup:** Wiring the Cloud KMS API by hand means setting up Google OAuth 2.0, minting short-lived tokens against the cloudkms scope, and addressing each key by resource name against cloudkms.googleapis.com yourself. Through Jentic you install once, import the Cloud KMS API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** Cloud KMS puts the key resource name in the URL path (/v1/{+name}:encrypt, /v1/{+name}:decrypt), so a rule can pin your agent to one key: it can encrypt and decrypt with that key and nothing else. You choose the operations it may call, so key-version destroy or asymmetric signing are not included unless you add them.
- **Credential handling:** Your Cloud KMS OAuth credential is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'encrypt data with Cloud KMS' or 'get a key's public key', and Jentic returns the matching Cloud KMS operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Secret Manager API** — Stores application secrets that are encrypted at rest using Cloud KMS keys
- **Identity and Access Management (IAM) API** — Grants the cloudkms roles that gate Cloud KMS operations
- **Cloud Asset API** — Inventory and IAM analysis surface that can audit who has access to KMS keys

## FAQ

### What authentication does the Cloud KMS API use?

The Cloud KMS API uses OAuth 2.0 with the cloudkms or cloud-platform scope. Tokens are issued for a Google service account or end user and the caller must hold the appropriate cloudkms.cryptoKeyEncrypterDecrypter or related role. Through Jentic, the OAuth credential lives in your Jentic One instance and the agent receives a short-lived access token only - the underlying credential never enters agent context.

### Can I encrypt and decrypt data with this API?

Yes. POST /v1/{name}:encrypt with a base64 plaintext on a symmetric crypto key returns ciphertext; POST /v1/{name}:decrypt reverses it. The same key resource is used for both operations, and Cloud KMS automatically uses the primary version for encryption while still able to decrypt with any prior version.

### What are the rate limits for the Cloud KMS API?

Cloud KMS quotas are published per-method in the Google Cloud console under the Cloud KMS API quota page; typical defaults are several thousand cryptographic operations per minute per project, with lower limits on key creation and import-job operations. HSM-protected keys have separate, lower quotas than software keys.

### How do I rotate a key through Jentic?

Search Jentic for 'rotate google cloud kms key' and execute the returned operation against PATCH /v1/{name} on the crypto key with primaryVersion set to a new version name. Existing ciphertext continues to decrypt with the old version while new encryptions use the new primary.

### Can I generate cryptographically random bytes with Cloud KMS?

Yes. POST /v1/{location}:generateRandomBytes with a length and a protectionLevel (SOFTWARE or HSM) returns a base64-encoded random byte string. This is useful for generating session tokens, salts, or DEKs without trusting client-side RNGs.

### Is Cloud KMS free?

Cloud KMS charges per active key version per month plus per cryptographic operation, with HSM-protected keys priced higher than software keys; the full schedule is documented on the Cloud KMS pricing page. EKM and external key material have their own pricing tiers.

### Can I limit what my agent is allowed to do with the Google Cloud KMS API?

Yes. Because Cloud KMS puts the key resource name in the URL path for calls like POST /v1/{name}:encrypt and POST /v1/{name}:decrypt, a rule in your self-hosted Jentic One instance can pin the agent to a single key so it can encrypt and decrypt with that key and nothing else. You decide which operations the agent may call, so destructive or signing actions such as POST /v1/{name}:destroy or POST /v1/{name}:asymmetricSign stay off limits unless you add them. Your own rules govern which operations and which OAuth credential the agent is allowed to use at execution time.
