All Products
Search
Document Center

Key Management Service:CreateClientKey

Last Updated:Oct 26, 2026

Creates an application identity credential (ClientKey).

Operation description

  • For details about the permission policies that must be granted to a Resource Access Management (RAM) user or RAM role to call this API operation, see Access control.

  • Before a self-managed application can perform cryptographic operations or obtain credential values, it must access the KMS instance by using a ClientKey. The overall process of creating an application access point (AAP) and a ClientKey is as follows:

    1. Create a network control rule: Configure the private IP or private CIDR block that is allowed to access KMS. For more information, see CreateNetworkRule.

    2. Create an access policy: Configure the keys and credentials that the application is allowed to access, and attach the network control rule. For more information, see CreatePolicy.

    3. Create an application access point: Configure the authentication method, and attach the access policy. For more information, see CreateApplicationAccessPoint.

    4. Create a ClientKey: Configure the encryption passphrase and validity period of the ClientKey, and attach the application access point. This is the content described in this topic.

Precautions

A ClientKey has a validity period. After the ClientKey expires, KMS does not allow applications integrated with the ClientKey to access the KMS instance. Replace the ClientKey before it expires. Delete the expired ClientKey in KMS after the replacement is complete.

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

kms:CreateClientKey

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

AapName

string

Yes

The name of the attached application access point (AAP).

aap_test

Password

string

Yes

The passphrase of the ClientKey.

The passphrase must be 8 to 64 characters in length and can contain digits, uppercase and lowercase letters, and special characters such as ~!@#$%^&*?_-. It must contain at least two of these character types.

bcfefe15-46f0****

NotAfter

string

No

The end time of the validity period of the ClientKey.

The time is specified in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. The time must be in UTC.

Note
  • If you do not specify NotAfter, the default value is the creation time of the ClientKey plus 5 years.

  • If you specify NotAfter, you must also specify NotBefore.

2028-08-31T17:14:33Z

NotBefore

string

No

The start time of the validity period of the ClientKey.

The time is specified in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. The time must be in UTC.

Note
  • If you do not specify NotBefore, the default value is the creation time of the ClientKey.

  • If you specify NotBefore, you must also specify NotAfter.

2023-08-31T17:14:33Z

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request. It is a unique identifier generated by Alibaba Cloud for the request and can be used to troubleshoot and locate issues.

2312e45f-b2fa-4c34-ad94-3eca50932916

ClientKeyId

string

The ID of the ClientKey.

KAAP.66abf237-63f6-4625-b8cf-47e1086e****

KeyAlgorithm

string

The algorithm used to encrypt the private key content of the ClientKey. Only RSA_2048 is supported.

RSA_2048

PrivateKeyData

string

The private key content of the ClientKey.

MIIJqwIBAzCCCXcGCSqGSIb3DQEHAaCCCWgEgglkMIIJYDCCBBcGCSqGSIb3DQEHBqCCBAgwgg******

NotBefore

string

The start time of the validity period of the ClientKey.

2023-08-31T17:14:33Z

NotAfter

string

The end time of the validity period of the ClientKey.

2028-08-31T17:14:33Z

Examples

Success response

JSON format

{
  "RequestId": "2312e45f-b2fa-4c34-ad94-3eca50932916",
  "ClientKeyId": "KAAP.66abf237-63f6-4625-b8cf-47e1086e****",
  "KeyAlgorithm": "RSA_2048",
  "PrivateKeyData": "MIIJqwIBAzCCCXcGCSqGSIb3DQEHAaCCCWgEgglkMIIJYDCCBBcGCSqGSIb3DQEHBqCCBAgwgg******",
  "NotBefore": "2023-08-31T17:14:33Z",
  "NotAfter": "2028-08-31T17:14:33Z"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.