STS / Client / get_certificate
get_certificate¶
- STS.Client.get_certificate(**kwargs)¶
Returns an X.509 SPIFFE Verifiable Identity Document (X509-SVID) for the workload identity of the calling session. Your workload can use the certificate to prove its identity to peers, for example in mutual TLS (mTLS). The X.509 signer of the workload identity provider that issued the workload identity of the session signs the certificate in the Amazon Web Services Region that you send the request to.
You can call
GetCertificateonly with temporary credentials for a role session that has a workload identity, and the workload identity provider must use the SPIFFE naming scheme. You can’t call it with long-term IAM user credentials or with federated user credentials from GetFederationToken. Amazon Web Services STS denies the request if the calling session doesn’t have a workload identity. Amazon Web Services STS also denies the request if the workload identity template or provider of the session no longer exists.Amazon Web Services STS takes the identity in the certificate from the calling session, not from the request. Amazon Web Services STS uses only the public key from the certificate signing request (CSR) that you provide. The certificate chain in the response can include the root certificate authority (CA) certificate, so don’t use it as a source of trust anchors. To verify certificates that Amazon Web Services STS issues, get trust anchors only from GetTrustBundles.
To call
GetCertificate, you must have permission for thests:GetCertificateaction. Because Amazon Web Services STS issues the certificate on your behalf, you must also have permission for theacm-pca:IssueCertificateandacm-pca:GetCertificateactions on the certificate authority (CA) that the signer of the workload identity provider uses.Amazon Web Services STS returns some errors from Amazon Web Services Private CA to you. If Amazon Web Services Private CA denies the request, the request fails with an access denied error. Check your permissions on the CA. If the account that owns the CA has exceeded its Amazon Web Services Private CA quota for issuing certificates, the request fails with a throttling error. Check the quotas for Amazon Web Services Private CA in that account.
Note
The
GetCertificateAPI is not available on the STS global endpoint. Send requests to an STS endpoint in an Amazon Web Services Region.See also: AWS API Documentation
Request Syntax
response = client.get_certificate( CertificateSigningRequest='string', MaxDurationSeconds=123 )
- Parameters:
CertificateSigningRequest (string) –
[REQUIRED]
A PEM-encoded PKCS #10 certificate signing request (CSR) that contains the public key for the certificate. The CSR must be signed with the matching private key.
Amazon Web Services STS uses only the public key from the CSR. Amazon Web Services STS ignores the subject, subject alternative names (SANs), and requested extensions in the CSR. The signing algorithm of the certificate is set by the signer of the workload identity provider, not by the CSR.
The CSR can be up to 32,768 characters long. If the CSR is blank, can’t be parsed, has a signature that doesn’t verify, or uses a key type or key size that the signer doesn’t support, the request fails with
MalformedCertificateSigningRequestException.MaxDurationSeconds (integer) –
The time, in seconds, that the certificate is valid. The value can range from 3,600 seconds (1 hour) to 43,200 seconds (12 hours). If you don’t specify a value, the certificate is valid for 43,200 seconds (12 hours).
The expiration of the calling session doesn’t limit this value. The certificate can remain valid after the session that requested it expires. This differs from
GetWebIdentityToken, which rejects a token duration that ends after the calling session expires.
- Return type:
dict
- Returns:
Response Syntax
{ 'Certificate': 'string', 'CertificateChain': 'string', 'NotBefore': datetime(2015, 1, 1), 'NotAfter': datetime(2015, 1, 1), 'Subject': 'string' }
Response Structure
(dict) –
Contains the response to a successful GetCertificate request.
Certificate (string) –
The issued X.509 certificate (X509-SVID), PEM-encoded. The certificate has an empty subject distinguished name (DN) and one URI subject alternative name (SAN) that contains the SPIFFE ID of the workload. You can use the certificate for both client and server authentication.
CertificateChain (string) –
The PEM-encoded certificate chain that links the certificate to the root certificate authority (CA), in the same format that Amazon Web Services Private CA returns. The chain can include the root CA certificate. Don’t use the chain as a source of trust anchors. To get the trust anchors for the provider, call GetTrustBundles.
NotBefore (datetime) –
The date and time, in UTC, when the certificate becomes valid. To allow for differences between clocks, Amazon Web Services STS sets this to five minutes before it issues the certificate.
NotAfter (datetime) –
The date and time, in UTC, when the certificate expires. This is
MaxDurationSecondsafter Amazon Web Services STS issued the certificate, or 12 hours if you didn’t specifyMaxDurationSeconds.Subject (string) –
The SPIFFE ID of the workload, for example
spiffe://example.org/payments/checkout. This is the same value as the URI subject alternative name (SAN) of the certificate, and comes from the calling session.
Exceptions