opentdf提供了python的客户端SDK,
通过pip install 进行安装。
pip3 install opentdf
具体使用可以参考:
https://github.com/opentdf/opentdf/blob/main/quickstart/tests/oidc-auth.py
import sys
from opentdf import TDFClient, NanoTDFClient, OIDCCredentials, LogLevel, TDFStorageType# encrypt the file and apply the policy on tdf file and also decrypt.
OIDC_ENDPOINT = "http://localhost:65432"
KAS_URL = "http://localhost:65432/api/kas"try:# Create OIDC credentials objectoidc_creds = OIDCCredentials()oidc_creds.set_client_credentials_client_secret(client_id="tdf-client",client_secret="123-456",organization_name="tdf",oidc_endpoint=OIDC_ENDPOINT,)...
opentdf的SDK是用c++开发的,之后封装成了各种语言,包括C,python,java,c#,golang。
是SDK封装成各种语言的一个很好的示例。
有空也可以详细讲讲。
SDK功能
opentdf的SDK提供各种加解密的接口。
SDK需要配合opentdf官方提供的后台服务一起使用。
后台服务的代码位于 GitHub - opentdf/backend: Service providers for a protected data lifecycle
后台服务的docker 版本位于 GitHub - opentdf/opentdf: Quickstart guide, examples, an