Tink คืออะไร
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
Tink เป็นไลบรารีการเข้ารหัสแบบโอเพนซอร์สซึ่งเขียนโดยนักเข้ารหัสลับและ
วิศวกรความปลอดภัยที่ Google API ที่ปลอดภัยและใช้งานง่ายของ Tink ช่วยลด
อันตรายด้วยการออกแบบ
ที่เน้นผู้ใช้เป็นหลัก การใช้งานอย่างรอบคอบ และการตรวจสอบโค้ด
และการทดสอบที่ครอบคลุม ดูส่วนเป้าหมายในหน้านี้สำหรับ
มีข้อมูลเชิงลึกเกี่ยวกับวัตถุประสงค์ที่ Tink ได้รับการออกแบบมาเพื่อบรรลุผล
Tink ช่วยให้ผู้ใช้ที่ไม่มีพื้นฐานด้านวิทยาการเข้ารหัสลับสามารถติดตั้งใช้งานได้อย่างปลอดภัย
งานการเข้ารหัสลับ ที่ Google มีการใช้ Tink ในผลิตภัณฑ์หลายร้อยรายการ
และระบบต่างๆ
ทำไมฉันจึงควรใช้ Tink
เหตุผลสำคัญที่สุดในการใช้ Tink มีดังนี้
ใช้งานง่าย
วิทยาการเข้ารหัสลับจะเข้าใจได้ยาก Tink ช่วยให้คุณ
เข้ารหัสหรือข้อมูลสัญญาณด้วย
รับประกันความปลอดภัยในตัวโดยใช้โค้ดเพียงไม่กี่บรรทัด Tink ยัง
ช่วยคุณหมุนเวียนคีย์หรือคีย์ความปลอดภัยโดยใช้ระบบการจัดการคีย์ภายนอก
(KMS)
ปลอดภัย
Tink เพิ่มการรักษาความปลอดภัยด้วยไลบรารีที่รู้จักกันดี เช่น BoringSSL
และ Java Cryptography Architecture และแสดงในอินเทอร์เฟซโดยตรง
เพื่อให้ผู้ตรวจสอบและเครื่องมือพบช่องโหว่ได้อย่างรวดเร็ว Tink ยังแยก API ที่
อาจเป็นอันตราย คุณจึงติดตามดูได้
ใช้ได้กับ
ข้อความเข้ารหัสของ Tink ใช้งานได้กับไลบรารีวิทยาการเข้ารหัสลับที่มีอยู่ หมึก
ยังรองรับการเข้ารหัสหรือจัดเก็บคีย์ไว้ใน
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 มีเป้าหมาย 2 ประการ ได้แก่
- เพิ่มความคล่องตัวในการเข้ารหัส: ผู้ใช้ควรเปลี่ยนคีย์ได้
อัลกอริทึมได้ง่ายๆ
- เปิดใช้การตรวจสอบความปลอดภัย: Tink มีจุดประสงค์เพื่อให้ผู้ใช้เขียนโค้ดได้
สามารถตรวจสอบความปลอดภัยได้จากภายใน ด้วยอินเทอร์เฟซ
ที่จะให้ข้อมูล
รับประกันความปลอดภัย
กลไกหลักที่ Tink ใช้เพื่อบรรลุเป้าหมายเหล่านี้มีดังต่อไปนี้
- Tink ให้ปัจจัยพื้นฐานและอินเทอร์เฟซเป็นนามธรรมที่สำคัญ เหล่านี้
แอบสแตรกชันช่วยให้ผู้ใช้เขียนโค้ดได้ซึ่งไม่ได้ระบุ
แต่จะระบุแนวคิดด้านความปลอดภัยที่คาดหวังแทน
- Tink ใช้แนวความคิดของ "ชุดคีย์" ซึ่งเป็นชุดคีย์ที่
ที่เกี่ยวข้องกับพื้นฐานที่เฉพาะเจาะจง ซึ่งส่งผลให้ผู้ใช้เขียนโค้ด
ซึ่งใช้ได้กับหลายคีย์
- ใน Tink ไม่ได้มีเพียงเนื้อหาคีย์ที่ระบุเท่านั้น แต่ยังระบุคีย์ด้วย
อัลกอริทึมการเข้ารหัส และพารามิเตอร์ทั้งหมด ซึ่งหมายความว่า
คีย์ Tink จะเลือกฟังก์ชันการเข้ารหัสที่ไม่ซ้ำกันจากทั้งหมดที่เป็นไปได้เสมอ
ฟังก์ชันต่างๆ ที่มี และไม่มีพื้นที่ให้ตีความ
ส่วนต่อไปนี้จะอธิบายแนวคิดเหล่านี้โดยละเอียดยิ่งขึ้น
ความคล่องตัวในการเข้ารหัส
โปรดอ่านหัวข้อวิศวกรรมซอฟต์แวร์ที่ Google
หนังสือเกี่ยวกับบทเรียนในสาขาวิศวกรรมซอฟต์แวร์ ซึ่ง
คำบรรยาย "บทเรียนที่ได้เรียนรู้จากการเขียนโปรแกรมเมื่อเวลาผ่านไป" ในเอกสารนี้ ผู้เขียนได้ไปที่
เพื่อบอกเป็นนัยว่าสิ่งต่างๆ เปลี่ยนแปลงไป ช่วงเวลานี้
เรื่องนี้ส่งผลต่อการออกแบบ Tink ส่วนใหญ่ด้วย วิทยาการเข้ารหัสลับ
เพื่อเตรียมรับการเปลี่ยนแปลง คีย์จะรั่วไหลและอัลกอริทึมจะเสียหาย
การสามารถสลับคีย์และอัลกอริทึมออกได้เป็นสิ่งสำคัญสำหรับผู้ใช้จำนวนมาก และ
นั่นคือความรอบคอบ
การตรวจสอบความปลอดภัยและพร็อพเพอร์ตี้ในพื้นที่
Tink ส่งเสริมการใช้อินเทอร์เฟซ เช่น อินเทอร์เฟซ AEAD ซึ่งช่วยให้
ให้ผู้ใช้เข้ารหัสข้อมูลได้ ส่วนหนึ่งของการรับประกันความปลอดภัยอื่นๆ นั้น AEAD
รับประกันได้ว่าการเข้ารหัสหลายครั้ง สตริงเดียวกันจะให้ผลลัพธ์
ข้อความเข้ารหัส
หากต้องการดูลักษณะการใช้งาน สมมติว่าวิศวกรต้องการจัดเก็บข้อมูลที่ละเอียดอ่อน
รหัสในคุกกี้ของผู้ใช้ โดยอาจจัดชั้นเรียนในลักษณะต่อไปนี้
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
กำหนดให้มีการเข้ารหัสสองแบบของ
รหัสเดียวกันนั้นต่างกัน ในทางกลับกัน การใช้ เป็นพารามิเตอร์ เป็นตัวอย่าง
การเข้ารหัส AES GCM (Aead
อินสแตนซ์หนึ่ง) จะทำงานมากเกินไป
เข้มงวด: Aead ก็เพียงพอที่ IdEncrypter
จะทำงานแล้ว
ต้องเป็นอัลกอริทึมที่เฉพาะเจาะจงรายการหนึ่ง
- การตรวจสอบความปลอดภัยสามารถพิจารณาประเด็นนี้ได้ ผู้ตรวจสอบความปลอดภัยจะ
ไม่จำเป็นต้องดูที่เก็บโค้ดทั้งหมดเพื่อตรวจสอบว่า
มีคนสร้างคลาสย่อยเป็น
Aead
ซึ่งไม่ปลอดภัยสำหรับการใช้งาน
ด้วย IdEncrypter
แต่ Tink จะให้คุณสมบัติด้านความปลอดภัยที่
ออบเจ็กต์ Aead และผู้ตรวจสอบสามารถตรวจสอบว่าสิ่งเหล่านี้เพียงพอแล้ว
ประเด็นที่ 2 ต้องมีการดูแลอย่างมาก ผู้ใช้มักขอเพิ่ม
อัลกอริทึมที่ "ยังไม่ใช่" Aead
ประเด็นก่อนหน้านี้แสดงให้เห็นว่า
เป็นอันตราย: หากมีการปรับใช้ Aead
ซึ่ง
ไม่ให้การรับประกันความปลอดภัยที่จำเป็น IdEncrypter
อาจไม่ปลอดภัย
และวิศวกรที่ดำเนินการตรวจสอบความปลอดภัยต้องตรวจสอบโค้ดเพิ่มเติม
เพื่อตรวจสอบว่าสร้างอินสแตนซ์อ็อบเจกต์อย่างถูกต้อง
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\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,["# What is Tink?\n\nTink is an open-source cryptography library written by cryptographers and\nsecurity engineers at Google. Tink's secure and simple APIs reduce common\npitfalls through user-centered design, careful implementation and code reviews,\nand extensive testing. See the [Goals](#tink_goals) section on this page for\nmore insight into which objectives Tink was designed to fulfil.\n\nTink helps users without a cryptography background safely implement common\ncryptographic tasks. At Google, Tink has been deployed in hundreds of products\nand systems.\n\nWhy should I use Tink?\n----------------------\n\nThe most important reasons to use Tink are:\n\n- **It's simple to use**\n\n Cryptography is difficult to get right. With Tink, you can\n [encrypt](/tink/encrypt-data) or [sign data](/tink/digitally-sign-data) with\n built-in security guarantees using just a few lines of code. Tink can also\n help you rotate keys or secure keys using external Key Management Systems\n (KMSs).\n- **It's secure**\n\n Tink adds security protections on top of well known libraries like BoringSSL\n and Java Cryptography Architecture and shows them right in the interfaces,\n so auditors and tools can quickly find gaps. Tink also separates APIs that\n are potentially dangerous, so you can monitor them.\n- **It's compatible**\n\n Tink ciphertexts are compatible with existing cryptography libraries. Tink\n also supports [encrypting or storing keys](/tink/client-side-encryption) in\n Amazon KMS, Google Cloud KMS, Android Keystore, and iOS Keychain.\n\nWho's using Tink?\n-----------------\n\nTink is widely used by many companies, including Google, Square, and Citadel, as\nwell as hundreds of Google Cloud customers and Google Pay partners. Tink also\npowers the Jetpack Security library, which secures many popular Android apps\nlike Slack, Adidas, AirBnb, and Nextdoor.\n\nTink Goals\n----------\n\nWhat are the main goals of Tink compared to other cryptographic libraries, and\nwhat are the main mechanisms which Tink uses to achieve these goals?\n\nIn short, Tink has two goals:\n\n1. *Promote cryptographic agility*: Users should be able to change keys and algorithms in a simple way.\n2. *Enable security reviews*: Tink aims to allow users to write code whose security can be reviewed locally, by providing interfaces which give clear security guarantees.\n\nThe main mechanisms Tink uses to achieve these goals are as follows:\n\n1. Tink provides primitives and interfaces as important abstractions. These abstractions allow users to write code which does not specify the exact algorithm to be used, but instead specifies the expected security notion.\n2. Tink uses the notion of a \"keyset\", which is a set of keys that are associated with a particular primitive. This results in users writing code which works with multiple keys.\n3. In Tink, keys are not only specified by the underlying key material, but also the cryptographic algorithm, as well as all parameters. This means that a Tink key always selects a unique cryptographic function from all possible functions which can exist, and leaves no room for interpretation.\n\nThe following sections explain these concepts in more detail.\n\n### Cryptographic agility\n\nConsider [Software Engineering at Google](https://abseil.io/resources/swe-book),\na book about lessons learned in the field of software engineering, with the\nsubtitle \"lessons learned from programming over time\". In it, the authors go to\ngreat lengths to implore the implications of the fact that things change. This\nfact also impacted much of the design of Tink. In cryptography, it is important\nthat one prepares for change. Keys will leak, and algorithms will be broken.\nBeing able to switch out keys and algorithms is crucial for many users, and\nbeing prepared is prudent.\n\n### Security reviews and local properties\n\nTink promotes the use of interfaces, such as our AEAD interface, which allows\nusers to encrypt data. Among [other security guarantees](https://developers.google.com/tink/aead#security_guarantees), an AEAD\nguarantees that multiple encryptions of the same string result in different\nciphertexts.\n\nTo see how this can be used, suppose an engineer wants to store some sensitive\nID in a user cookie. They might provide a class such as this: \n\n class IdEncrypter {\n public static IdEncrypter createFromAead(Aead aead);\n\n public String encrypt(long id) throws GeneralSecurityException;\n public long decrypt(String encrypted) throws GeneralSecurityException;\n };\n\nPassing an `Aead` obtains the following properties:\n\n1. The code communicates that for `IdEncrypter` to do its job, it requires an encryption scheme with the security properties an [`Aead` provides](https://developers.google.com/tink/aead#security_guarantees). Alternatively, a [`DeterministicAead`](https://developers.google.com/tink/deterministic-aead) wouldn't be enough -- the `IdEncrypter` requires that two encryptions of the same id are different. On the other hand, taking as parameter an instance of an AES GCM encrypter (one particular instance of an `Aead`) would be overly strict: any Aead is enough for `IdEncrypter` to do its job, and it does not need to be one specific algorithm.\n2. A security review can take this point into account. A security reviewer does not need to go through all of the entire code repository to check if somewhere, someone made a subclass of `Aead` which is not secure for use with `IdEncrypter`. Instead, Tink provides security properties which all Aead objects have, and the reviewer can check that these are sufficient.\n\nIn particular the second point requires a lot of care. Users often ask to add\nalgorithms which are 'not quite' an `Aead`. The previous point illustrates why\nthis is dangerous: if there is any implementation of `Aead` available which does\nnot provide the required security guarantees, `IdEncrypter` can become insecure,\nand the engineer performing a security review needs to examine additional code\nto check that the object is instantiated correctly."]]