什麼是 Tink?
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Tink 是由密碼學家編寫的開放原始碼密碼學程式庫,
擔任 Google 資安工程師Tink 的安全簡易 API 降低了常見的情況
以使用者為中心的設計、仔細執行和審查程式碼
並進行大量測試詳情請參閱本頁的「目標」一節,
更多的分析見解。
Tink 幫助沒有密碼編譯背景的使用者安全地實作
加密編譯任務Tink 已在 Google 的數百項產品中部署
和系統
為什麼要使用 Tink?
使用 Tink 最重要的理由如下:
簡單易用
密碼學很難抓對。有了 Tink,你可以
加密或簽署資料:
內建安全保證,只需加入幾行程式碼即可。Tink 也可以
協助您使用外部金鑰管理系統輪替金鑰或安全金鑰
(KMS)。
安全無虞
Tink 為 BoringSSL 等知名程式庫加上安全防護措施
以及 Java Cryptography Architecture 在介面中示範
讓稽核人員和工具能快速找出缺口。Tink 也會將 API
因此您可以加以監控
相容
Tink 密文與現有的密碼編譯程式庫相容。町克
也支援在 Python 中加密或儲存金鑰
Amazon KMS、Google Cloud KMS、Android KeyStore 和 iOS 鑰匙圈。
誰正在使用 Tink?
Tink 廣受許多公司使用,包括 Google、Square 和 Citadel。
以及數百個 Google Cloud 客戶和 Google Pay 合作夥伴Tink 也
支援 Jetpack Security 程式庫,可保護許多熱門 Android 應用程式
例如 Slack、Adidas、AirBnb 和 Nextdoor。
Tink 目標
與其他加密編譯程式庫相比,Tink 的主要目標為何?
Tink 使用哪些主要機制來達成這些目標?
簡單來說,Tink 有兩個目標:
- 提升密碼編譯靈活性:使用者應能變更金鑰,
簡化演算法
- 啟用安全性審查:Tink 的用途是讓使用者撰寫
安全性可在本機審查,方法是提供能清楚說明
安全保證
Tink 用來達成這些目標的主要機制如下:
- Tink 提供基本和介面做為重要的抽象層。這些
抽象化機制可讓使用者編寫未指定確切程式碼
,而是指定預期的安全概念。
- Tink 採用「金鑰組」的概念,也就是
與特定基元相關聯這會導致使用者編寫程式碼
這項功能適用於多個鍵
- 在 Tink 中,鍵不僅是基礎金鑰內容指定,
加密編譯演算法和所有參數也就是說
Tink 金鑰一律會從所有可能類型中選取不重複的加密函式
函式可以存在,且沒有空間可解讀。
下列各節將詳細說明這些概念。
加密編譯的靈活性
考慮 Google 軟體工程團隊。
我們探討了在軟體工程領域學到的教訓
副標題:「隨著時間的推移而學習到的課程」。在這個例子中,作者會前往
大量時間去暗示改變世界的意味。這個
也影響了大部分的 Tink 設計。以密碼編譯技術來說
做好萬全準備金鑰會外洩,演算法也會損毀。
對許多使用者而言,更換金鑰和演算法至關重要。
非常謹慎
安全性審查和本地資產
Tink 推廣介面的使用,例如 AEAD 介面
讓使用者加密資料。還包括其他安全保證、AEAD
可保證相同字串的多種加密會產生不同的
密文。
為了瞭解該怎麼運用,假設工程師想要儲存一些
加入使用者 Cookie 中的 ID他們可能會提供以下類別:
class IdEncrypter {
public static IdEncrypter createFromAead(Aead aead);
public String encrypt(long id) throws GeneralSecurityException;
public long decrypt(String encrypted) throws GeneralSecurityException;
};
傳遞 Aead
可取得下列屬性:
- 程式碼表示,
IdEncrypter
可以執行工作,這需要
具有 Aead
提供的安全性屬性加密配置。
此外,
DeterministicAead
敬上
則不足以因應此情況,因為 IdEncrypter
規定
不同的 ID另一方面,將 當做參數
AES GCM 加密工具 (Aead
的特定例項) 會過度
嚴格:任何 Aead 都足以讓 IdEncrypter
完成工作,但沒有得到
則只需要使用一個特定演算法即可
- 安全性審查可以考慮這點。安全性審查人員
不必執行整個程式碼存放區
某個人建立的
Aead
子類別並不安全,
IdEncrypter
。Tink 會提供安全性屬性
Aead 物件具有 且審查者可以確認這些物件是否足夠。
特別是第二點需要格外小心。使用者通常會要求新增
「並未完全」Aead
。上一個要點說明
這不安全:如果有 Aead
的任何實作可用的,而
未提供必要的安全保證,IdEncrypter
可能會不安全,
執行安全性審查的工程師需要檢查額外的程式碼
檢查物件是否已正確例項化
除非另有註明,否則本頁面中的內容是採用創用 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 is an open-source cryptography library designed for easy and secure implementation of common cryptographic tasks, even for users without a cryptography background.\u003c/p\u003e\n"],["\u003cp\u003eTink prioritizes security by adding protections on top of existing libraries like BoringSSL, using distinct APIs for potentially risky operations, and ensuring ciphertext compatibility with other libraries.\u003c/p\u003e\n"],["\u003cp\u003eTink promotes cryptographic agility by enabling easy key and algorithm changes, and it supports integration with external key management systems like Amazon KMS and Google Cloud KMS.\u003c/p\u003e\n"],["\u003cp\u003eDesigned with security reviews in mind, Tink utilizes interfaces with clear security guarantees and the concept of keysets for enhanced security and code clarity.\u003c/p\u003e\n"],["\u003cp\u003eGoogle, Square, and Citadel are among the many companies that utilize Tink, further demonstrating its reliability and widespread adoption within various applications and systems.\u003c/p\u003e\n"]]],["Tink, a Google-developed open-source cryptography library, simplifies secure cryptographic implementation for users, even without cryptography expertise. It's designed for simplicity, security, and compatibility, supporting key rotation and external Key Management Systems (KMS). Tink prioritizes cryptographic agility, enabling easy key and algorithm changes, and facilitates security reviews by providing clear interfaces and security guarantees. It uses primitives, keysets, and comprehensive key specifications to achieve these goals, ensuring secure, verifiable, and adaptable cryptographic operations.\n"],null,[]]