Skip to main content

Decipher the Berglas keys

Project description

Overview

Python library help to use Berglas, to encrypt and to decrypt the secrets stored in a GCP storage.

See Berglas for details about bucket bootstrapping and secret creation

Library Usage

You have to get the library

pip install berglas-python

Then use it in the same way as Go library

The library berglas_python library is able to:

Here an example of usage

import os

import berglas_python as berglas

project_id = os.environ.get("MY-PROJECT")

# This higher-level API parses the secret reference at the specified
# environment variable, downloads and decrypts the secret, and replaces the
# contents of the given environment variable with the secret result.

berglas.Replace(project_id, "MY-SECRET")

# This lower-level API parses the secret reference, downloads and decrypts
# the secret, and returns the result. This is useful if you need to mutate
# the result.
my_secret = os.environ.get("MY-SECRET")
plaintext = berglas.Resolve(project_id, my_secret)
os.environ.unsetenv("MY-SECRET")
os.environ.setdefault("MY-SECRET", plaintext)

# This is lower-level API encrypts the plaintext string and uploads the blob
berglas.Encrypt(project_id, 'MY-BUCKET/MY-SECRET-FILE', 'STRING-TO-ENCRYPT')

License

This library is licensed under Apache 2.0. Full license text is available in LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

berglas_python-0.3.3.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

berglas_python-0.3.3-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file berglas_python-0.3.3.tar.gz.

File metadata

  • Download URL: berglas_python-0.3.3.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.6.8

File hashes

Hashes for berglas_python-0.3.3.tar.gz
Algorithm Hash digest
SHA256 107460f5305c183c8e6180a87620e87320bab61fdc4ac341be31597603169717
MD5 3891155bb80d2ebf8cda6941b9cbe69c
BLAKE2b-256 01545f3264f04756716aed78237bc29d12f2ac044956ce105e7bfcf26476861c

See more details on using hashes here.

File details

Details for the file berglas_python-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: berglas_python-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.6.8

File hashes

Hashes for berglas_python-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ec509de7a90b252227a91d88c9cb42e6675b0a7351422befc597ab2943347d04
MD5 acc9733900e21f2a11090ced2435c90e
BLAKE2b-256 f9eb64d0100c0ab369e79854b66e45f2b49daabfcda18f1323c90c31484ba7b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page