Code Monkey home page Code Monkey logo

storage-client-side-encryption-proxy's Introduction

storage-client-side-encryption-proxy

This tool uses Tink to perform client side encryption operations backed against Google Cloud KMS. It is both a client side encryption/decryption tool as well as a decrypting proxy for Google Cloud Storage.

This is not an officially supported Google product

Pre-Setup

  1. You have golang 1.14 or newer installed

Setup

  1. Create a service account that can encrypt and decrypt
  2. Use application credential: https://cloud.google.com/docs/authentication/production
  3. Setup a bucket to store your encrypted files.
  4. Setup KMS and create a key in the same region as your bucket
  5. acquire certificate and corresponding key for TLS. Place in the tools directory, and name them as follows. Note: you can change the names and location by altering the scriptes/variables.sh file
    1. tools/cert.pem
    2. tools/key.pem
    3. Note: for testing, consider creating a self signed cert: https://golang.org/src/crypto/tls/generate_cert.go
  6. edit scripts/variables.sh with your GCP information (i.e bucket name and key name)

Building

  1. go build -o tinkproxy

Running

This example uses the binary built named tinkproxy as described in the previous step. The tool uses Tink backed by Google Cloud KMS to encrypt a data encryption key (DEK) per directory, which is then uploaded to your GCS bucket. After the encrypted files are uploaded, a single file is then downlaod through the decrypting proxy, which decrypts using the appropriate KMS key.

  1. ./tinkproxy --help
  2. source scripts/variables.sh # be sure to edit the configuration to match your environment
  3. ./scripts/uploadDirectory.sh samples
  4. ./scripts/getObject.sh
  5. ./scripts/cleanup.sh

Also, you can encrypt and decrypt individual files

  1. ./tinkproxy vanish samples/gettysburg.pdf -o demo.cipher
  2. ./tinkproxy reveal demo.cipher -o cleartext.pdf

Production Considerations

Consider the following items when using for production.

  1. build and version the binary
  2. deploy the proxy on trusted compute such as shielded VMs, use tmpfs, and private network access along with other controls to mitigate data exfiltration (e.g VPC-SC)
  3. use certificates and AAD that meet your security governance requirements
  4. use appropriate logging levels and client timeouts

storage-client-side-encryption-proxy's People

Contributors

erlanderlo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.