تینک چیست؟
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
Tink یک کتابخانه رمزنگاری منبع باز است که توسط رمزنگاران و مهندسین امنیت در گوگل نوشته شده است. APIهای امن و ساده Tink از طریق طراحی کاربر محور، پیاده سازی دقیق و بررسی کد و آزمایش گسترده، مشکلات رایج را کاهش می دهند. برای اطلاعات بیشتر در مورد اهدافی که Tink برای تحقق بخشیدن به آنها طراحی شده است، به بخش اهداف در این صفحه مراجعه کنید.
Tink به کاربران بدون پیشزمینه رمزنگاری کمک میکند تا با خیال راحت وظایف رایج رمزنگاری را اجرا کنند. در گوگل، Tink در صدها محصول و سیستم مستقر شده است.
چرا باید از Tink استفاده کنم؟
مهمترین دلایل استفاده از Tink عبارتند از:
استفاده از آن ساده است
درست کردن رمزنگاری دشوار است. با Tink، میتوانید دادهها را با ضمانتهای امنیتی داخلی تنها با استفاده از چند خط کد رمزگذاری یا امضا کنید. Tink همچنین میتواند به شما در چرخاندن کلیدها یا کلیدهای ایمن با استفاده از سیستمهای مدیریت کلید خارجی (KMS) کمک کند.
امن است
Tink حفاظت های امنیتی را در بالای کتابخانه های معروف مانند BoringSSL و Java Cryptography Architecture اضافه می کند و آنها را مستقیماً در رابط ها نشان می دهد، بنابراین حسابرسان و ابزارها می توانند به سرعت شکاف ها را پیدا کنند. Tink همچنین API هایی را که به طور بالقوه خطرناک هستند جدا می کند، بنابراین می توانید آنها را نظارت کنید.
سازگار است
متنهای رمزی Tink با کتابخانههای رمزنگاری موجود سازگار هستند. Tink همچنین از رمزگذاری یا ذخیره کلیدها در Amazon KMS، Google Cloud KMS، Android Keystore و Keychain iOS پشتیبانی میکند.
چه کسی از Tink استفاده می کند؟
Tink به طور گسترده توسط بسیاری از شرکت ها از جمله Google، Square و Citadel و همچنین صدها مشتری Google Cloud و شرکای Google Pay استفاده می شود. Tink همچنین به کتابخانه Jetpack Security قدرت میدهد که بسیاری از برنامههای محبوب اندروید مانند Slack، Adidas، AirBnb و Nextdoor را ایمن میکند.
اهداف تینک
اهداف اصلی تینک در مقایسه با سایر کتابخانه های رمزنگاری چیست و مکانیسم های اصلی تینک برای رسیدن به این اهداف چیست؟
به طور خلاصه، تینک دو هدف دارد:
- ارتقای چابکی رمزنگاری : کاربران باید بتوانند کلیدها و الگوریتم ها را به روشی ساده تغییر دهند.
- فعال کردن بررسیهای امنیتی : هدف Tink این است که با ارائه رابطهایی که تضمینهای امنیتی واضحی را ارائه میدهند، به کاربران اجازه میدهد تا کدی بنویسند که امنیت آن به صورت محلی قابل بررسی باشد.
مکانیسم های اصلی که تینک برای دستیابی به این اهداف استفاده می کند به شرح زیر است:
- Tink ابتدا و رابط ها را به عنوان انتزاعات مهم ارائه می دهد. این انتزاعات به کاربران اجازه میدهد کدی بنویسند که الگوریتم دقیق مورد استفاده را مشخص نمیکند، اما در عوض مفهوم امنیتی مورد انتظار را مشخص میکند.
- تینک از مفهوم "کلید مجموعه" استفاده می کند، که مجموعه ای از کلیدها است که با یک ابتدایی خاص مرتبط هستند. این باعث می شود کاربران کدی بنویسند که با چندین کلید کار می کند.
- در Tink، کلیدها نه تنها توسط مواد کلید زیرین مشخص می شوند، بلکه الگوریتم رمزنگاری و همچنین تمام پارامترها نیز مشخص می شوند. این بدان معنی است که یک کلید Tink همیشه یک تابع رمزنگاری منحصر به فرد را از بین تمام توابع ممکن که می تواند وجود داشته باشد انتخاب می کند و جایی برای تفسیر باقی نمی گذارد.
بخش های بعدی این مفاهیم را با جزئیات بیشتری توضیح می دهند.
چابکی رمزنگاری
کتاب مهندسی نرم افزار در گوگل را در نظر بگیرید، کتابی درباره درس های آموخته شده در زمینه مهندسی نرم افزار، با عنوان فرعی «درس های آموخته شده از برنامه نویسی در طول زمان». در آن، نویسندگان تمام تلاش خود را می کنند تا پیامدهای این واقعیت را که همه چیز تغییر می کند، التماس کنند. این واقعیت همچنین بر طراحی 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 دارند، و بازبین میتواند کافی بودن این موارد را بررسی کند.
به ویژه نکته دوم نیاز به دقت زیادی دارد. کاربران اغلب درخواست میکنند الگوریتمهایی را اضافه کنند که «کاملاً» Aead
نیستند. نکته قبلی نشان میدهد که چرا این خطرناک است: اگر اجرای Aead
در دسترس باشد که تضمینهای امنیتی مورد نیاز را ارائه نمیکند، IdEncrypter
میتواند ناامن شود و مهندس که بازبینی امنیتی را انجام میدهد باید کد اضافی را بررسی کند تا بررسی کند که آیا شیء نمونهسازی شده است یا خیر. به درستی
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 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,["# 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."]]