Symmetric Encryption
The table below lists only the unique request parameters for this interface and some common parameters. For more information, see Common Parameters.
const columns = [ { width: '20%', title: 'Parameter', dataIndex: 'Name', className: 'openapi-doc-parameter-table-name' }, { width: 130, title: 'Type', dataIndex: 'DataType', className: 'openapi-doc-parameter-table-type' }, { width: 90, title: 'Required', dataIndex: 'IsRequired', className: 'openapi-doc-parameter-table-required' }, { width: '20%', title: 'Example', dataIndex: 'Example', className: 'openapi-doc-parameter-table-example' }, { title: 'Description', dataIndex: 'Description', className: 'openapi-doc-parameter-table-description' }, ]; const data = [ { rowKey: '->Action', Name: 'Action', DataType: 'String', IsRequired: 'Yes', Example: <RenderMd content={"Encrypt"} />, Description: <RenderMd content={"The operation to perform, values: Encrypt."} />, children: [ ] }, { rowKey: '->Version', Name: 'Version', DataType: 'String', IsRequired: 'Yes', Example: <RenderMd content={"2021-02-18"} />, Description: <RenderMd content={"API version, value: 2021-02-18."} />, children: [ ] }, { rowKey: '->KeyringName', Name: 'KeyringName', DataType: 'String', IsRequired: 'No', Example: <RenderMd content={"keyring-test"} />, Description: <RenderMd content={"Keyring name, length 2 - 31 characters. Valid characters: [a-zA-Z0-9-_]"} />, children: [ ] }, { rowKey: '->KeyName', Name: 'KeyName', DataType: 'String', IsRequired: 'No', Example: <RenderMd content={"key-test"} />, Description: <RenderMd content={"Primary key name, length 2 - 31 characters. Valid characters: [a-zA-Z0-9-_]"} />, children: [ ] }, { rowKey: '->KeyID', Name: 'KeyID', DataType: 'String', IsRequired: 'No', Example: <RenderMd content={"0324d9b3-c5d9-4b6f-94e7-884010a16fee"} />, Description: <RenderMd content={"Primary key ID, choose one:\nKeyringName and KeyName\nKeyID"} />, children: [ ] }, { rowKey: '->EncryptionContext', Name: 'EncryptionContext', DataType: 'String', IsRequired: 'No' Example: <RenderMd content={"{"user":"alice","path":"path/to/alice/plaintext.txt"}"} />, Description: <RenderMd content={"A JSON string of key/value pairs."} /> If this parameter is specified, the same parameter must be provided when calling Decrypt. "} />, children: [ ] }, { rowKey: '->Plaintext', Name: 'Plaintext', DataType: 'String', IsRequired: 'yes', Example: <RenderMd content={"tWB54tTvEu47YjRjuuj+fAt5PskpUaqwsjLeEy4YMNg="} />, Description: <RenderMd content={"Base64 encoding of the encrypted plaintext, value range: [1, 4096]"} />, children: [ ] }, ]; return (<Table rowKey="rowKey" className="openapi-doc-parameter-table" columns={columns} data={data} border={ { cell: true, wrapper: true } } scroll={ { x: "auto" } } pagination={false} />);
The following table lists only the response parameters unique to this interface. For more information, see response structure.
Parameter | Type | Example Value | Description |
|---|---|---|---|
CiphertextBlob | String | 43y7grE9TjamX4P7ZOHFbwAAqoNHFtMZ6RNyblKlEhIhrfP6zy034cwJN6MSqFGiDm8oiGqu2Rahs1aKPIcMjaOuodVCE1zYpDFg1QvgOHtVQxkQWhfpE8i8NibiJ1pL8ILgAE+TogQZuIglAoo= | ciphertext after plaintext encryption, base64 encoded |
POST /?Action=Encrypt&Version=2021-02-18&KeyringName=demo&KeyName=demo&KeyID=0324d9b3-c5d9-4b6f-94e7-884010a16fee HTTP/1.1 Host: kms.cn-beijing.volcengineapi.com Content-Type: application/json; charset=UTF-8 X-Date: 20240708T064450Z X-Content-Sha256: 287e874e******d653b44d21e Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20240708/cn-beijing/kms/request, SignedHeaders=host;x-content-sha256;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f { "Plaintext": "tWB54tTvEu47YjRjuuj+fAt5PskpUaqwsjLeEy4YMNg=" }
{ "ResponseMetadata": { "RequestId": "202407081445581770951421937A1E35", "Action": "Encrypt", "Version": "2021-02-18", "Service": "kms", "Region": "cn-beijing" }, "Result": { "CiphertextBlob": "43y7grE9TjamX4P7ZOHFbwAAqoNHFtMZ6RNyblKlEhIhrfP6zy034cwJN6MSqFGiDm8oiGqu2Rahs1aKPIcMjaOuodVCE1zYpDFg1QvgOHtVQxkQWhfpE8i8NibiJ1pL8ILgAE+TogQZuIglAoo=" } }
The table below lists error codes related to business logic for this interface. For common error codes, refer to the Common Error Codes document.
Status Code | Error Code | Description |
|---|---|---|
400 | InvalidParameter | |
400 | MissingParameter | |
400 | InvalidKeyStatus | |
403 | AccessDenied | |
403 | Reject.Throttling.CMK | |
403 | KeyMaterialExpire | |
404 | Not Found | |
500 | UndefinedError |