Skip to main content

encryption primitives for use with aws

Project description

murmuration Build Status

encryption primitives for use with aws kms

aes + galois counter mode encryption

from murmuration import gcm
key = 'this is my secret encryptuion key'
plaintext = 'the quick brown fox jumps over the lazy dog'
ciphertext = gcm.encrypt(plaintext, key, 'header')
decrypted = gcm.decrypt(ciphertext, key)
assert decrypted == plaintext

encryption using kms (for use with aws)

You can also use kms as an encryption / decryption service. This does incur kms costs and require kms setup. The region and profile parameters do not have to be specified. If they are not specified, the values will be inferred in the order specified by boto3:

  1. Passing credentials as parameters in the boto.client() method
  2. Passing credentials as parameters when creating a Session object
  3. Environment variables
  4. Shared credential file (~/.aws/credentials)
  5. AWS config file (~/.aws/config)
  6. Assume Role provider
  7. Boto2 config file (/etc/boto.cfg and ~/.boto)
  8. Instance metadata service on an Amazon EC2 instance that has an IAM role configured.
from murmuration import kms
plaintext = 'the quick brown fox jumps over the lazy dog'
key_alias = 'my kms key alias'
ciphertext = kms.encrypt(plaintext, key_alias, region='us-west-1', profile='company')
decrypted = kms.decrypt(ciphertext, region='us-west-1', profile='company')
assert decrypted == plaintext

wrapped encryption using kms (for use with aws)

You can also use wrapped kms data keys for encryption to protect the underlying kms key. Using this does functionality will incur kms costs and require kms setup. The region and profile parameters do not have to be specified.
If they are not specified, the values will be inferred in the order specified by boto3:

  1. Passing credentials as parameters in the boto.client() method
  2. Passing credentials as parameters when creating a Session object
  3. Environment variables
  4. Shared credential file (~/.aws/credentials)
  5. AWS config file (~/.aws/config)
  6. Assume Role provider
  7. Boto2 config file (/etc/boto.cfg and ~/.boto)
  8. Instance metadata service on an Amazon EC2 instance that has an IAM role configured.
from murmuration import kms_wrapped
plaintext = 'the quick brown fox jumps over the lazy dog'
key_alias = 'my kms key alias'
ciphertext = kms_wrapped.encrypt(plaintext, key_alias, region='us-west-1', profile='company')
decrypted = kms_wrapped.decrypt(ciphertext, region='us-west-1', profile='company')
assert decrypted == 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

murmuration-0.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

murmuration-0.2-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file murmuration-0.2.tar.gz.

File metadata

  • Download URL: murmuration-0.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.0 CPython/3.7.2

File hashes

Hashes for murmuration-0.2.tar.gz
Algorithm Hash digest
SHA256 6a150cc003c5e224a2f831bfa02f589eb20d9fec3c941ce4d2a19d14d79f4119
MD5 38abe2bcc0f83be28caac5f973f1b941
BLAKE2b-256 e60c62ad7696ee97190f5d1be555ae50669fad9843c17c94745247c4a834c037

See more details on using hashes here.

File details

Details for the file murmuration-0.2-py3-none-any.whl.

File metadata

  • Download URL: murmuration-0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.0 CPython/3.7.2

File hashes

Hashes for murmuration-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dd5404afdbfb157abc92907d5ce58d5b822964943ee45dd1859f391d766612cd
MD5 e04cf971db2a2ea1b944cdce53994b4d
BLAKE2b-256 5a68907a023186c7616e6b161cc7d3221877a4d56ed1230d1c58347d5e11bfbd

See more details on using hashes here.

Supported by

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