ما هو Tink؟
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
Tink هي مكتبة تشفير مفتوحة المصدر كتبها المشفرة
ومهندسي الأمان في Google. تقلل واجهات برمجة التطبيقات الآمنة والبسيطة من Tink من
والصعوبات من خلال التصميم الذي يركز على المستخدم والتنفيذ الدقيق ومراجعات التعليمات البرمجية
وإجراء اختبارات شاملة. اطّلع على قسم الأهداف في هذه الصفحة لمعرفة
على مزيد من الرؤية حول الأهداف التي صممت Tink لتحقيقها.
يساعد Tink المستخدمين الذين ليس لديهم خلفية تشفير في تنفيذ العمليات
مهام التشفير. وفي Google، تم نشر Tink في مئات المنتجات
والأنظمة المختلفة.
لماذا يجب أن أستخدم Tink؟
أهم الأسباب لاستخدام Tink هي:
سهل الاستخدام
من الصعب الحصول على التشفير بشكل صحيح. باستخدام Tink، يمكنك
تشفير أو توقيع البيانات باستخدام
ضمانات أمان مدمَجة باستخدام بضعة أسطر من الرموز يمكن أن تقوم Tink أيضًا
مساعدتك في تدوير المفاتيح أو تأمين المفاتيح باستخدام "أنظمة إدارة مفاتيح" خارجية
(KMS).
الأمان
يضيف Tink وسائل حماية أمنية بالإضافة إلى المكتبات المعروفة مثل BuringSSL
وبنية تشفير Java وتعرضها مباشرةً في الواجهات
بحيث يمكن للمدققين والأدوات العثور على الثغرات بسرعة. يفصل Tink أيضًا واجهات برمجة التطبيقات التي
من المحتمل أن تكون خطيرة، لذا يمكنك مراقبتها.
متوافق
تتوافق نصوص التشفير Tink مع مكتبات التشفير الحالية. تينك
أيضًا تشفير المفاتيح أو تخزينها في
Amazon KMS وGoogle Cloud KMS وAndroid Keystore وiOS Keychain.
من يستخدم 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 دائمًا دالة تشفير فريدة من جميع
والدوال التي يمكن أن توجد، ولا تترك مجالاً للتفسير.
وتوضّح الأقسام التالية هذه المفاهيم بمزيد من التفصيل.
رشاقة التشفير
جرِّب هندسة البرمجيات في 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، ويمكن للمراجع التأكّد من أنّ هذه العناصر كافية.
وعلى وجه الخصوص، تتطلب النقطة الثانية قدرًا كبيرًا من العناية. يطلب المستخدمون غالبًا إضافة
وهي خوارزميات "ليست تمامًا" Aead
توضح النقطة السابقة سبب
هذا أمر خطير: إذا كان هناك أي تنفيذ لـ Aead
يؤدي إلى
عدم تقديم ضمانات الأمان المطلوبة، قد يصبح IdEncrypter
غير آمن،
ويحتاج المهندس الذي يجري مراجعة أمنية إلى فحص تعليمات برمجية إضافية
للتحقق من إنشاء مثيل للكائن بشكل صحيح.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة 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."]]