GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — java-docs-samples/cloud-sql/postgres/client-side-encryption at main · derrickaw/java-docs-samples

Expand file tree

/

client-side-encryption

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

client-side-encryption

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
src
src
 
 
README.md
README.md
 
 
example.envrc
example.envrc
 
 
pom.xml
pom.xml
 
 

README.md

Outline

Encrypting fields in Cloud SQL - Postgres with Tink

Before you begin

  1. If you haven't already, set up a Java Development Environment (including google-cloud-sdk and maven utilities) by following the java setup guide and create a project.

  2. Create a 2nd Gen Cloud SQL Instance by following these instructions. Note the connection string, database user, and database password that you create.

  3. Create a database for your application by following these instructions. Note the database name.

  4. Create a KMS key for your application by following these instructions. Copy the resource name of your created key.

  5. Create a service account with the 'Cloud SQL Client' permissions by following these instructions. Then, add the 'Cloud KMS CryptoKey Encrypter/Decrypter' permission for the key to your service account by following these instructions.

Running Locally

Before running, copy the example.envrc file to .envrc and replace the values for GOOGLE_APPLICATION_CREDENTIALS, DB_USER, DB_PASS, DB_NAME, INSTANCE_CONNECTION_NAME, and CLOUD_KMS_URI with the values from your project. Then run source .envrc or optionally use direnv.

Once the environment variables have been set, run:

mvn exec:java -Dexec.mainClass=cloudsql.tink.EncryptAndInsertData

and

mvn exec:java -Dexec.mainClass=cloudsql.tink.QueryAndDecryptData
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.