Gỡ lỗi khi đăng ký
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tink đôi khi tạo ra các thông báo lỗi như
No wrapper registered for type
No manager for type T has been registered
Unable to get primitive interface P for key of type T
Trang này giúp gỡ lỗi các vấn đề như vậy.
Trường hợp 1: Lỗi gắn dấu sao với "Không tìm thấy trình bao bọc" hoặc tương tự.
Bạn đang gọi GetPrimitive()
để lấy kiểu gốc chưa được đăng ký. Kiểu này thường được khắc phục bằng cách gọi TinkConfig.register()
ở đâu đó trước đó trong tệp nhị phân. Bạn chỉ cần đăng ký một lần là đủ và có thể thực hiện khi khởi động.
Một số dữ liệu gốc cần đăng ký chuyên biệt hơn.
KeysetDeriver
cần có KeyDerivationConfig.register()
JwtMac
cần có JwtMacConfig.register()
JwtPublicKeySign
và JwtPublicKeyVerify
yêu cầu JwtSignatureConfig.register()
Trường hợp 2: Lỗi liệt kê một loại khoá và dữ liệu nguyên gốc.
Ví dụ: lỗi có thể hiển thị Unable to get primitive interface P for key
of type T
cho một số giá trị cụ thể của P và T.
Trong trường hợp này, Tink không thể tạo dữ liệu gốc cụ thể mà bạn đã yêu cầu cho tập hợp khoá mà bạn có. Thông thường, trường hợp này xảy ra do bạn có một tập hợp khoá không đúng loại. Ví dụ: có thể bạn yêu cầu dùng máy Mac, nhưng bộ khoá là dành cho Aead.
Một trường hợp phổ biến là người dùng cố gắng lấy nguyên gốc khoá công khai từ tập hợp khoá chứa khoá riêng tư. Để xem đây có phải là vấn đề không, hãy cân nhắc gọi GetPrimitive()
trên kết quả của GetPublicKeysetHandle()
.
Nếu cách này không hiệu quả, bạn có thể xem danh sách mới nhất về các loại khoá tại đây, trong phần kiểm thử trên nhiều ngôn ngữ của chúng tôi. Bạn nên kiểm tra xem P gốc có được liệt kê cùng với loại khoá T hay không.
Nếu dữ liệu gốc được liệt kê với loại khoá tương ứng, thì có thể cách triển khai Tink của ngôn ngữ không hỗ trợ loại khoá T. Kiểm tra danh sách các loại khoá để xem Tink có hỗ trợ loại khoá bằng ngôn ngữ của bạn hay không.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\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,["# Debug Registration Errors\n\nTink sometimes produces error messages such as\n\n- `No wrapper registered for type`\n- `No manager for type T has been registered`\n- `Unable to get primitive interface P for key of type T`\n\nThis page helps to debug such issues.\n\nCase 1: The error stars with \"No wrapper found\" or similar.\n-----------------------------------------------------------\n\nYou are calling `GetPrimitive()` to get a primitive type that has not been\nregistered, which is generally fixed by calling `TinkConfig.register()`\nsomewhere earlier in the binary. Registering once suffices and can be done at\nstartup.\n\nSome primitives need more specialized registration.\n\n- `KeysetDeriver` requires `KeyDerivationConfig.register()`\n- `JwtMac` requires `JwtMacConfig.register()`\n- `JwtPublicKeySign` and `JwtPublicKeyVerify` require `JwtSignatureConfig.register()`\n\nCase 2: The error lists a key type and a primitive.\n---------------------------------------------------\n\nFor example, the error might say `Unable to get primitive interface P for key\nof type T` for some specific value of P and T.\n\nIn this case, Tink is unable to create the specific primitive you asked it\nfor the keyset you have. Typically, this happens because you have a keyset\nfor the wrong type. For example, you might be asking for a Mac, but the keyset\nis for Aead.\n\nOne common case is that one tries to get a public key primitive from a keyset\ncontaining private keys. To see if this is the problem, consider calling\n`GetPrimitive()` on the result of `GetPublicKeysetHandle()` instead.\n\nIf this does not help, an up to date list of the key types can be found\n[here](https://github.com/tink-crypto/tink-cross-lang-tests/blob/main/cross_language/cross_language/tink_config/_key_types.py),\nin our [cross language tests](https://github.com/tink-crypto/tink-cross-lang-tests/blob/main/cross_language/cross_language). You should check if the primitive P is listed\ntogether with the key type T.\n\nIf the primitive is listed with the corresponding key type, it may be that\nthe Tink implementation of your language does not support key type T. Check the\n[list of key types](/tink/supported-key-types) to see if Tink supports your key\ntype in your language."]]