DescribeCertificatePrivateKey

Updated at:

Retrieves the private key (in encrypted format) of a single client certificate or server certificate.

Operation description

This operation applies only to certificates issued based on a system-generated certificate signing request (CSR). It is used to retrieve the private key (in encrypted format) of a client certificate or server certificate. Before you call this operation, you must call one of the following operations to issue a client certificate or server certificate:

To ensure the security of the private key during transmission, this operation encrypts the private key by using a private key password (an encryption string) that you specify, and returns the encrypted private key. After you obtain the private key in encrypted format, you can decrypt the private key by using one of the following methods:

  • If the encryption algorithm of the certificate is RSA, run the openssl rsa -in <Encrypted private key file> -passin pass:<Private key password> -out <Decrypted private key file> command on a computer where OpenSSL or BabaSSL is installed to decrypt the private key.

  • If the encryption algorithm of the certificate is ECC, run the openssl ec -in <Encrypted private key file> -passin pass:<Private key password> -out <Decrypted private key file> command on a computer where OpenSSL or BabaSSL is installed to decrypt the private key.

  • If the encryption algorithm of the certificate is SM2, run the openssl ec -in <Encrypted private key file> -passin pass:<Private key password> -out <Decrypted private key file> command on a computer where BabaSSL is installed to decrypt the private key.

Note

You can call the DescribeClientCertificate operation to query the encryption algorithm type of the client certificate or server certificate.

QPS limit

The queries per second (QPS) limit on this operation is 10 per user. If the limit is exceeded, API calls are throttled, which may affect your business. Call this operation as needed.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

yundun-cert:DescribeCertificatePrivateKey

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Identifier

string

Yes

The unique identifier of the client certificate or server certificate whose private key you want to retrieve.

Note

You can call the ListClientCertificate operation to query the unique identifiers of all client and server certificates.

END_ENTITY certificates are not supported by this operation. If you pass the identifier of an END_ENTITY certificate, NotFound is returned. The private keys of some CLIENT or SERVER certificates cannot be exported due to isolation policies. In this case, OperationDenied.NotSupport is returned. We recommend that you filter out END_ENTITY certificates based on the CertificateType parameter in the response of the ListClientCertificate operation before you call this operation.

bc37133bb7ed68c7938d928fd26d****

EncryptedCode

string

Yes

The password used to encrypt the private key. It can contain uppercase letters, lowercase letters, digits, and special characters such as ,, ., +, -, _, and #. The maximum length is 32 bytes.

Warning Remember the password that you specify. You will need this password to decrypt the private key in encrypted format. If you forget the password, you cannot decrypt the private key obtained in this call, and you must call this operation again.

!Demo@WS3ed

ResourceGroupId

string

No

The ID of the resource group to which the certificate belongs.

test

In addition to the operation-specific request parameters described in this topic, you must also include the common request parameters of Alibaba Cloud API.

For more information about the request format, see the Examples section in this topic.

Response elements

Element

Type

Description

Example

object

The GetCertificatePrivateKeyResponse.

EncryptedData

string

The content of the encrypted private key.

-----BEGIN ENCRYPTED PRIVATE KEY----- …… -----END ENCRYPTED PRIVATE KEY-----

RequestId

string

The ID of the request.

09470F19-CEE8-5C63-BF2C-02B5E3F07A17

Examples

Success response

JSON format

{
  "EncryptedData": "-----BEGIN ENCRYPTED PRIVATE KEY----- …… -----END ENCRYPTED PRIVATE KEY-----",
  "RequestId": "09470F19-CEE8-5C63-BF2C-02B5E3F07A17"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.