Ausgestellte Zertifikate ansehen

Auf dieser Seite wird erläutert, wie Sie die ausgestellten Zertifikate mit der Google Cloud Console, der Google Cloud CLI und den Cloud-Clientbibliotheken aufrufen.

Sie können sich nur Zertifikate ansehen, die von Enterprise-Tier-CAs ausgestellt wurden.

Ausgestellte Zertifikate ansehen

Console

  1. Rufen Sie in der Google Cloud Console die Seite Certificate Authority Service auf.

    Zum Certificate Authority Service

  2. Klicken Sie auf den Tab CA Manager.

  3. Klicken Sie auf der Seite Zertifizierungsstellen auf den Namen der Zertifizierungsstelle.

  4. Klicken Sie unten auf der Seite mit den Details zur Zertifizierungsstelle auf Ausgestellte Zertifikate ansehen, um eine Liste der von der Zertifizierungsstelle ausgestellten Zertifikate aufzurufen.

    Auf der Seite Alle Zertifikate wird eine Liste der Zertifikate angezeigt. Zu den angezeigten Details gehören der Status des Zertifikats, die ausstellende Zertifizierungsstelle, der CA-Pool, der die Zertifizierungsstelle enthält, und das Ablaufdatum des Zertifikats.

gcloud

Mit dem folgenden gcloud-Befehl können Sie alle Zertifikate auflisten, die von einer bestimmten Zertifizierungsstelle in einem CA-Pool ausgestellt wurden:

gcloud privateca certificates list --issuer-pool ISSUER_POOL --issuer-location ISSUER_LOCATION --ca CA_NAME

Weitere Informationen zum Befehl gcloud privateca certificates list finden Sie unter gcloud privateca certificates list.

Mit dem folgenden gcloud-Befehl können Sie alle Zertifikate aller Zertifizierungsstellen an einem bestimmten Standort auflisten:

gcloud privateca certificates list --location LOCATION

Go

Richten Sie zur Authentifizierung beim CA-Dienst die Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.

import (
	"context"
	"fmt"
	"io"

	privateca "cloud.google.com/go/security/privateca/apiv1"
	"cloud.google.com/go/security/privateca/apiv1/privatecapb"
	"google.golang.org/api/iterator"
)

// List Certificates present in the given CA pool.
func listCertificates(
	w io.Writer,
	projectId string,
	location string,
	caPoolId string) error {
	// projectId := "your_project_id"
	// location := "us-central1"		// For a list of locations, see: https://cloud.google.com/certificate-authority-service/docs/locations.
	// caPoolId := "ca-pool-id"			// The CA Pool id in which the certificate exists.

	ctx := context.Background()
	caClient, err := privateca.NewCertificateAuthorityClient(ctx)
	if err != nil {
		return fmt.Errorf("NewCertificateAuthorityClient creation failed: %w", err)
	}
	defer caClient.Close()

	fullCaName := fmt.Sprintf("projects/%s/locations/%s/caPools/%s", projectId, location, caPoolId)

	// Create the ListCertificatesRequest.
	// See https://pkg.go.dev/cloud.google.com/go/security/privateca/apiv1/privatecapb#ListCertificatesRequest.
	req := &privatecapb.ListCertificatesRequest{Parent: fullCaName}

	it := caClient.ListCertificates(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			return fmt.Errorf("unable to get the list of cerficates: %w", err)
		}

		fmt.Fprintf(w, " - %s (common name: %s)", resp.Name,
			resp.CertificateDescription.SubjectDescription.Subject.CommonName)
	}

	return nil
}

Java

Richten Sie zur Authentifizierung beim CA-Dienst die Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.


import com.google.cloud.security.privateca.v1.CaPoolName;
import com.google.cloud.security.privateca.v1.Certificate;
import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient;
import java.io.IOException;

public class ListCertificates {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // location: For a list of locations, see:
    // https://cloud.google.com/certificate-authority-service/docs/locations
    // poolId: Id of the CA pool which contains the certificates to be listed.
    String project = "your-project-id";
    String location = "ca-location";
    String poolId = "ca-pool-id";
    listCertificates(project, location, poolId);
  }

  // List Certificates present in the given CA pool.
  public static void listCertificates(String project, String location, String poolId)
      throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the `certificateAuthorityServiceClient.close()` method on the client to safely
    // clean up any remaining background resources.
    try (CertificateAuthorityServiceClient certificateAuthorityServiceClient =
        CertificateAuthorityServiceClient.create()) {

      CaPoolName caPool =
          CaPoolName.newBuilder()
              .setProject(project)
              .setLocation(location)
              .setCaPool(poolId)
              .build();

      // Retrieve and print the certificate names.
      System.out.println("Available certificates: ");
      for (Certificate certificate :
          certificateAuthorityServiceClient.listCertificates(caPool).iterateAll()) {
        System.out.println(certificate.getName());
      }
    }
  }
}

