발급된 인증서 보기

이 페이지에서는 Google Cloud 콘솔, Google Cloud CLI, Cloud 클라이언트 라이브러리를 사용하여 발급된 인증서를 보는 방법을 설명합니다.

발급된 인증서 보기

콘솔

  1. Google Cloud 콘솔에서 Certificate Authority Service 페이지로 이동합니다.

    Certificate Authority Service로 이동

  2. CA 관리자 탭을 클릭합니다.

  3. 인증 기관 페이지에서 CA 이름을 클릭합니다.

  4. 인증 기관 세부정보 페이지 하단에서 발급된 인증서 보기를 클릭하여 CA에서 발급한 인증서 목록을 확인합니다.

    모든 인증서 페이지에 인증서 목록이 표시됩니다. 표시되는 세부정보에는 인증서 상태, 발급 CA, CA가 포함된 CA 풀, 인증서 만료일 등이 포함됩니다.

gcloud

CA 풀의 특정 CA에서 발급한 모든 인증서를 나열하려면 다음 gcloud 명령어를 사용합니다.

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

gcloud privateca certificates list 명령어에 대한 자세한 내용은 gcloud privateca certificates list를 참조하세요.

특정 위치에 있는 모든 CA의 모든 인증서를 나열하려면 다음 gcloud 명령어를 사용합니다.

gcloud privateca certificates list --location LOCATION

Go

CA Service에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

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

CA Service에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


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

CA Service에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


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)

단일 인증서의 세부정보 보기

콘솔

  1. Google Cloud 콘솔에서 Certificate Authority Service 페이지로 이동합니다.

    Certificate Authority Service로 이동

  2. CA 관리자 탭에서 대상 CA를 선택합니다.

  3. CA 이름을 클릭합니다.

  4. 인증 기관 세부정보 페이지 하단에서 발급된 인증서 보기를 클릭하여 발급된 인증서 목록을 확인합니다.

  5. 다운로드하려는 인증서의 작업 열에서 를 클릭합니다.

  6. 다운로드에서 인증서를 클릭합니다. 인증서 체인을 클릭하여 인증서 체인을 다운로드할 수 있습니다.

gcloud

인증서의 전체 설명을 보려면 다음 명령어를 실행합니다.

gcloud privateca certificates describe CERT_NAME \
    --issuer-pool POOL_ID

gcloud privateca certificates describe 명령어에 대한 자세한 내용은 gcloud privateca certificates describe를 참조하세요.

PEM으로 인코딩된 X.509 인증서 체인을 파일로 내보내려면 다음 명령어를 실행합니다.

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

gcloud privateca certificates export 명령어에 대한 자세한 내용은 gcloud privateca certificates export를 참조하세요.

인증서 소유 증명

공개 키 소유 증명은 인증서 요청자가 해당 인증서의 비공개 키를 보유하는지 확인합니다. CA Service는 요청자가 RFC 2986에 따라 PKCS #10 CSR을 제공하는 경우에만 소유 증명을 확인합니다. CertificateConfig의 요청과 같은 다른 형식의 인증서 요청에 대한 소유 증명은 적용되지 않습니다.

인증서 소유자가 해당 인증서의 비공개 키를 소유하고 있는지 여부를 확인하는 것은 인증서를 수락하는 클라이언트 응용 프로그램의 책임입니다. 인증서 발급 중 소유 증명 검사를 시행하는 것은 오작동하는 클라이언트로부터 보호하기 위한 심층 방어의 한 형태입니다. 이러한 클라이언트의 존재는 CA가 소유 증명을 확인하는지 여부와 관계없이 보안 취약점이 될 수 있습니다.

다음 단계