Menu
AWS Certificate Manager Private Certificate Authority
User Guide (Version latest)

DescribeCertificateAuthority

The following Java sample shows how to use the DescribeCertificateAuthority function.

The function lists information about your private certificate authority (CA). You must specify the ARN (Amazon Resource Name) of the private CA. The output contains the status of your CA. This can be any of the following:

  • CREATING: ACM PCA is creating your private certificate authority.

  • PENDING_CERTIFICATE: The certificate is pending. You must use your on-premises root or subordinate CA to sign your private CA CSR and then import it into PCA.

  • ACTIVE: Your private CA is active.

  • DISABLED: Your private CA has been disabled.

  • EXPIRED: Your private CA certificate has expired.

  • FAILED: Your private CA cannot be created.

package com.amazonaws.samples; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.client.builder.AwsClientBuilder; import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; import com.amazonaws.AmazonClientException; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.services.privateca.AWSPrivateCA; import com.amazonaws.services.privateca.AWSPrivateCAClientBuilder; import com.amazonaws.services.privateca.model.CertificateAuthority; import com.amazonaws.services.privateca.model.DescribeCertificateAuthorityRequest; import com.amazonaws.services.privateca.model.DescribeCertificateAuthorityResult; import com.amazonaws.services.privateca.model.ResourceNotFoundException; import com.amazonaws.services.privateca.model.InvalidArnException; public class DescribePCA { public static void main(String[] args) throws Exception { // Retrieve your credentials from the C:\Users\name\.aws\credentials file // in Windows or the .aws/credentials file in Linux. AWSCredentials credentials = null; try{ credentials = new ProfileCredentialsProvider("default").getCredentials(); } catch (Exception e) { throw new AmazonClientException("Cannot load your credentials from disk", e); } // Define the endpoint for your sample. String endpointProtocol = "https://acm-pca.region.amazonaws.com/"; String endpointRegion = "region"; EndpointConfiguration endpoint = new AwsClientBuilder.EndpointConfiguration(endpointProtocol, endpointRegion); // Create a client that you can use to make requests. AWSPrivateCA client = AWSPrivateCAClientBuilder.standard() .withEndpointConfiguration(endpoint) .withCredentials(new AWSStaticCredentialsProvider(credentials)) .build(); // Create a request object and set the certificate authority ARN. DescribeCertificateAuthorityRequest req = new DescribeCertificateAuthorityRequest(); req.setCertificateAuthorityArn("arn:aws:acm-pca:region:account:"+ "certificate-authority/12345678-1234-1234-1234-123456789012"); // Create a result object. DescribeCertificateAuthorityResult result = null; try { result = client.describeCertificateAuthority(req); } catch(ResourceNotFoundException ex) { throw ex; } catch(InvalidArnException ex) { throw ex; } // Retrieve and display information about the CA. CertificateAuthority PCA = result.getCertificateAuthority(); String strPCA = PCA.toString(); System.out.println(strPCA); } }

Your output should be similar to the following for the certificate authority that you specify.

{ Arn: arn: aws: acm-pca: region: account: certificate-authority/12345678-1234-1234-1234-123456789012, CreatedAt: TueJan1611: 24: 12PST2018, LastStateChangeAt: TueJan1611: 24: 12PST2018, Type: SUBORDINATE, Serial: 4118, Status: ACTIVE, NotBefore: TueJan1612: 33: 23PST2018, NotAfter: FriJan1412: 33: 23PST2028, CertificateAuthorityConfiguration: { KeyAlgorithm: RSA_2048, SigningAlgorithm: SHA256WITHRSA, Subject: { Country: US, Organization: ExampleCompany, OrganizationalUnit: sales, State: WA, CommonName: www.example.com, Locality: Seattle, } }, RevocationConfiguration: { CrlConfiguration: { Enabled: true, ExpirationInDays: 365, CustomCname: your-custom-name, S3BucketName: your-bucket-name } } }