Skip to content

issue_certificate

issue_certificate(
    certificate_authority_arn: Arn,
    csr: CsrBlob,
    signing_algorithm: SigningAlgorithm,
    validity: Validity,
    *,
    config_overrides: Optional[ACMPCAClientConfig] = None,
    api_passthrough: Optional[ApiPassthrough] = None,
    template_arn: Optional[Arn] = None,
    validity_not_before: Optional[Validity] = None,
    idempotency_token: Optional[IdempotencyToken] = None,
) -> IssueCertificateResponse

Uses your private certificate authority (CA), or one that has been shared with you, to issue a client certificate. This action returns the Amazon Resource Name (ARN) of the certificate. You can retrieve the certificate by calling the GetCertificate action and specifying the ARN.

You cannot use the ACM ListCertificateAuthorities action to retrieve the ARNs of the certificates that you issue by using Amazon Web Services Private CA.

Parameters:

  • api_passthrough (Optional[ApiPassthrough], default: None ) –

    Specifies X.509 certificate information to be included in the issued certificate. An APIPassthrough or APICSRPassthrough template variant must be selected, or else this parameter is ignored. For more information about using these templates, see Understanding Certificate Templates.

    If conflicting or duplicate certificate information is supplied during certificate issuance, Amazon Web Services Private CA applies order of operation rules to determine what information is used.

  • certificate_authority_arn (Arn) –

    The Amazon Resource Name (ARN) that was returned when you called CreateCertificateAuthority. This must be of the form:

    arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-1234-123456789012

  • csr (CsrBlob) –

    The certificate signing request (CSR) for the certificate you want to issue. As an example, you can use the following OpenSSL command to create the CSR and a 2048 bit RSA private key.

    openssl req -new -newkey rsa:2048 -days 365 -keyout private/test_cert_priv_key.pem -out csr/test_cert_.csr

    If you have a configuration file, you can then use the following OpenSSL command. The usr_cert block in the configuration file contains your X509 version 3 extensions.

    openssl req -new -config openssl_rsa.cnf -extensions usr_cert -newkey rsa:2048 -days 365 -keyout private/test_cert_priv_key.pem -out csr/test_cert_.csr

    Note: A CSR must provide either a subject name or a subject alternative name or the request will be rejected.

  • signing_algorithm (SigningAlgorithm) –

    The name of the algorithm that will be used to sign the certificate to be issued.

    This parameter should not be confused with the SigningAlgorithm parameter used to sign a CSR in the CreateCertificateAuthority action.

    The specified signing algorithm family (RSA or ECDSA) must match the algorithm family of the CA's secret key.

  • template_arn (Optional[Arn], default: None ) –

    Specifies a custom configuration template to use when issuing a certificate. If this parameter is not provided, Amazon Web Services Private CA defaults to the EndEntityCertificate/V1 template. For CA certificates, you should choose the shortest path length that meets your needs. The path length is indicated by the PathLenN portion of the ARN, where N is the CA depth.

    Note: The CA depth configured on a subordinate CA certificate must not exceed the limit set by its parents in the CA hierarchy.

    For a list of TemplateArn values supported by Amazon Web Services Private CA, see Understanding Certificate Templates.

  • validity (Validity) –

    Information describing the end of the validity period of the certificate. This parameter sets the “Not After” date for the certificate.

    Certificate validity is the period of time during which a certificate is valid. Validity can be expressed as an explicit date and time when the certificate expires, or as a span of time after issuance, stated in days, months, or years. For more information, see Validity in RFC 5280.

    This value is unaffected when ValidityNotBefore is also specified. For example, if Validity is set to 20 days in the future, the certificate will expire 20 days from issuance time regardless of the ValidityNotBefore value.

    The end of the validity period configured on a certificate must not exceed the limit set on its parents in the CA hierarchy.

  • validity_not_before (Optional[Validity], default: None ) –

    Information describing the start of the validity period of the certificate. This parameter sets the “Not Before" date for the certificate.

    By default, when issuing a certificate, Amazon Web Services Private CA sets the "Not Before" date to the issuance time minus 60 minutes. This compensates for clock inconsistencies across computer systems. The ValidityNotBefore parameter can be used to customize the “Not Before” value.

    Unlike the Validity parameter, the ValidityNotBefore parameter is optional.

    The ValidityNotBefore value is expressed as an explicit date and time, using the Validity type value ABSOLUTE. For more information, see Validity in this API reference and Validity in RFC 5280.

  • idempotency_token (Optional[IdempotencyToken], default: None ) –

    Alphanumeric string that can be used to distinguish between calls to the IssueCertificate action. Idempotency tokens for IssueCertificate time out after five minutes. Therefore, if you call IssueCertificate multiple times with the same idempotency token within five minutes, Amazon Web Services Private CA recognizes that you are requesting only one certificate and will issue only one. If you change the idempotency token for each call, Amazon Web Services Private CA recognizes that you are requesting multiple certificates.

