Skip to content

Latest commit

 

History

History

snippets

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Google Cloud Private Certificate Authority Service

Open in Cloud Shell

Google Cloud Private Certificate Authority Service is a highly available, scalable Google Cloud service that enables you to simplify, automate, and customize the deployment, management, and security of private certificate authorities (CA).

These sample Java applications demonstrate how to access the Cloud CA API using the Google Java API Client Libraries.

Prerequisites

Google Cloud Project

Set up a Google Cloud project with billing enabled.

Enable the API

You must enable the Google Private Certificate Authority Service API for your project in order to use these samples.

Service account

A service account with private key credentials is required to create signed bearer tokens. Create a service account and download the credentials file as JSON.

Set Environment Variables

You must set your project ID and service account credentials in order to run the tests.

export GOOGLE_CLOUD_PROJECT="<google-project-id-here>"
export GOOGLE_APPLICATION_CREDENTIALS="<path-to-service-account-credentials-file>"

Grant Permissions

You must ensure that the user account or service account you used to authorize your gcloud session has the proper permissions to edit Private CA resources for your project. In the Cloud Console under IAM, add the following roles to the project whose service account you're using to test:

  • Cloud CA Service Admin
  • Cloud CA Service Certificate Requester
  • Cloud CA Service Certificate Manager
  • Cloud CA Service Certificate Template User
  • Cloud CA Service Workload Certificate Requester
  • Cloud CA Service Operation Manager
  • Cloud CA Service Auditor

More information can be found in the Google Private Certificate Authority Service Docs.

Build and Run

The following instructions will help you prepare your development environment.

  1. Download and install the Java Development Kit (JDK). Verify that the JAVA_HOME environment variable is set and points to your JDK installation.

  2. Download and install Apache Maven by following the Maven installation guide for your specific operating system.

  3. Clone the GoogleCloudPlatform/java-docs-samples repository.

git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git
  1. Navigate to the sample code directory.
cd privateca/snippets
  1. Run the SnippetsIT test file present under the test folder.

Crypto frameworks

Bouncy Castle cryptographic framework is used as a part of testing.