Issues a client certificate or a server certificate that has Subject Alternative Name (SAN) extensions such as domain names and IP addresses.

Usage notes

You can call the CreateCertificateWithExtension operation to create a client certificate or a server certificate that has extensions. This way, you can apply a certificate to multiple domain names or IP addresses. 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 and server 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 CreateCertificateWithExtension

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

CertType String Yes SERVER

The type of the certificate. Valid values:

  • SERVER: a server certificate
  • CLIENT: a client certificate
CommonName String No aliyun

The common name of the certificate. The value can contain letters.

Note If you specify the CsrPemString parameter, the value of the CommonName parameter is determined by the CsrPemString parameter.
ParentIdentifier String Yes 7f5761afc960009105c68a6a34fb****

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

Note You can call the DescribeCACertificateList operation to query the unique identifier of an intermediate CA certificate.
Sans String No [ {"Type": 2, "Value": "aliyundoc.com"} ]

The SAN extension of the certificate. Specify the value in the following JSON format: [{"Type": <SAN extension type>, "Value": "<SAN extension content>"}]. The following list describes the Type and Value parameters:

  • Type: the type of the extension. Data type: integer. Valid values:
    • 1: an email address
    • 2: a domain name
    • 6: a Uniform Resource Identifier (URI)
    • 7: an IP address
  • Value: the content of the extension. Data type: string.

In this example, the additional domain name of the certificate is aliyundoc.com.

[
  null
]
BeforeTime Long Yes 1632894933

The issuance time of the certificate. The value is a UNIX timestamp. Unit: seconds.

AfterTime Long Yes 1664430933

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

Organization String No Alibaba Cloud

The name of the organization that is associated with the certificate. You can enter the name of your enterprise or company. The value can contain letters.

The default value is the name of the organization. The organization is associated with the intermediate CA certificate from which the certificate is issued.

OrganizationUnit String No IT

The name of the department or branch in the organization. The value can contain letters.

The default value is the name of the department or branch in the organization. The organization is associated with the intermediate CA certificate from which the certificate is issued.

State String No Zhejiang

The name of the province or state in which the organization is located. The organization is associated with the certificate. The value can contain letters. The default value is the name of the province or state in which the organization is located. The organization is associated with the intermediate CA certificate from which the certificate is issued.

Locality String No Hangzhou

The name of the city in which the certificate organization is located. The value can contain letters.

The default value is the name of the city in which the organization is located. The organization is associated with the intermediate CA certificate from which the certificate is issued.

CsrPemString String No -----BEGIN CERTIFICATE REQUEST----- ...... -----END CERTIFICATE REQUEST-----

The CSR based on which the certificate is issued. The CSR is in the PEM format. 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?

If you specify this parameter, the certificate is issued from the intermediate CA certificate based on the specified CSR. The settings of the following parameters in the CSR take precedence over the settings of the duplicate request parameters.

  • Organization
  • OrganizationUnit
  • CountryCode
  • State
  • Locality
  • CommonName
  • AlgorithmKeySize
BasicConstraintsCritical Boolean No true

Specifies whether to mark the basic constraints extension of the certificate as critical.

Valid values:

  • true: marks the basic constraints extension of the certificate as critical.
  • false: does not mark the basic constraints extension of the certificate as critical.

Default value: true.

AppendCrl Boolean No false

Specifies whether to add a certificate revocation list (CRL) to the certificate. Valid values:

  • true: adds a CRL to the certificate.
  • false: does not add a CRL to the certificate.

Default value: false.

AliasName String No cert-name

The name of the certificate.

CountryCode String No CN

The code of the country or region in which the organization is located. For example, you can use CN to indicate China and use US to indicate the United States. The default value is the code of the country or region in which the organization is located. The organization is associated with the intermediate CA certificate from which the certificate is issued.

For more information about country codes, see the "Country codes" section of the Manage company profiles topic.

AlgorithmKeySize Integer No 2048

The key length of the certificate. The key length must match the encryption algorithm. For example, if the encryption algorithm of the intermediate CA certificate is RSA, the key length of the issued certificate must be 1024, 2048, or 4096.

The key length for the RSA encryption algorithm:

  • 1024
  • 2048
  • 4096

The key length for the ECC encryption algorithm:

  • 256
  • 384
  • 512

The key length for the SM2 encryption algorithm:

  • 256
  • 384
  • 512
Note
  • You can call the DescribeCACertificate operation to query the encryption algorithm type of an intermediate CA certificate.
  • If you specify the CsrPemString parameter, the value of the AlgorithmKeySize parameter is determined by the CsrPemString parameter.

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 e6316d4a3c4682b4c99cd0027b69****

The unique identifier of the issued certificate.

RequestId String EA69E364-5CBB-50E8-BF09-E8CAA396A4F8

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

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

The content of the issued certificate.

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

The certificate chain of the issued certificate.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateCertificateWithExtension
&CertType=SERVER
&CommonName=aliyun
&ParentIdentifier=7f5761afc960009105c68a6a34fb****
&Sans=[   {"Type": 2, "Value": "aliyundoc.com"} ]
&BeforeTime=1632894933
&AfterTime=1664430933
&Organization=Alibaba Cloud
&OrganizationUnit=IT
&State=Zhejiang
&Locality=Hangzhou
&CsrPemString=-----BEGIN CERTIFICATE REQUEST-----   ...... -----END CERTIFICATE REQUEST-----
&BasicConstraintsCritical=true
&AppendCrl=false
&AliasName=cert-name
&CountryCode=CN
&AlgorithmKeySize=2048
&Common request parameters

Sample success responses

XML format

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

<CreateCertificateWithExtensionResponse>
    <Identifier>e6316d4a3c4682b4c99cd0027b69****</Identifier>
    <RequestId>EA69E364-5CBB-50E8-BF09-E8CAA396A4F8</RequestId>
    <Certificate>-----BEGIN CERTIFICATE-----
      ......
      -----END CERTIFICATE-----
    </Certificate>
    <CertificateChain>-----BEGIN CERTIFICATE-----
      ......
      -----END CERTIFICATE-----
      -----BEGIN CERTIFICATE-----
      ......
      -----END CERTIFICATE-----
    </CertificateChain>
</CreateCertificateWithExtensionResponse>

JSON format

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

{
  "Identifier" : "e6316d4a3c4682b4c99cd0027b69****",
  "RequestId" : "EA69E364-5CBB-50E8-BF09-E8CAA396A4F8",
  "Certificate" : "-----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.