CreateCustomCertificate
Issues a digital certificate with the specified subject name, subject alternative names, key usages, and extended key usages. Before you call this API operation, if the SUB_ROOT CA specified by ParentIdentifier is newly created, you must first call AssignCertificateCount (set the CaIdentifier parameter to the value of ParentIdentifier) to allocate a certificate quota (CertTotalCount) for the CA. Otherwise, the QuotaExceeded error is returned.
Operation description
Before you call this API operation, if the SUB_ROOT CA specified by ParentIdentifier is newly created, you must first call AssignCertificateCount (set the CaIdentifier parameter to the value of ParentIdentifier) to allocate a certificate quota (CertTotalCount) for the CA. Otherwise, the QuotaExceeded error is returned.
By default, the certificate subject name is obtained from the CSR to issue the certificate. If a certificate subject name is specified, the certificate subject name in the CSR becomes invalid, and the specified certificate subject name is used to issue the certificate.
You must specify key usages or extension key usages based on common scenarios. The following examples show common scenarios:
Server authentication certificate.
Key usages: digitalSignature and keyEncipherment.
Extended key usage: serverAuth.
Client authentication certificate.
Key usages: digitalSignature and keyEncipherment.
Extended key usage: clientAuth.
mTLS mutual authentication certificate.
Key usages: digitalSignature and keyEncipherment.
Extended key usages: serverAuth and clientAuth.
Email signing certificate.
Key usages: digitalSignature and contentCommitment.
Extended key usage: emailProtection.
Note: Compliance CAs are managed by third-party authorities and do not support this API operation.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
yundun-cert:CreateCustomCertificate |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ParentIdentifier |
string |
Yes |
The CA certificate identifier. This parameter must point to a SUB_ROOT (end-entity) CA. If a ROOT CA is used, the API operation returns OperationDenied.NotSupport. |
1ed4068c-6f1b-6deb-8e32-3f8439a851cb |
| Csr |
string |
Yes |
The CSR content. You can generate a CSR by using the OpenSSL or Keytool tool. For more information, see How to create a CSR file. |
-----BEGIN CERTIFICATE REQUEST----- MIIBczCCARgCAQAwgYoxFDASBgNVBAMMC2FsaXl1bi50ZXN0MQ0wCwYDVQQ ... ... ... vbIgMQIhAKHDWD6/WAMbtezAt4bysJ/BZIDz1jPWuUR5GV4TJ/mS -----END CERTIFICATE REQUEST----- |
| Validity |
string |
Yes |
The certificate validity period. The validity period cannot exceed the instance validity period. Both relative time and absolute time are supported. Relative time: The supported units are year, month, and day.
Absolute time: GMT time is used. Format:
|
Relative time: ● 1y ● 3m ● 7d Absolute time: ● 2006-01-02T15:04:05Z ● 2006-01-02T15:04:05Z/2023-03-09T17:48:13Z |
| ApiPassthrough |
object |
No |
The pass-through parameter. Call example:
|
|
| Subject |
object |
No |
The certificate subject name. |
|
| Country |
string |
No |
The country code. Use the two-letter country code defined in ISO 3166-1. For more information, see ISO. |
CN |
| State |
string |
No |
The name of the province, municipality, or autonomous region where the organization associated with the CA certificate is located. |
Zhejiang Province |
| Locality |
string |
No |
The name of the city where the organization is located. Chinese and English characters are supported. |
Hangzhou |
| Organization |
string |
No |
The organization name. |
XXX Company |
| OrganizationUnit |
string |
No |
The name of the department or branch under the organization. |
XXX Department |
| CommonName |
string |
No |
The common name of the certificate subject. |
Zhang San |
| CustomAttributes |
array<object> |
No |
The subject property of the custom certificate. |
|
|
object |
No |
The subject property of the custom certificate. |
||
| ObjectIdentifier |
string |
No |
The custom attribute key, which must comply with industry standards. Examples:
|
2.5.4.3 |
| Value |
string |
No |
The custom attribute value. |
Aliyun |
| Extensions |
object |
No |
The certificate extensions. |
|
| KeyUsage |
object |
No |
The key usage. |
|
| DigitalSignature |
boolean |
No |
Digital signature. Allows the certificate private key to be used for digital signatures and the certificate public key to be used to verify digital signatures. |
true |
| ContentCommitment |
boolean |
No |
Content commitment (non-repudiation). Originally named NonRepudiation. Allows the certificate key to be used for content commitment. |
false |
| NonRepudiation |
boolean |
No |
Non-repudiation (equivalent to contentCommitment). Renamed to ContentCommitment in the X.509 standard. |
false |
| KeyEncipherment |
boolean |
No |
Secret key encryption. Allows the certificate key to encrypt and protect other keys. |
false |
| DataEncipherment |
boolean |
No |
Data encryption. Used to encrypt data. |
false |
| KeyAgreement |
boolean |
No |
Key agreement. |
false |
| EncipherOnly |
boolean |
No |
When KeyAgreement is true, used to mark that the certificate key can only be used for encryption. |
false |
| DecipherOnly |
boolean |
No |
When KeyAgreement is true, used to mark that the certificate key can only be used for decryption. |
false |
| ExtendedKeyUsages |
array |
No |
The extended key usages. Type: List |
|
|
string |
No |
Valid values:
|
1.3.6.1.4.1.311.20.2.2 |
|
| SubjectAlternativeNames |
array<object> |
No |
The subject alternative names (SANs). Type: List<Extensions.SubjectAlternativeName>. Each item contains type (GeneralNameType enum) and value (string). |
|
|
object |
No |
The subject alternative name of the certificate. |
||
| Type |
string |
Yes |
Valid values:
|
dNSName |
| Value |
string |
No |
The value that conforms to the Type definition.
|
rfc822Name: example.aliyundoc.com dNSName: learn.aliyundoc.com uniformResourceIdentifier: acs:ecs:regionid:15619224785*****:instance/i-bp1bzvz55uz27hf***** iPAddress: 127.0.0.1 |
| Criticals |
array |
No |
Controls the critical flag of the extension. If a parameter is required, the criticals list includes the parameter name. |
|
|
string |
No |
The parameter name of the required parameter, such as ExtendedKeyUsages. |
ExtendedKeyUsages |
|
| SerialNumber |
string |
No |
The serial number of the custom certificate (must be a long integer). |
16889526086333 |
| Immediately |
integer |
No |
Specifies whether to obtain the certificate immediately. Valid values:
|
0 |
| EnableCrl |
integer |
No |
Specifies whether to include the CRL address. Valid values:
|
1 |
| Tags |
array<object> |
No |
The list of tags. |
|
|
object |
No |
The list of tags. |
||
| Key |
string |
No |
The tag key. |
testKey |
| Value |
string |
No |
The tag value. |
1 |
| ResourceGroupId |
string |
No |
The resource group ID. You can obtain this ID by calling the ListResources API operation. |
rg-aek****wia |
| customIdentifier |
string |
No |
The user-defined identifier. |
XXX068c-6f1b-6deb-8e32-3f8439a8XXX |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
OpenApiResponseV1 |
||
| Identifier |
string |
The unique identifier of the certificate. |
160ae6bb538d538c70c01f81dcf2**** |
| Certificate |
string |
The certificate content. Returned when Immediately is 1 or 2. |
-----BEGIN CERTIFICATE----- MIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/ ... ... ... KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg== -----END CERTIFICATE----- |
| CertificateChain |
string |
The CA certificate chain. Returned when Immediately is 2. |
-----BEGIN CERTIFICATE----- MIIBfzCCATGgAwIBAgIUfI5kSdcO2S0+LkpdL3b2VUJG10YwBQYDK2VwMDUxCzAJ ... ... ... ZYYG -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- MIIBczCCARgCAQAwgYoxFDASBgNVBAMMC2FsaXl1bi50ZXN0MQ0wCwYDVQQ ... ... ... KL5cUmF -----END CERTIFICATE----- |
| SerialNumber |
string |
The certificate serial number. Returned when Immediately is 1 or 2. |
084bde9cd233f0ddae33adc438cfbbbd**** |
| RequestId |
string |
The ID of the request. It is a unique identifier generated by Alibaba Cloud for the request and can be used for troubleshooting. |
12345678-1234-1234-1234-123456789ABC |
Examples
Success response
JSON format
{
"Identifier": "160ae6bb538d538c70c01f81dcf2****",
"Certificate": "-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\n...\n...\n...\nKOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----",
"CertificateChain": "-----BEGIN CERTIFICATE-----\nMIIBfzCCATGgAwIBAgIUfI5kSdcO2S0+LkpdL3b2VUJG10YwBQYDK2VwMDUxCzAJ\n...\n...\n...\nZYYG\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIBczCCARgCAQAwgYoxFDASBgNVBAMMC2FsaXl1bi50ZXN0MQ0wCwYDVQQ\n...\n...\n...\nKL5cUmF\n-----END CERTIFICATE-----",
"SerialNumber": "084bde9cd233f0ddae33adc438cfbbbd****",
"RequestId": "12345678-1234-1234-1234-123456789ABC"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.