Key Management Service API, REST: SymmetricCrypto.encrypt
Encrypts given plaintext with the specified key.
HTTP request
POST https://kms.yandex/kms/v1/keys/{keyId}:encrypt
Path parameters
Parameter | Description |
---|---|
keyId | Required. ID of the symmetric KMS key to use for encryption. The maximum string length in characters is 50. |
Body parameters
{
"versionId": "string",
"aadContext": "string",
"plaintext": "string"
}
Field | Description |
---|---|
versionId | string ID of the key version to encrypt plaintext with. Defaults to the primary version if not specified. The maximum string length in characters is 50. |
aadContext | string (byte) Additional authenticated data (AAD context), optional. If specified, this data will be required for decryption with the The maximum string length in characters is 8192. |
plaintext | string (byte) Required. Plaintext to be encrypted. Should be encoded with base64. The maximum string length in characters is 32768. |
Response
HTTP Code: 200 - OK
{
"keyId": "string",
"versionId": "string",
"ciphertext": "string"
}
Field | Description |
---|---|
keyId | string Required. ID of the symmetric KMS key that was used for encryption. The maximum string length in characters is 50. |
versionId | string ID of the key version that was used for encryption. The maximum string length in characters is 50. |
ciphertext | string (byte) Resulting ciphertext. |