Beschreiben eines Zertifikats - AWS Certificate Manager

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

Beschreiben eines Zertifikats

Das folgende Beispiel zeigt, wie Sie die DescribeCertificate-Funktion verwenden.

package com.amazonaws.samples; import com.amazonaws.services.certificatemanager.AWSCertificateManagerClientBuilder; import com.amazonaws.services.certificatemanager.AWSCertificateManager; import com.amazonaws.services.certificatemanager.model.DescribeCertificateRequest; import com.amazonaws.services.certificatemanager.model.DescribeCertificateResult; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.regions.Regions; import com.amazonaws.services.certificatemanager.model.InvalidArnException; import com.amazonaws.services.certificatemanager.model.ResourceNotFoundException; import com.amazonaws.AmazonClientException; /** * This sample demonstrates how to use the DescribeCertificate function in the AWS Certificate * Manager service. * * Input parameter: * CertificateArn - The ARN of the certificate to be described. * * Output parameter: * Certificate information * */ public class AWSCertificateManagerExample { 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().getCredentials(); } catch (Exception ex) { throw new AmazonClientException("Cannot load the credentials from file.", ex); } // Create a client. AWSCertificateManager client = AWSCertificateManagerClientBuilder.standard() .withRegion(Regions.US_EAST_1) .withCredentials(new AWSStaticCredentialsProvider(credentials)) .build(); // Create a request object and set the ARN of the certificate to be described. DescribeCertificateRequest req = new DescribeCertificateRequest(); req.setCertificateArn("arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012"); DescribeCertificateResult result = null; try{ result = client.describeCertificate(req); } catch (InvalidArnException ex) { throw ex; } catch (ResourceNotFoundException ex) { throw ex; } // Display the certificate information. System.out.println(result); } }

Im Erfolgsfall werden für das vorherige Beispiel Informationen der folgenden Art angezeigt.

{ Certificate: { CertificateArn: arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012, DomainName: www.example.com, SubjectAlternativeNames: [www.example.com], DomainValidationOptions: [{ DomainName: www.example.com, }], Serial: 10: 0a, Subject: C=US, ST=WA, L=Seattle, O=ExampleCompany, OU=sales, CN=www.example.com, Issuer: ExampleCompany, ImportedAt: FriOct0608: 17: 39PDT2017, Status: ISSUED, NotBefore: ThuOct0510: 14: 32PDT2017, NotAfter: SunOct0310: 14: 32PDT2027, KeyAlgorithm: RSA-2048, SignatureAlgorithm: SHA256WITHRSA, InUseBy: [], Type: IMPORTED, } }