Issues a client certificate based on a custom certificate signing request (CSR).

Usage notes

Before you call this operation, make sure that you have created a root certificate authority (CA) certificate by calling the CreateRootCACertificate operation and an intermediate CA certificate by calling the CreateSubCACertificate operation. Only intermediate CA certificates can be used to issue client certificates.

Limits

You can call this operation up to 10 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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateClientCertificateWithCsr

The operation that you want to perform. Set the value to CreateClientCertificateWithCsr.

Csr String Yes -----BEGIN CERTIFICATE REQUEST----- ...... -----END CERTIFICATE REQUEST-----

The content of the CSR. You can generate a CSR by using the OpenSSL tool or the Keytool tool. For more information, see How do I create a CSR file?

SanType Integer No 2

The type of the Subject Alternative Name (SAN) extension that is supported by the client certificate. Valid values:

  • 1: an email address
  • 2: a domain name
  • 6: a Uniform Resource Identifier (URI)
  • 7: an IP address
SanValue String No aliyundoc.com

The content of the extension. You can specify multiple SAN extensions. If you want to specify multiple SAN extensions, separate them with commas (,).

Days Integer No 365

The validity period of the client certificate. Unit: days.

You must specify at least one of the Days, BeforeTime, and AfterTime parameters. The BeforeTime and AfterTime parameters must be both empty or both specified. The following list describes how to specify these parameters:

  • If you specify the Days parameter, you can specify both the BeforeTime and AfterTime parameters or leave them both empty.
  • If you do not specify the Days parameter, you must specify both the BeforeTime and AfterTime parameters.
Note
  • If you specify the Days, BeforeTime, and AfterTime parameters at the same time, the validity period of the client certificate is determined by the value of the Days parameter.
  • The validity period of the client certificate cannot exceed the validity period of the intermediate CA certificate. You can call the DescribeCACertificate operation to query the validity period of an intermediate CA certificate.
ParentIdentifier String Yes 270ae6bb538d538c70c01f81fg3****

The unique identifier of the intermediate CA certificate from which the client certificate is issued.

Note You can call the DescribeCACertificateList operation to query the unique identifier of an intermediate CA certificate.
BeforeTime Long No 1634283958

The issuance time of the client certificate. This value is a UNIX timestamp. The default value is the time when you call this operation. Unit: seconds.

Note The BeforeTime and AfterTime parameters must be both empty or both specified.
AfterTime Long No 1665819958

The expiration time of the client certificate. This value is a UNIX timestamp. Unit: seconds.

Note The BeforeTime and AfterTime parameters must be both empty or both specified.

All Alibaba Cloud API operations must include common request parameters. For more information about common request parameters, see Common parameters.

For more information about sample requests, see the "Examples" section of this topic.

Response parameters

Parameter Type Example Description
Identifier String 200ae6bb538d538c70c01f81dcf2****

The unique identifier of the client certificate.

RootX509Certificate String -----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----

The content of the root CA certificate.

ParentX509Certificate String -----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----

The content of the intermediate CA certificate.

RequestId String 31C66C7B-671A-4297-9187-2C4477247A74

The ID of the request, which is used to locate and troubleshoot issues.

X509Certificate String -----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----

The content of the client certificate.

CertificateChain String -----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----\n

The certificate chain of the client certificate.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateClientCertificateWithCsr
&Csr=-----BEGIN CERTIFICATE REQUEST-----   ...... -----END CERTIFICATE REQUEST-----
&SanType=2
&SanValue=aliyundoc.com
&Days=365
&ParentIdentifier=270ae6bb538d538c70c01f81fg3****
&BeforeTime=1634283958
&AfterTime=1665819958
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateClientCertificateWithCsrResponse>
    <Identifier>200ae6bb538d538c70c01f81dcf2****</Identifier>
    <RootX509Certificate>-----BEGIN CERTIFICATE-----
      ......
      -----END CERTIFICATE-----
    </RootX509Certificate>
    <ParentX509Certificate>-----BEGIN CERTIFICATE-----
      ......
      -----END CERTIFICATE-----
    </ParentX509Certificate>
    <RequestId>31C66C7B-671A-4297-9187-2C4477247A74</RequestId>
    <X509Certificate>-----BEGIN CERTIFICATE-----
      ......
      -----END CERTIFICATE-----
    </X509Certificate>
    <CertificateChain>-----BEGIN CERTIFICATE-----
      ......
      -----END CERTIFICATE-----
      -----BEGIN CERTIFICATE-----
      ......
      -----END CERTIFICATE-----
    </CertificateChain>
</CreateClientCertificateWithCsrResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Identifier" : "200ae6bb538d538c70c01f81dcf2****",
  "RootX509Certificate" : "-----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----",
  "ParentX509Certificate" : "-----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----",
  "RequestId" : "31C66C7B-671A-4297-9187-2C4477247A74",
  "X509Certificate" : "-----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----",
  "CertificateChain" : "-----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----\n"
}

Error codes

For a list of error codes, visit the API Error Center.