tencent cloud

GetDataKeyPlaintext
Last updated: 2025-12-04 15:44:13
GetDataKeyPlaintext
Last updated: 2025-12-04 15:44:13

1. API Description

Domain name for API request: kms.intl.tencentcloudapi.com.

This API is used to retrieve the key plaintext.

A maximum of 300 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: GetDataKeyPlaintext.
Version Yes String Common Params. The value used for this API: 2019-01-18.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
DataKeyId Yes String Unique id of a data key.
EncryptionPublicKey No String PEM formatted public key string, supporting RSA2048 and SM2 public keys, and used to encrypt the plaintext value in the returned data. If it is empty, plaintext value will not be encrypted.
EncryptionAlgorithm No String Asymmetric encryption algorithm, used in conjunction with EncryptionPublicKey to encrypt the returned data. It currently supports SM2 (returns ciphertext in C1C3C2 format), SM2_C1C3C2_ASN1 (returns ciphertext in C1C3C2 ASN1 format), RSAES_PKCS1_V1_5, RSAES_OAEP_SHA_1, and RSAES_OAEP_SHA_256. If it is empty, the default value SM2 is used.

3. Output Parameters

Parameter Name Type Description
Plaintext String If EncryptionPublicKey is not provided during the call, the field value is the plaintext encoded in Base64, and the Base64 decoding is required to obtain the plaintext. If EncryptionPublicKey is provided during the call, the field value is the ciphertext asymmetrically encrypted with the EncryptionPublicKey and encoded in Base64. After Base64 decoding, the private key corresponding to the user-uploaded public key is used for further decryption to obtain the plaintext.
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Retrieving the Data Key Plaintext Example

Obtain the plaintext of the data key

Input Example

POST / HTTP/1.1
Host: kms.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: GetDataKeyPlaintext
<Common request parameters>

{
    "DataKeyId": "cb0f16e6-4f49-11f0-b672-52540073b995"
}

Output Example

{
    "Response": {
        "Plaintext": "3434",
        "RequestId": "bd05b0b7-8019-44cf-a67e-fd9a940cee82"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
AuthFailure.UnauthorizedOperation Unauthorized operation.
FailedOperation.EncryptionError Encryption failed.
InternalError Internal error.
InvalidParameterValue Incorrect parameter value.
InvalidParameterValue.InvalidDataKeyId Invalid data key ID.
InvalidParameterValue.InvalidType Incorrect Type parameter.
ResourceUnavailable.CmkDisabled The CMK has been disabled.
ResourceUnavailable.CmkNotFound The CMK does not exist.
ResourceUnavailable.CmkStateNotSupport This operation cannot be performed under the current CMK status.
ResourceUnavailable.DataKeyDisabled The data key is disabled.
ResourceUnavailable.DataKeyNotFound The data key does not exist.
ResourceUnavailable.DataKeyPendingDelete The data key is scheduled for deletion.
UnauthorizedOperation Unauthorized operation.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback