No project description provided
Project description
opentdf-python-sdk
Unofficial OpenTDF SDK for Python
Installation
Install from PyPI.org:
pip install otdf_python
Usage
Simple usage examples are given below. In addition, see the content of validate_otdf_python.py
.
Example: Encrypt a string
from otdf_python.gotdf_python import EncryptString
config: EncryptionConfig = _get_configuration()
tdf_manifest_json = EncryptString(inputText="Hello from Python", config=config)
Example: Encrypt a file
from otdf_python.gotdf_python import EncryptFile
from otdf_python.go import Slice_string
with tempfile.TemporaryDirectory() as tmpDir:
print("Created temporary directory", tmpDir)
da = Slice_string(["https://example.com/attr/attr1/value/value1", "https://example.com/attr/attr1/value/value2"])
config: EncryptionConfig = EncryptionConfig(
ClientId="opentdf-sdk",
ClientSecret="secret",
PlatformEndpoint=platformEndpoint,
TokenEndpoint="http://localhost:8888/auth/realms/opentdf/protocol/openid-connect/token",
KasUrl=f"http://{platformEndpoint}/kas",
# FIXME: Be careful with binding the 'DataAttributes' field on this struct.
#
# In golang, this is initialized as []string , but passing
# DataAttributes=None, or DataAttributes=[] from Python will fail.
# DataAttributes=...
DataAttributes=da,
)
encrypted_file = Path(tmpDir) / "some-file.tdf"
if encrypted_file.exists():
encrypted_file.unlink()
if encrypted_file.exists():
raise ValueError(
"The output path should not exist before calling 'EncryptFile()'."
)
outputFilePath = EncryptFile(
inputFilePath=str(SOME_PLAINTEXT_FILE),
outputFilePath=str(encrypted_file),
config=config,
)
print(f"The output file was written to destination path: {outputFilePath}")
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
Built Distributions
File details
Details for the file otdf_python-0.0.11-py3-none-any.whl
.
File metadata
- Download URL: otdf_python-0.0.11-py3-none-any.whl
- Upload date:
- Size: 5.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 496530446f57479da59c32dee73a1f5b49d203ba26f3b83264d5279c38821a6b |
|
MD5 | ab37e51c16632cfa3f8a5a2611b4a386 |
|
BLAKE2b-256 | 7deb26cd7e3e01cadf05435acad8b539ce87d9784800d4c475524eb4d41f9868 |
File details
Details for the file otdf_python-0.0.11-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: otdf_python-0.0.11-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 9.5 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f3d68ca833b7411dd45594b0aaa96dfacc4ea2d5e2c84f6cf8e273fff8b7e03 |
|
MD5 | 1e43a225b94c471d46024dc9122c9be9 |
|
BLAKE2b-256 | a44acade1395444544c972c518dfb0ed84c23a754225eabb8c5246df8a64f354 |
File details
Details for the file otdf_python-0.0.11-cp312-cp312-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: otdf_python-0.0.11-cp312-cp312-macosx_13_0_x86_64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.12, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52c5952ae9092599af4ca549441b48989ae54034ccbf0d519644c9b5c4e42ac8 |
|
MD5 | 08ce4155018a984560c08b1439a19cc6 |
|
BLAKE2b-256 | 37ee69408efa389af22dac1c0878efb14535106a4b1fbbe9b3c705519a6eac62 |
File details
Details for the file otdf_python-0.0.11-cp312-cp312-macosx_13_0_arm64.whl
.
File metadata
- Download URL: otdf_python-0.0.11-cp312-cp312-macosx_13_0_arm64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.12, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65fa087615b4155c9c2a26d9b81a5422a62f64f8ee25b1451957485f3b927579 |
|
MD5 | 9f14587a99df92d92be037f8a1817766 |
|
BLAKE2b-256 | 34f6f875346d3c90028217846f8efd498563773c5d99134aead992332acbd954 |
File details
Details for the file otdf_python-0.0.11-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: otdf_python-0.0.11-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 9.5 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bdab2239f245690cbd73e7f6532af87a4120176b37c1c763dd2d1cb2df94c61 |
|
MD5 | 76742bbdd2a652fe4184021534475b8e |
|
BLAKE2b-256 | d31b3c9d08cd2b8540fc26a0f53dcb3971ce6bd7d01f05da595d4f0f21a856a1 |
File details
Details for the file otdf_python-0.0.11-cp311-cp311-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: otdf_python-0.0.11-cp311-cp311-macosx_13_0_x86_64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.11, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | facf220a95699c2fef82d170e0e4b9fe768cce5e6f737d37de6e7136c3f6b60c |
|
MD5 | 44ae40da1d5d58405cce82ff663bb4a7 |
|
BLAKE2b-256 | 7516539822cb41dad1d4965f6c0184defdacdd4faddb8de3d0764f7d62d3f052 |
File details
Details for the file otdf_python-0.0.11-cp311-cp311-macosx_13_0_arm64.whl
.
File metadata
- Download URL: otdf_python-0.0.11-cp311-cp311-macosx_13_0_arm64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.11, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e50d4324d9a37b095cdf36f7d39c236a7216535c775290d78d82fc470c5fe3c3 |
|
MD5 | 1936a6f183602e4b81c99881b962760c |
|
BLAKE2b-256 | d5fb227c790e924699cf448b6d60d401a510dfd1d4be42d230994409ad9b132a |