Skip to main content

No project description provided

Project description

ash-kms

The library provides functionality to handle GCP KMS encryption keys and operations

  • The library allows the creation of a new key-ring within GCP KMS.
  • The library allows the creation of a new encryption key within GCP KMS.
  • The library provides functionality to encrypt secrets using the specified encryption key.
  • Users can decrypt secrets using the specified encryption key.

Installation

pip install ash-kms

Usage

from ash_kms import EncryptionService

key_ring_id = "test_key_ring_id"
key_id = "test_key"
location_id = "global"
plaintext = "asdf1234"

service = EncryptionService(project_id="ash-dev-273120")

key_ring_name = service.create_key_ring(location_id=location_id, key_ring_id=key_ring_id)
print(key_ring_name)

key = service.create_key_symmetric_encrypt_decrypt(location_id=location_id, key_ring_id=key_ring_id, key_id=key_id)
print(key.name)

ciphertext = service.encrypt_symmetric(location_id=location_id, key_ring_id=key_ring_id, key_id=key_id,
                                       plaintext=plaintext)

print(f"{ciphertext=}")
decrypted_plaintext = service.decrypt_symmetric(location_id=location_id, key_ring_id=key_ring_id, key_id=key_id,
                                                ciphertext=ciphertext)

print(f"{plaintext=}")

assert decrypted_plaintext == plaintext

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

ash_kms-0.1.0.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

ash_kms-0.1.0-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

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