Full name: projects.locations.keyRings.cryptoKeys.encrypt
Encrypts data, so that it can only be recovered by a call to cryptoKeys.decrypt
. The CryptoKey.purpose
must be ENCRYPT_DECRYPT
.
HTTP request
POST https://cloudkms.googleapis.com/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}:encrypt
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
name |
Required. The resource name of the If a Authorization requires the following Google IAM permission on the specified resource
|
Request body
The request body contains data with the following structure:
JSON representation | |
---|---|
{ "plaintext": string, "additionalAuthenticatedData": string } |
Fields | |
---|---|
plaintext |
Required. The data to encrypt. Must be no larger than 64KiB. The maximum size depends on the key version's A base64-encoded string. |
additionalAuthenticatedData |
Optional. Optional data that, if specified, must also be provided during decryption through The maximum size depends on the key version's A base64-encoded string. |
Response body
If successful, the response body contains data with the following structure:
Response message for KeyManagementService.Encrypt
.
JSON representation | |
---|---|
{ "name": string, "ciphertext": string } |
Fields | |
---|---|
name |
The resource name of the |
ciphertext |
The encrypted data. A base64-encoded string. |
Authorization Scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/cloudkms
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.