All Products
Search
Document Center

Certificate Management Service:CreateServerCertificateWithCsr

Last Updated:Feb 02, 2024

Issues a server certificate by using a custom certificate signing request (CSR) file.

Operation description

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 server certificates.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
yundun-cert:CreateServerCertificateWithCsrWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
CsrstringYes

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?

-----BEGIN CERTIFICATE REQUEST----- ...... -----END CERTIFICATE REQUEST-----
DomainstringNo

The additional domain names or additional IP addresses of the server certificate. After you add additional domain names and additional IP addresses to a certificate, you can apply the certificate to the domain names and IP addresses.

You can specify multiple domain names and IP addresses. If you specify multiple domain names and IP addresses, separate them with commas (,).

example.com
OrganizationstringNo

The name of the organization. Default value: Alibaba Inc.

ec server o
OrganizationUnitstringNo

The name of the department. Default value: Aliyun CDN.

IT
CountrystringNo

The code of the country in which the organization is located, such as CN or US.

CN
CommonNamestringNo

The name of the certificate user. The user of a server certificate is a server. We recommend that you enter the domain name or IP address of the server.

mtcsq.com
StatestringNo

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

Zhejiang
LocalitystringNo

The name of the city in which the 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.

Hangzhou
AlgorithmstringNo

The key algorithm of the server certificate. The key algorithm is in the <Encryption algorithm>_<Key length> format. Valid values:

  • RSA_1024: The signature algorithm is Sha256WithRSA.
  • RSA_2048: The signature algorithm is Sha256WithRSA.
  • RSA_4096: The signature algorithm is Sha256WithRSA.
  • ECC_256: The signature algorithm is Sha256WithECDSA.
  • ECC_384: The signature algorithm is Sha256WithECDSA.
  • ECC_512: The signature algorithm is Sha256WithECDSA.
  • SM2_256: The signature algorithm is SM3WithSM2.

The encryption algorithm of the server certificate must be the same as the encryption algorithm of the intermediate CA certificate. The key length can be different. For example, if the key algorithm of the intermediate CA certificate is RSA_2048, the key algorithm of the server certificate must be RSA_1024, RSA_2048, or RSA_4096.

Note You can call the DescribeCACertificate operation to query the key algorithm of an intermediate CA certificate.
RSA_2048
ParentIdentifierstringYes

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

Note You can call the DescribeCACertificateList operation to query the unique identifier of an intermediate CA certificate.
270oe6bb538d538c70c01f81hfd3****
YearsintegerNo

The validity period of the server certificate. Unit: years.

1
MonthsintegerNo

The validity period of the server certificate. Unit: months.

12
DaysintegerNo

The validity period of the server 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 server certificate is determined by the value of the Days parameter.
  • The validity period of the server 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.
365
BeforeTimelongNo

The issuance time of the server 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.
1634283958
AfterTimelongNo

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

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

Specifies whether to return the certificate. Valid values:

  • 0: does not return the certificate. This is the default value.
  • 1: returns the certificate.
  • 2: returns the certificate and the certificate chain of the certificate.
1
EnableCrllongNo

include the CRL address.

  • 0- No
  • 1- Yes
1

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

ParameterTypeDescriptionExample
object

CreateCertificateResponse

X509Certificatestring

The content of the server certificate.

-----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----
CertificateChainstring

The certificate chain of the server certificate.

-----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n......\n-----END CERTIFICATE-----\n
Identifierstring

The unique identifier of the server certificate.

180ae6bb538d538c70c01f81dcf2****
SerialNumberstring

The serial number of the server certificate.

084bde9cd233f0ddae33adc438cfbbbd****
RequestIdstring

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

55C66C7B-671A-4297-9187-2C4477247A74

Examples

Sample success responses

JSONformat

{
  "X509Certificate": "-----BEGIN CERTIFICATE-----\\n......\\n-----END CERTIFICATE-----",
  "CertificateChain": "-----BEGIN CERTIFICATE-----\\n......\\n-----END CERTIFICATE-----\\n-----BEGIN CERTIFICATE-----\\n......\\n-----END CERTIFICATE-----\\n",
  "Identifier": "180ae6bb538d538c70c01f81dcf2****",
  "SerialNumber": "084bde9cd233f0ddae33adc438cfbbbd****",
  "RequestId": "55C66C7B-671A-4297-9187-2C4477247A74"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-09-05The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: EnableCrl
2023-07-13The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    delete Input Parameters: Csr1