Raises:

Source code in docs_src/capo_acm_pca/_services/acmpca.py
def issue_certificate(
    self,
    certificate_authority_arn: "capo_acm_pca.types.arn.Arn",
    csr: "capo_acm_pca.types.csr_blob.CsrBlob",
    signing_algorithm: "capo_acm_pca.types.signing_algorithm.SigningAlgorithm",
    validity: "capo_acm_pca.types.validity.Validity",
    *,
    config_overrides: Optional[ACMPCAClientConfig] = None,
    api_passthrough: Optional[
        "capo_acm_pca.types.api_passthrough.ApiPassthrough"
    ] = None,
    template_arn: Optional["capo_acm_pca.types.arn.Arn"] = None,
    validity_not_before: Optional["capo_acm_pca.types.validity.Validity"] = None,
    idempotency_token: Optional[
        "capo_acm_pca.types.idempotency_token.IdempotencyToken"
    ] = None,
) -> "capo_acm_pca.types.issue_certificate_response.IssueCertificateResponse":
    """<p>Uses your private certificate authority (CA), or one that has been shared with you, to issue a client certificate. This action returns the Amazon Resource Name (ARN) of the certificate. You can retrieve the certificate by calling the <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_GetCertificate.html">GetCertificate</a> action and specifying the ARN. </p> <note> <p>You cannot use the ACM <b>ListCertificateAuthorities</b> action to retrieve the ARNs of the certificates that you issue by using Amazon Web Services Private CA.</p> </note>

    Args:
        api_passthrough: <p>Specifies X.509 certificate information to be included in the issued certificate. An <code>APIPassthrough</code> or <code>APICSRPassthrough</code> template variant must be selected, or else this parameter is ignored. For more information about using these templates, see <a href="https://docs.aws.amazon.com/privateca/latest/userguide/UsingTemplates.html">Understanding Certificate Templates</a>.</p> <p>If conflicting or duplicate certificate information is supplied during certificate issuance, Amazon Web Services Private CA applies <a href="https://docs.aws.amazon.com/privateca/latest/userguide/UsingTemplates.html#template-order-of-operations">order of operation rules</a> to determine what information is used.</p>
        certificate_authority_arn: <p>The Amazon Resource Name (ARN) that was returned when you called <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_CreateCertificateAuthority.html">CreateCertificateAuthority</a>. This must be of the form:</p> <p> <code>arn:aws:acm-pca:<i>region</i>:<i>account</i>:certificate-authority/<i>12345678-1234-1234-1234-123456789012</i> </code> </p>
        csr: <p>The certificate signing request (CSR) for the certificate you want to issue. As an example, you can use the following OpenSSL command to create the CSR and a 2048 bit RSA private key. </p> <p> <code>openssl req -new -newkey rsa:2048 -days 365 -keyout private/test_cert_priv_key.pem -out csr/test_cert_.csr</code> </p> <p>If you have a configuration file, you can then use the following OpenSSL command. The <code>usr_cert</code> block in the configuration file contains your X509 version 3 extensions. </p> <p> <code>openssl req -new -config openssl_rsa.cnf -extensions usr_cert -newkey rsa:2048 -days 365 -keyout private/test_cert_priv_key.pem -out csr/test_cert_.csr</code> </p> <p>Note: A CSR must provide either a <i>subject name</i> or a <i>subject alternative name</i> or the request will be rejected. </p>
        signing_algorithm: <p>The name of the algorithm that will be used to sign the certificate to be issued. </p> <p>This parameter should not be confused with the <code>SigningAlgorithm</code> parameter used to sign a CSR in the <code>CreateCertificateAuthority</code> action.</p> <note> <p>The specified signing algorithm family (RSA or ECDSA) must match the algorithm family of the CA's secret key.</p> </note>
        template_arn: <p>Specifies a custom configuration template to use when issuing a certificate. If this parameter is not provided, Amazon Web Services Private CA defaults to the <code>EndEntityCertificate/V1</code> template. For CA certificates, you should choose the shortest path length that meets your needs. The path length is indicated by the PathLen<i>N</i> portion of the ARN, where <i>N</i> is the <a href="https://docs.aws.amazon.com/privateca/latest/userguide/PcaTerms.html#terms-cadepth">CA depth</a>.</p> <p>Note: The CA depth configured on a subordinate CA certificate must not exceed the limit set by its parents in the CA hierarchy.</p> <p>For a list of <code>TemplateArn</code> values supported by Amazon Web Services Private CA, see <a href="https://docs.aws.amazon.com/privateca/latest/userguide/UsingTemplates.html">Understanding Certificate Templates</a>.</p>
        validity: <p>Information describing the end of the validity period of the certificate. This parameter sets the “Not After” date for the certificate.</p> <p>Certificate validity is the period of time during which a certificate is valid. Validity can be expressed as an explicit date and time when the certificate expires, or as a span of time after issuance, stated in days, months, or years. For more information, see <a href="https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.5">Validity</a> in RFC 5280. </p> <p>This value is unaffected when <code>ValidityNotBefore</code> is also specified. For example, if <code>Validity</code> is set to 20 days in the future, the certificate will expire 20 days from issuance time regardless of the <code>ValidityNotBefore</code> value.</p> <p>The end of the validity period configured on a certificate must not exceed the limit set on its parents in the CA hierarchy.</p>
        validity_not_before: <p>Information describing the start of the validity period of the certificate. This parameter sets the “Not Before" date for the certificate.</p> <p>By default, when issuing a certificate, Amazon Web Services Private CA sets the "Not Before" date to the issuance time minus 60 minutes. This compensates for clock inconsistencies across computer systems. The <code>ValidityNotBefore</code> parameter can be used to customize the “Not Before” value. </p> <p>Unlike the <code>Validity</code> parameter, the <code>ValidityNotBefore</code> parameter is optional.</p> <p>The <code>ValidityNotBefore</code> value is expressed as an explicit date and time, using the <code>Validity</code> type value <code>ABSOLUTE</code>. For more information, see <a href="https://docs.aws.amazon.com/privateca/latest/APIReference/API_Validity.html">Validity</a> in this API reference and <a href="https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.5">Validity</a> in RFC 5280.</p>
        idempotency_token: <p>Alphanumeric string that can be used to distinguish between calls to the <b>IssueCertificate</b> action. Idempotency tokens for <b>IssueCertificate</b> time out after five minutes. Therefore, if you call <b>IssueCertificate</b> multiple times with the same idempotency token within five minutes, Amazon Web Services Private CA recognizes that you are requesting only one certificate and will issue only one. If you change the idempotency token for each call, Amazon Web Services Private CA recognizes that you are requesting multiple certificates.</p>

    Raises:
        capo_acm_pca.errors.invalid_args_exception.InvalidArgsException: <p>One or more of the specified arguments was not valid.</p>
        capo_acm_pca.errors.invalid_arn_exception.InvalidArnException: <p>The requested Amazon Resource Name (ARN) does not refer to an existing resource.</p>
        capo_acm_pca.errors.invalid_state_exception.InvalidStateException: <p>The state of the private CA does not allow this action to occur.</p>
        capo_acm_pca.errors.limit_exceeded_exception.LimitExceededException: <p>An Amazon Web Services Private CA quota has been exceeded. See the exception message returned to determine the quota that was exceeded.</p>
        capo_acm_pca.errors.malformed_csr_exception.MalformedCSRException: <p>The certificate signing request is invalid.</p>
        capo_acm_pca.errors.resource_not_found_exception.ResourceNotFoundException: <p>A resource such as a private CA, S3 bucket, certificate, audit report, or policy cannot be found.</p>
        capo_acm_pca.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_acm_pca.types.issue_certificate_request.IssueCertificateRequest]",
    ) -> OperationResponse[
        "capo_acm_pca.types.issue_certificate_response.IssueCertificateResponse"
    ]:
        import capo_acm_pca._operations.acm_private_ca.issue_certificate

        output, http_response = (
            capo_acm_pca._operations.acm_private_ca.issue_certificate.issue_certificate(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("IssueCertificate")
    )
    input_: capo_acm_pca.types.issue_certificate_request.IssueCertificateRequest = {
        "certificate_authority_arn": certificate_authority_arn,
        "csr": csr,
        "signing_algorithm": signing_algorithm,
        "validity": validity,
    }
    if api_passthrough is not None:
        input_["api_passthrough"] = api_passthrough
    if template_arn is not None:
        input_["template_arn"] = template_arn
    if validity_not_before is not None:
        input_["validity_not_before"] = validity_not_before
    if idempotency_token is not None:
        input_["idempotency_token"] = idempotency_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output