Skip to main content

S3 Encryption Client for Python

Project description

Latest Version Supported Python Versions ci

Client-side encryption for S3

You can find the source on GitHub.

Getting Started

Required Prerequisites

  • Python 3.6+

Installation

Usage

import boto3
from s3_encryption_sdk import EncryptedClient
from s3_encryption_sdk.materials_providers import KmsMaterialsProvider


materials_provider = KmsMaterialsProvider(
   key_id="alias/YourAlias",
   client=boto3.client("kms", region_name="us-east-1"),
)

s3 = boto3.client("s3", region_name="us-east-1")

crypto_s3 = EncryptedClient(
   client=s3,
   materials_provider=materials_provider,
)

key = "4711"
plaintext = "foo bar"

crypto_s3.put_object(
   Bucket=bucket.name,
   Key=key,
   Body=plaintext,
)

encrypted_obj = s3.get_object(
   Bucket=bucket.name,
   Key="object",
)

decrypted_obj = crypto_s3.get_object(
   Bucket=bucket.name,
   Key="object",
)

assert plaintext != encrypted_obj["Body"].read().decode("utf8")
assert plaintext == decrypted_obj["Body"].read().decode("utf8")

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

s3-encryption-sdk-0.0.3.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

s3_encryption_sdk-0.0.3-py2.py3-none-any.whl (16.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file s3-encryption-sdk-0.0.3.tar.gz.

File metadata

  • Download URL: s3-encryption-sdk-0.0.3.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for s3-encryption-sdk-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2031f46f5082113be58d2cd658b268b030b3d8c86fd54315ba3c588189f27ccb
MD5 59eb99f44cd2ab935121c80a5e7a00b3
BLAKE2b-256 b187ce6f8455510dfd882c7d329f461a02e8ee88db525b45ad198d74da0d9ee1

See more details on using hashes here.

File details

Details for the file s3_encryption_sdk-0.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: s3_encryption_sdk-0.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for s3_encryption_sdk-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f0460654a34d0dbfd036469fa20729b181c65ffeda044b4de18bf0092997fdb4
MD5 c2880dfd7ad94b5ea9227902bcdf91d0
BLAKE2b-256 5f6732d79fa4a29f10315899ec8271023712f34fdc0a6577819e9abdafb4dd13

See more details on using hashes here.

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