Skip to main content

Python Wrapper for TDF3 SDK

Project description

TDF3 SDK

The TDF3 Python SDK allows developers to easily create and manage encrypted Trusted Data Format (TDF) objects and interact with Key Access and Entity Attribute Services (KAS, EAS).

Installation

Upgrade pip3 to the latest version and run

pip3 install tdf3sdk

Authentication

tdf3sdk allows users to set authentication headers (OIDC bearer tokens, etc), and will use those for authenticating with backing services - by design it does not contain authentication flow logic, for example to exchange client credentials for OIDC bearer tokens, refresh expired tokens, etc - it expects callers to handle that.

For an example of how to wrap this library in auth provider flows, see virtru-tdf3-cpp

OIDC

  1. Provide KAS url, user id, and set the use_oidc flag to true:
client = TDF3Client(kas_url, user_id, use_oidc=True)
  1. Provide the TDF3Client instance with your valid, previously obtained/generated OIDC bearer token:
client.set_auth_header('eyJhbGciOiJSUzI1NiIsInR5cCIg...')

Legacy EAS

Two different methods:

  1. Provide EAS url and user id (user should be registered on EAS):
client = TDF3Client(eas_url, user_id)
  1. Provide EAS url, user id, client key (absolute file path), client cetificate (absolute file path) and root CA (absolute file path)
client = TDF3Client(eas_url, user_id, filepath_client_key, filepath_client_cert, filepath_rootCA)

Create Encrypted TDF Object (minimal example)

from tdf3sdk import TDF3Client

client = TDF3Client(eas_url, user_id)
unprotected_file = "sensitive.txt"
protected_file = unprotected_file + ".tdf.html"

client.encrypt_file(unprotected_file, protected_file)

Terms of Service Privacy Policy

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

tdf3sdk-1.1.1b1129-cp39-cp39-macosx_10_14_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.9 macOS 10.14+ x86-64

tdf3sdk-1.1.1b1129-cp38-cp38-win_amd64.whl (2.1 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

tdf3sdk-1.1.1b1129-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (8.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

tdf3sdk-1.1.1b1129-cp38-cp38-macosx_10_14_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

tdf3sdk-1.1.1b1129-cp37-cp37m-win_amd64.whl (2.1 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

tdf3sdk-1.1.1b1129-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (8.2 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

tdf3sdk-1.1.1b1129-cp37-cp37m-macosx_10_14_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

tdf3sdk-1.1.1b1129-cp37-cp37m-linux_armv7l.whl (8.4 MB view hashes)

Uploaded CPython 3.7m

tdf3sdk-1.1.1b1129-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (8.2 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

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