tencent cloud

AsymmetricSm2Decrypt
Last updated: 2025-12-04 15:44:26
AsymmetricSm2Decrypt
Last updated: 2025-12-04 15:44:26

1. API Description

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

This API is used to decrypt data with the specified private key that is encrypted with SM2 asymmetric cryptographic algorithm. The ciphertext must be encrypted with the corresponding public key. The asymmetric key must be in Enabled state for decryption. The length of the ciphertext passed in cannot exceed 256 bytes.

A maximum of 200 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: AsymmetricSm2Decrypt.
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.
KeyId Yes String Unique CMK ID
Ciphertext Yes String Specifies that the ciphertext encrypted with PublicKey is Base64 encoded. the original ciphertext format needs to be C1C3C2_ASN1. the length of the original ciphertext cannot exceed 256 bytes.

3. Output Parameters

Parameter Name Type Description
KeyId String Unique CMK ID
Plaintext String Base64-encoded plaintext after decryption
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 Asymmetric Key Sm2 Decryption

Input Example

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

{
    "KeyId": "fce1015e-9735-11ef-be86-6abd61583d2d",
    "Ciphertext": "MG0CICuRefoqE7g5bpsZNYq+9d909cZl7nFuYFHiDhOqz8GAAiEA4lqmt3nGqpbu0qhbWsStkexXA2cA12nVWjgruFP5WKkEIG6JwYejm9gEr7CPOOhbirsGhga3W7J6C7kwdmf6VebRBATH1o2G"
}

Output Example

{
    "Response": {
        "KeyId": "fce1015e-9735-11ef-be86-6abd61583d2d",
        "Plaintext": "dGVzdA==",
        "RequestId": "e2e0945e-7e90-421a-bfc8-64999d789283"
    }
}

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
FailedOperation.DecryptError Decryption failed.
InternalError Internal error.
InvalidParameter Invalid parameter.
InvalidParameterValue.InvalidKeyId Invalid KeyId.
InvalidParameterValue.InvalidKeyUsage Incorrect KeyUsage parameter.
ResourceUnavailable.CmkNotFound The CMK does not exist.
ResourceUnavailable.CmkStateNotSupport This operation cannot be performed under the current CMK status.
UnauthorizedOperation Unauthorized operation.
UnsupportedOperation.UnsupportedKeyUsageInCurrentRegion The encryption method is not supported in the current region.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback