Decrypts the ciphertext that is specified by using CiphertextBlob.
Usage notes
- Keys outside Key Management Service (KMS) instances: To perform cryptographic operations, use Alibaba Cloud SDK to call operations.
- Keys in KMS instances: To perform cryptographic operations, use one of the following methods:
- Method 1 (recommended): Use KMS Instance SDK to call KMS Instance API operations. For more information, see KMS Instance SDK and KMS Instance API.
- Method 2: Use Alibaba Cloud SDK to call operations. The authentication method supports only RAM roles whose trusted entities are Alibaba Cloud services. For more information, see Create a RAM role for a trusted Alibaba Cloud service.
QPS limits
You can call this operation up to 750 times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
Debugging
Request parameters
Parameter |
Type |
Required |
Example |
Description |
Action | String | Yes | Decrypt | The operation that you want to perform. Set the value to Decrypt. |
CiphertextBlob | String | Yes | DZhOWVmZDktM2QxNi00ODk0LWJkNGYtMWZjNDNmM2YyYWJmaaSl+TztSIMe43nbTH/Z1Wr4XfLftKhAciUmDQXuMRl4WTvKhxjMThjK**** | The ciphertext. You can generate the ciphertext by calling the following operations: |
EncryptionContext | Map | No | {"Example":"Example"} | The JSON string that consists of key-value pairs. Note If you specify EncryptionContext when you call the GenerateDataKey, Encrypt, or GenerateDataKeyWithoutPlaintext operation, an equivalent value is required when you call the Decrypt operation. For more information, see EncryptionContext. |
Response parameters
Parameter |
Type |
Example |
Description |
KeyVersionId | String | 2ab1a983-7072-4bbc-a582-584b5bd8**** | The version ID of the key that is used to decrypt the ciphertext. |
KeyId | String | 202b9877-5a25-46e3-a763-e20791b5**** | The ID of the key that is used to decrypt the ciphertext. The ID must be globally unique. |
RequestId | String | 207596a2-36d3-4840-b1bd-f87044699bd7 | The ID of the request. |
Plaintext | String | tRYXuCwgja12xxO1N/gZERDDCLw9doZEQiPDk/Bv**** | The plaintext. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=Decrypt
&CiphertextBlob=DZhOWVmZDktM2QxNi00ODk0LWJkNGYtMWZjNDNmM2YyYWJmaaSl+TztSIMe43nbTH/Z1Wr4XfLftKhAciUmDQXuMRl4WTvKhxjMThjK****
&Common request parameters
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<DecryptResponse>
<KeyVersionId>2ab1a983-7072-4bbc-a582-584b5bd8****</KeyVersionId>
<KeyId>202b9877-5a25-46e3-a763-e20791b5****</KeyId>
<RequestId>207596a2-36d3-4840-b1bd-f87044699bd7</RequestId>
<Plaintext>tRYXuCwgja12xxO1N/gZERDDCLw9doZEQiPDk/Bv****</Plaintext>
</DecryptResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"KeyVersionId" : "2ab1a983-7072-4bbc-a582-584b5bd8****",
"KeyId" : "202b9877-5a25-46e3-a763-e20791b5****",
"RequestId" : "207596a2-36d3-4840-b1bd-f87044699bd7",
"Plaintext" : "tRYXuCwgja12xxO1N/gZERDDCLw9doZEQiPDk/Bv****"
}
Error codes
HTTP status code |
Error code |
Error message |
Description |
400 | UnsupportedOperation | This action is not supported. | The operation is not supported. |
404 | Forbidden.AliasNotFound | The specified Alias is not found. | The specified alias is not found. |
404 | Forbidden.KeyNotFound | The specified Key is not found. | The specified key does not exist. |
409 | Rejected.Disabled | The request was rejected because the key state is Disabled. | The request is denied because the key is disabled. |
409 | Rejected.PendingDeletion | The request was rejected because the key state is PendingDeletion. | The request is denied because the key is in the Pending Deletion state. |
409 | Rejected.Unavailable | The request was rejected because the key state is Unavailable. | The request is denied because the key is unavailable. |
For a list of error codes, see Service error codes.