otdf-python 0.0.10__py3-none-any.whl → 0.0.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- otdf_python/_gotdf_python.cpython-311-darwin.so +0 -0
- otdf_python/build.py +2 -2
- otdf_python/gotdf_python.py +6 -6
- otdf_python-0.0.11.dist-info/METADATA +82 -0
- otdf_python-0.0.11.dist-info/RECORD +10 -0
- {otdf_python-0.0.10.dist-info → otdf_python-0.0.11.dist-info}/WHEEL +1 -1
- otdf_python-0.0.10.dist-info/METADATA +0 -26
- otdf_python-0.0.10.dist-info/RECORD +0 -10
- {otdf_python-0.0.10.dist-info → otdf_python-0.0.11.dist-info}/LICENSE +0 -0
- {otdf_python-0.0.10.dist-info → otdf_python-0.0.11.dist-info}/top_level.txt +0 -0
|
Binary file
|
otdf_python/build.py
CHANGED
|
@@ -178,13 +178,13 @@ mod.add_function('gotdf_python_TokenAuth_AccessToken_Get', retval('char*'), [par
|
|
|
178
178
|
mod.add_function('gotdf_python_TokenAuth_AccessToken_Set', None, [param('int64_t', 'handle'), param('char*', 'val')])
|
|
179
179
|
mod.add_function('gotdf_python_TokenAuth_NpeClientId_Get', retval('char*'), [param('int64_t', 'handle')])
|
|
180
180
|
mod.add_function('gotdf_python_TokenAuth_NpeClientId_Set', None, [param('int64_t', 'handle'), param('char*', 'val')])
|
|
181
|
+
add_checked_string_function(mod, 'gotdf_python_DecryptFilePE', retval('char*'), [param('char*', 'inputFilePath'), param('char*', 'outputFilePath'), param('int64_t', 'config'), param('int64_t', 'token')])
|
|
182
|
+
add_checked_string_function(mod, 'gotdf_python_DecryptStringPE', retval('char*'), [param('char*', 'inputText'), param('int64_t', 'config'), param('int64_t', 'token')])
|
|
181
183
|
add_checked_string_function(mod, 'gotdf_python_EncryptFile', retval('char*'), [param('char*', 'inputFilePath'), param('char*', 'outputFilePath'), param('int64_t', 'config')])
|
|
182
184
|
add_checked_string_function(mod, 'gotdf_python_EncryptFilePE', retval('char*'), [param('char*', 'inputFilePath'), param('char*', 'outputFilePath'), param('int64_t', 'config'), param('int64_t', 'token')])
|
|
183
185
|
add_checked_string_function(mod, 'gotdf_python_EncryptString', retval('char*'), [param('char*', 'inputText'), param('int64_t', 'config')])
|
|
184
186
|
add_checked_string_function(mod, 'gotdf_python_Hello', retval('char*'), [])
|
|
185
187
|
add_checked_string_function(mod, 'gotdf_python_DecryptFile', retval('char*'), [param('char*', 'inputFilePath'), param('char*', 'outputFilePath'), param('int64_t', 'config')])
|
|
186
|
-
add_checked_string_function(mod, 'gotdf_python_DecryptFilePE', retval('char*'), [param('char*', 'inputFilePath'), param('char*', 'outputFilePath'), param('int64_t', 'config'), param('int64_t', 'token')])
|
|
187
|
-
add_checked_string_function(mod, 'gotdf_python_DecryptStringPE', retval('char*'), [param('char*', 'inputText'), param('int64_t', 'config'), param('int64_t', 'token')])
|
|
188
188
|
|
|
189
189
|
mod.generate(open('gotdf_python.c', 'w'))
|
|
190
190
|
|
otdf_python/gotdf_python.py
CHANGED
|
@@ -347,6 +347,12 @@ class TokenAuth(go.GoClass):
|
|
|
347
347
|
|
|
348
348
|
|
|
349
349
|
# ---- Functions ---
|
|
350
|
+
def DecryptFilePE(inputFilePath, outputFilePath, config, token):
|
|
351
|
+
"""DecryptFilePE(str inputFilePath, str outputFilePath, object config, object token) str, str"""
|
|
352
|
+
return _gotdf_python.gotdf_python_DecryptFilePE(inputFilePath, outputFilePath, config.handle, token.handle)
|
|
353
|
+
def DecryptStringPE(inputText, config, token):
|
|
354
|
+
"""DecryptStringPE(str inputText, object config, object token) str, str"""
|
|
355
|
+
return _gotdf_python.gotdf_python_DecryptStringPE(inputText, config.handle, token.handle)
|
|
350
356
|
def EncryptFile(inputFilePath, outputFilePath, config):
|
|
351
357
|
"""EncryptFile(str inputFilePath, str outputFilePath, object config) str, str"""
|
|
352
358
|
return _gotdf_python.gotdf_python_EncryptFile(inputFilePath, outputFilePath, config.handle)
|
|
@@ -373,11 +379,5 @@ def Hello():
|
|
|
373
379
|
def DecryptFile(inputFilePath, outputFilePath, config):
|
|
374
380
|
"""DecryptFile(str inputFilePath, str outputFilePath, object config) str, str"""
|
|
375
381
|
return _gotdf_python.gotdf_python_DecryptFile(inputFilePath, outputFilePath, config.handle)
|
|
376
|
-
def DecryptFilePE(inputFilePath, outputFilePath, config, token):
|
|
377
|
-
"""DecryptFilePE(str inputFilePath, str outputFilePath, object config, object token) str, str"""
|
|
378
|
-
return _gotdf_python.gotdf_python_DecryptFilePE(inputFilePath, outputFilePath, config.handle, token.handle)
|
|
379
|
-
def DecryptStringPE(inputText, config, token):
|
|
380
|
-
"""DecryptStringPE(str inputText, object config, object token) str, str"""
|
|
381
|
-
return _gotdf_python.gotdf_python_DecryptStringPE(inputText, config.handle, token.handle)
|
|
382
382
|
|
|
383
383
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: otdf_python
|
|
3
|
+
Version: 0.0.11
|
|
4
|
+
Home-page: https://github.com/b-long/opentdf-python-sdk
|
|
5
|
+
Author-email: b-long@users.noreply.github.com
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
|
|
9
|
+
# opentdf-python-sdk
|
|
10
|
+
|
|
11
|
+
Unofficial OpenTDF SDK for Python
|
|
12
|
+
|
|
13
|
+
[](https://github.com/b-long/opentdf-python-sdk/actions?query=workflow%3APyPIBuild)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Install from PyPI.org:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install otdf_python
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
Simple usage examples are given below. In addition, see the content of `validate_otdf_python.py` .
|
|
27
|
+
|
|
28
|
+
### Example: Encrypt a string
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from otdf_python.gotdf_python import EncryptString
|
|
32
|
+
|
|
33
|
+
config: EncryptionConfig = _get_configuration()
|
|
34
|
+
|
|
35
|
+
tdf_manifest_json = EncryptString(inputText="Hello from Python", config=config)
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Example: Encrypt a file
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from otdf_python.gotdf_python import EncryptFile
|
|
43
|
+
from otdf_python.go import Slice_string
|
|
44
|
+
|
|
45
|
+
with tempfile.TemporaryDirectory() as tmpDir:
|
|
46
|
+
print("Created temporary directory", tmpDir)
|
|
47
|
+
|
|
48
|
+
da = Slice_string(["https://example.com/attr/attr1/value/value1", "https://example.com/attr/attr1/value/value2"])
|
|
49
|
+
|
|
50
|
+
config: EncryptionConfig = EncryptionConfig(
|
|
51
|
+
ClientId="opentdf-sdk",
|
|
52
|
+
ClientSecret="secret",
|
|
53
|
+
PlatformEndpoint=platformEndpoint,
|
|
54
|
+
TokenEndpoint="http://localhost:8888/auth/realms/opentdf/protocol/openid-connect/token",
|
|
55
|
+
KasUrl=f"http://{platformEndpoint}/kas",
|
|
56
|
+
# FIXME: Be careful with binding the 'DataAttributes' field on this struct.
|
|
57
|
+
#
|
|
58
|
+
# In golang, this is initialized as []string , but passing
|
|
59
|
+
# DataAttributes=None, or DataAttributes=[] from Python will fail.
|
|
60
|
+
# DataAttributes=...
|
|
61
|
+
DataAttributes=da,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
encrypted_file = Path(tmpDir) / "some-file.tdf"
|
|
65
|
+
|
|
66
|
+
if encrypted_file.exists():
|
|
67
|
+
encrypted_file.unlink()
|
|
68
|
+
|
|
69
|
+
if encrypted_file.exists():
|
|
70
|
+
raise ValueError(
|
|
71
|
+
"The output path should not exist before calling 'EncryptFile()'."
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
outputFilePath = EncryptFile(
|
|
75
|
+
inputFilePath=str(SOME_PLAINTEXT_FILE),
|
|
76
|
+
outputFilePath=str(encrypted_file),
|
|
77
|
+
config=config,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
print(f"The output file was written to destination path: {outputFilePath}")
|
|
81
|
+
|
|
82
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
otdf_python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
otdf_python/_gotdf_python.cpython-311-darwin.so,sha256=fI0Up2Nk3hgxXpp2CD_u5nQvBztk3tbPUB_DoIYfO9E,15112432
|
|
3
|
+
otdf_python/build.py,sha256=WwdUm0ey-MV1OuYjVcp12cKprHkHzGiupk4GphbhP9U,16756
|
|
4
|
+
otdf_python/go.py,sha256=7kz0kwEbEJZp9ZJIvdcUryZmhahLRb5RrkhGBN2BDBY,49317
|
|
5
|
+
otdf_python/gotdf_python.py,sha256=UtT6rqs7pEM7KiXEVApKBAP_Xx1s1_6mifL6_TVqN_g,13880
|
|
6
|
+
otdf_python-0.0.11.dist-info/LICENSE,sha256=51wzGxR-Rns8XaiGmDLq2OqPN3qWMpoQKV-fERpVzyM,1063
|
|
7
|
+
otdf_python-0.0.11.dist-info/METADATA,sha256=X7-5_6L_HpBWhGSyVI-v3ujgsOBDtgEqPu4GKMwie78,2316
|
|
8
|
+
otdf_python-0.0.11.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
9
|
+
otdf_python-0.0.11.dist-info/top_level.txt,sha256=A2vK95iTIxdu4pm8kDZlvHorBKCvSN5dvlMdFbIVXrA,12
|
|
10
|
+
otdf_python-0.0.11.dist-info/RECORD,,
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: otdf_python
|
|
3
|
-
Version: 0.0.10
|
|
4
|
-
Home-page: https://github.com/b-long/opentdf-python-sdk
|
|
5
|
-
Author-email: b-long@users.noreply.github.com
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
License-File: LICENSE
|
|
8
|
-
|
|
9
|
-
# opentdf-python-sdk
|
|
10
|
-
|
|
11
|
-
Unofficial OpenTDF SDK for Python
|
|
12
|
-
|
|
13
|
-
[](https://github.com/b-long/opentdf-python-sdk/actions?query=workflow%3APyPIBuild)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
Install from PyPI.org:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
pip install otdf_python
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Usage
|
|
25
|
-
|
|
26
|
-
See `validate_otdf_python.py` for usage examples.
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
otdf_python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
otdf_python/_gotdf_python.cpython-311-darwin.so,sha256=fKnB15EsCuBIYojneErkAwjE0uyrlhscu5blp224YDs,15112432
|
|
3
|
-
otdf_python/build.py,sha256=1rFsosV3JfeaySm5QT14CY0x51go6XbdiL3UgreyIek,16756
|
|
4
|
-
otdf_python/go.py,sha256=7kz0kwEbEJZp9ZJIvdcUryZmhahLRb5RrkhGBN2BDBY,49317
|
|
5
|
-
otdf_python/gotdf_python.py,sha256=PcXrL4WNGcK-peWHhO1Xt72KYgE3US2Q0y33OlcHGtQ,13880
|
|
6
|
-
otdf_python-0.0.10.dist-info/LICENSE,sha256=51wzGxR-Rns8XaiGmDLq2OqPN3qWMpoQKV-fERpVzyM,1063
|
|
7
|
-
otdf_python-0.0.10.dist-info/METADATA,sha256=5WhOylKFnYmehQtp8g7kTKe1GsxJ5mJmaCIyQ6IzW2k,586
|
|
8
|
-
otdf_python-0.0.10.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
|
9
|
-
otdf_python-0.0.10.dist-info/top_level.txt,sha256=A2vK95iTIxdu4pm8kDZlvHorBKCvSN5dvlMdFbIVXrA,12
|
|
10
|
-
otdf_python-0.0.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|