Skip to content

Commit

Permalink
Update and add new KMS samples (GoogleCloudPlatform#2699)
Browse files Browse the repository at this point in the history
* Update and add new KMS samples

* Address review feedback

* Rename files

* Rotate 30d
  • Loading branch information
sethvargo authored Apr 22, 2020
1 parent d4e4e2a commit e3ec44e
Show file tree
Hide file tree
Showing 41 changed files with 2,510 additions and 1,961 deletions.
38 changes: 8 additions & 30 deletions kms/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Cloud Key Management Service
# Google Cloud KMS

<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=kms/README.md">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

Google [Cloud Key Management Service](https://cloud.google.com/kms/) is a
cloud-hosted key management service that lets you manage encryption for your
cloud services the same way you do on-premise. You can generate, use, rotate and
destroy AES-256 encryption keys. These sample Java applications demonstrate
how to access the KMS API using the Google Java API Client Libraries.
Google [Cloud KMS](https://cloud.google.com/kms/) is a cloud-hosted key
management service for encrypting, decrypting, signing, and verifying data.
These sample Java applications demonstrate how to access the Cloud KMS API using the
Google Java API Client Libraries.

## Prerequisites

Expand All @@ -19,7 +18,9 @@ You must [enable the Google Cloud KMS API](https://console.cloud.google.com/flow

You must set your project ID in order to run the tests

`$export GOOGLE_CLOUD_PROJECT=<your-project-id-here>`
```
$ export GOOGLE_CLOUD_PROJECT="<your-project-id-here>"
```

### Grant Permissions

Expand All @@ -32,26 +33,3 @@ You must ensure that the [user account or service account](https://cloud.google.
* Cloud KMS CryptoKey Signer/Verifier

More information can be found in the [Google KMS Docs](https://cloud.google.com/kms/docs/reference/permissions-and-roles)

## Quickstart

Install [Maven](http://maven.apache.org/).

Build your project with:

mvn clean compile assembly:single

You can run the quickstart with:

java -cp target/kms-samples-1.0.11-jar-with-dependencies.jar \
com.example.Quickstart [your-project-id] [your-location]

and can see the available snippet commands with:

java -cp target/kms-samples-1.0.11-jar-with-dependencies.jar \
com.example.Snippets

For example:

java -cp target/kms-samples-1.0.11-jar-with-dependencies.jar \
com.example.Snippets createKeyRing -p [your-project-id] [your-location] myFirstKeyRing
45 changes: 3 additions & 42 deletions kms/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.cloud.kms.samples</groupId>
<groupId>kms</groupId>
<artifactId>kms-samples</artifactId>
<packaging>jar</packaging>

Expand All @@ -21,33 +21,13 @@
<maven.compiler.source>1.8</maven.compiler.source>
</properties>


<!--
Using libraries-bom to manage versions.
See https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM
-->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>4.4.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-kms</artifactId>
<version>1.38.0</version>
</dependency>
<dependency>
<groupId>args4j</groupId>
<artifactId>args4j</artifactId>
<version>2.33</version>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
Expand All @@ -62,23 +42,4 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>

</project>
255 changes: 0 additions & 255 deletions kms/src/main/java/com/example/Asymmetric.java

This file was deleted.

Loading

0 comments on commit e3ec44e

Please sign in to comment.