Python

Richten Sie zur Authentifizierung beim CA-Dienst die Standardanmeldedaten für Anwendungen ein. Weitere Informationen finden Sie unter Authentifizierung für eine lokale Entwicklungsumgebung einrichten.


import google.cloud.security.privateca_v1 as privateca_v1


def list_certificates(
    project_id: str,
    location: str,
    ca_pool_name: str,
) -> None:
    """
    List Certificates present in the given CA pool.

    Args:
        project_id: project ID or project number of the Cloud project you want to use.
        location: location you want to use. For a list of locations, see: https://cloud.google.com/certificate-authority-service/docs/locations.
        ca_pool_name: name of the CA pool which contains the certificates to be listed.
    """

    caServiceClient = privateca_v1.CertificateAuthorityServiceClient()

    ca_pool_path = caServiceClient.ca_pool_path(project_id, location, ca_pool_name)

    # Retrieve and print the certificate names.
    print(f"Available certificates in CA pool {ca_pool_name}:")
    for certificate in caServiceClient.list_certificates(parent=ca_pool_path):
        print(certificate.name)

Details zu einem einzelnen Zertifikat ansehen

Console

  1. Rufen Sie in der Google Cloud Console die Seite Certificate Authority Service auf.

    Zum Certificate Authority Service

  2. Wählen Sie auf dem Tab CA Manager die Ziel-Zertifizierungsstelle aus.

  3. Klicken Sie auf den Namen der Zertifizierungsstelle.

  4. Klicken Sie unten auf der Seite mit den Details zur Zertifizierungsstelle auf Ausgestellte Zertifikate ansehen, um eine Liste der ausgestellten Zertifikate aufzurufen.

  5. Klicken Sie in der Spalte Aktionen für das Zertifikat, das Sie herunterladen möchten, auf .

  6. Klicken Sie unter Herunterladen auf Zertifikat. Sie können die Zertifikatskette herunterladen, indem Sie auf Zertifikatskette klicken.

gcloud

Führen Sie den folgenden Befehl aus, um die vollständige Beschreibung eines Zertifikats aufzurufen:

gcloud privateca certificates describe CERT_NAME --issuer-pool POOL_ID --issuer-location ISSUER_LOCATION

Weitere Informationen zum Befehl gcloud privateca certificates describe finden Sie unter gcloud privateca certificates describe.

Führen Sie den folgenden Befehl aus, um die PEM-codierte X.509-Zertifikatskette in eine Datei zu exportieren:

gcloud privateca certificates export CERT_NAME \
    --issuer-pool POOL_ID \
    --issuer-location ISSUER_LOCATION \
    --include-chain \
    --output-file certificate-file

Weitere Informationen zum Befehl gcloud privateca certificates export finden Sie unter gcloud privateca certificates export.

Besitznachweis für Zertifikate

Der Inhabernachweis für den privaten Schlüssel stellt sicher, dass der Antragsteller eines Zertifikats den privaten Schlüssel für dieses Zertifikat besitzt. Der CA Service prüft den Besitznachweis nur, wenn der Antragsteller eine PKCS #10-CSR gemäß RFC 2986 vorlegt. Für andere Arten von Zertifikatsanfragen, z. B. Anfragen über CertificateConfig, ist kein Besitznachweis erforderlich.

Clientanwendungen, die Zertifikate akzeptieren, sind dafür verantwortlich, zu prüfen, ob der Zertifikatsinhaber den privaten Schlüssel dieses Zertifikats besitzt. Die Erzwingung von Besitznachweisprüfungen bei der Zertifikatsausstellung ist eine Form der mehrschichtigen Verteidigung, um sich vor nicht ordnungsgemäß funktionierenden Clients zu schützen. Die Existenz solcher Clients, unabhängig davon, ob die Zertifizierungsstelle den Besitznachweis prüft, könnte eine Sicherheitslücke darstellen.

Nächste Schritte