Device License SDKPlatform 13.3.7 · SDK 3.1.0

維護

本機身分、TPM Key 與重置

理解 registration.json 與 TPM Key 的角色,安全地處理損壞、重裝與換機,而不讓 Client 解除 Server 綁定。

本機身分由兩部分組成

registration.json

保存非秘密的註冊識別資訊與 Server 關聯資料。它本身不足以冒充裝置。

TPM Key

私鑰保存在 Microsoft Platform Crypto Provider,正常情況不可匯出。Client 只要求 TPM 對 Challenge 簽章。

何時使用本機重置

  • registration.json 缺欄位或屬於另一個 Product
  • 測試環境要重新執行首次啟用
  • 管理員已完成換機/解除 Machine,舊電腦要清理
  • TPM Key 與註冊資料不一致,需要重新建立身分

安全重置範例

python
"""Delete only this client's local registration and matching TPM key."""

from keygen_device_sdk import LicenseSDKError





def reset_this_computer(client):

    try:

        info = client.local_identity_info()

        return client.reset_local_identity(

            expected_key_name=info.key_name,

            delete_registration=True,

            delete_tpm_key=True,

        )

    except LicenseSDKError as exc:

        raise RuntimeError(f"Local reset failed: {exc}") from exc



# This operation never deactivates the server-side Machine.

expected_key_name 是防呆邊界。你的 UI 應先顯示 Key Name 與 Product Namespace,要求使用者確認後再執行。

常見維護流程

情境Client 動作管理員動作
註冊檔損壞recover_local_identity 或本機重置必要時確認 Machine 狀態
更換電腦舊機本機重置、新機重新啟用先解除舊 Server Machine
只想重新測試使用測試 Product/License 重置避免操作正式客戶資料
License 被撤銷下一次驗證停止功能撤銷對應裝置身分與 Credential
下一步

把文件轉成可驗證的整合流程

先在測試 License 上完成首次註冊、後續驗證、撤銷與斷線測試,再將相同模式接入正式功能。

查看 Quickstart