偵錯註冊錯誤
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Tink 有時會產生錯誤訊息,例如
No wrapper registered for type
No manager for type T has been registered
Unable to get primitive interface P for key of type T
這個頁面可協助您對這類問題進行偵錯。
案例 1:錯誤星星有「找不到包裝函式」或類似文字。
您將呼叫 GetPrimitive()
來取得尚未註冊的原始類型,通常只要在二進位檔中較早的位置呼叫 TinkConfig.register()
,即可修正此問題。累積足夠的資料後,就可以開始註冊。
部分基元需要更專業的註冊。
- 「
KeysetDeriver
」需要 KeyDerivationConfig.register()
- 「
JwtMac
」需要 JwtMacConfig.register()
JwtPublicKeySign
和 JwtPublicKeyVerify
需要 JwtSignatureConfig.register()
案例 2:錯誤會列出金鑰類型和原始版本。
例如,這個錯誤可能會顯示 Unable to get primitive interface P for key
of type T
代表 P 和 T 的某些特定值。
在這種情況下,Tink 無法針對您擁有的金鑰組建立特定原始版本。之所以會發生這個問題,通常是因為您的金鑰組屬於錯誤的類型。舉例來說,您可能要求使用 Mac,但金鑰組是 Aead。
常見的情況是,嘗試從含有私密金鑰的金鑰組取得公開金鑰基元。如要確認這是否為問題所在,請考慮改為對 GetPublicKeysetHandle()
結果呼叫 GetPrimitive()
。
如果這無法解決問題,請參閱跨語言測試這篇文章,查看最新的金鑰類型清單。建議您檢查原始 P 是否與金鑰類型 T 一併列出。
如果原始版本列出了對應的金鑰類型,可能是因為您語言的 Tink 實作不支援金鑰類型 T。請查看金鑰類型清單,瞭解 Tink 是否支援您所用語言的金鑰類型。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eTink error messages like "No wrapper registered" often indicate missing primitive registration, fixable with \u003ccode\u003eTinkConfig.register()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eErrors mentioning key type and primitive usually mean an incompatible keyset is used, like requesting a Mac with an Aead keyset.\u003c/p\u003e\n"],["\u003cp\u003ePublic key primitives require keysets obtained via \u003ccode\u003eGetPublicKeysetHandle()\u003c/code\u003e to avoid key type mismatches.\u003c/p\u003e\n"],["\u003cp\u003eVerify key type and primitive compatibility by checking the cross-language test resources and supported key types documentation for your language.\u003c/p\u003e\n"]]],["Tink error messages like \"No wrapper registered\" or \"Unable to get primitive\" indicate issues with key and primitive type registration or compatibility. For \"No wrapper\" errors, register the type using `TinkConfig.register()` or specialized methods like `KeyDerivationConfig.register()`. For primitive-key type mismatches, verify that the keyset's type matches the requested primitive, and use `GetPublicKeysetHandle()` for public keys. Check supported key type lists if registration or type-checking does not fix the issue.\n"],null,[]]