تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
التشفير المُعتمَد بالبيانات المرتبطة (AEAD) هو الإجراء الأساسي الأكثر رواجًا لتشفير البيانات وهو مناسب لمعظم الاحتياجات.
تتسم ميزة "التشفير من جهة العميل" بالخصائص التالية:
Secrecy: لا يمكن معرفة أي معلومات عن النص العادي، باستثناء طوله.
الأصالة: من المستحيل تغيير النص العادي المشفَّر
الذي يشكّل النص المشفَّر بدون أن يتم رصد ذلك.
التشفير المتماثل: يتم تشفير النص العادي وفك تشفيره باستخدام المفتاح نفسه.
التوزيع العشوائي: يتم توزيع التشفير بشكل عشوائي. تؤدي رسالتان تتضمّنان النص العادي نفسه إلى نصّين مشفَّرين مختلفَين. لا يمكن للمهاجمين معرفة ملف التشفير الذي يتوافق مع نص عادي معيّن. إذا أردت تجنُّب ذلك، استخدِم
التشفير المحدد مسبقًا للتشفير وفك التشفير والتوقيع بدلاً من ذلك.
البيانات المرتبطة
يمكن استخدام التشفير التام الامتثال للخصوصية لربط النص المشفَّر ببيانات مرتبطة محدّدة. لنفترض أنّ لديك قاعدة بيانات تحتوي على الحقلين user-id
وencrypted-medical-history. في هذا السيناريو، يمكن استخدام user-id كข้อมูล مرتبطة عند تشفير encrypted-medical-history. ويمنع ذلك
المهاجم من نقل السجلّ الطبي من مستخدم إلى آخر.
اختيار نوع المفتاح
على الرغم من أنّنا ننصح باستخدام AES128_GCM لمعظم الاستخدامات، هناك أنواع مختلفة من المفاتيح لمختلف الاحتياجات (للحصول على أمان بسعة 256 بت، استبدِل AES128 بـ AES256 أدناه).
بشكل عام:
إنّ AES128_CTR_HMAC_SHA256 مع 16 بايت من "متجه الإعداد" (IV) هو الوضع الأكثر
تحفظًا مع حدود جيدة.
إنّ AES128_EAX أقل أمانًا قليلاً وأسرع قليلاً من
AES128_CTR_HMAC_SHA256.
يكون تنسيق AES128_GCM عادةً هو الأسرع، مع وضع حدود صارمة على
عدد الرسائل وحجمها. عند تجاوز هذه الحدود المفروضة على طول النص العادي وطول البيانات المرتبطة به (أدناه)، يتعذّر تنفيذ AES128_GCM ويتسرّب محتوى المفتاح.
إنّ AES128_GCM_SIV سريع تقريبًا مثل AES128_GCM. تفرض هذه الطريقة الحدود نفسها التي يفرضها أسلوب
AES128_GCM في ما يتعلق بعدد الرسائل وحجمها، ولكن عند تجاوز هذه الحدود
، لا يؤدي ذلك إلى حدوث خطأ كبير، بل قد يؤدي فقط إلى الكشف عن حقيقة
تطابق رسالتَين. وهذا يجعله أكثر أمانًا من AES128_GCM، ولكن
يتم استخدامه على نطاق أقل في الممارسة العملية.
لاستخدام هذا الإجراء في Java، عليك تثبيت Conscrypt.
يفرض XChaCha20Poly1305 حدًا أقصى أكبر بكثير لعدد الرسائل و
حجم الرسالة مقارنةً بـ AES128_GCM، ولكن عند حدوث خطأ (من غير المرجّح حدوثه)، يؤدي ذلك أيضًا إلى
تسرُّب مادة المفتاح. ولا يتم تسريعه باستخدام الأجهزة، لذا يمكن أن يكون أبطأ من
وضعات AES في الحالات التي تتوفّر فيها ميزة تسريع الأجهزة.
ضمانات الأمان
تقدّم عمليات تنفيذ AEAD ما يلي:
أمان CCA2
قوة مصادقة تبلغ 80 بت على الأقل
إمكانية تشفير 32 رسالة على الأقل بإجمالي
250 بايت لا يمكن لأي هجوم باستخدام ما يصل إلى 232 نصًا عاديًا
أو نصًا مشفَّرًا مختارًا أن يكون احتمال نجاحه أكبر من 2-32.
تاريخ التعديل الأخير: 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\u003eAuthenticated Encryption with Associated Data (AEAD) is the recommended primitive for most data encryption needs, providing secrecy, authenticity, and randomization.\u003c/p\u003e\n"],["\u003cp\u003eAEAD utilizes the same key for encryption and decryption, and randomizes the encryption process for enhanced security, although deterministic options are available.\u003c/p\u003e\n"],["\u003cp\u003eWhile AES128_GCM is generally the fastest and recommended key type, other options like AES128_CTR_HMAC_SHA256, AES128_EAX, AES128_GCM_SIV, and XChaCha20Poly1305 cater to specific security and performance requirements.\u003c/p\u003e\n"],["\u003cp\u003eAssociated data used in AEAD is authenticated but not encrypted, meaning it can be verified but is still visible.\u003c/p\u003e\n"],["\u003cp\u003eAEAD implementations provide strong security guarantees, including CCA2 security and at least 80-bit authentication strength, but do not guarantee the secrecy of associated data.\u003c/p\u003e\n"]]],["AEAD, a common data encryption primitive, ensures secrecy, authenticity, and uses symmetric keys with randomized encryption. Associated data is authenticated but not encrypted and can link ciphertext to specific contexts, like user IDs. Various key types are available, with AES128_GCM recommended for most cases, offering speed but with strict limits. AES128_GCM_SIV is a safer, albeit less common, alternative. AEAD guarantees CCA2 security and 80-bit authentication strength, encrypting up to 2^32 messages with 2^50 total bytes.\n"],null,["The Authenticated Encryption with Associated Data (AEAD) primitive is the most\ncommon primitive for data encryption and is suitable for most needs.\n\nAEAD has the following properties:\n\n- **Secrecy**: Nothing about the plaintext is known, except its length.\n- **Authenticity**: It is impossible to change the encrypted plaintext underlying the ciphertext without being detected.\n- **Symmetric**: Encrypting the plaintext and decrypting the ciphertext is done with the same key.\n- **Randomization** : Encryption is randomized. Two messages with the same plaintext yield different ciphertexts. Attackers cannot know which ciphertext corresponds to a given plaintext. If you want to avoid this, use [Deterministic AEAD](/tink/deterministic-aead) instead.\n\nAssociated data **Caution:** Associated data is authenticated but *NOT* encrypted.\n\nAEAD can be used to [tie ciphertext to specific associated\ndata](/tink/bind-ciphertext). Suppose you have a database with the fields `user-id`\nand `encrypted-medical-history`. In this scenario, `user-id` can be used as\nassociated data when encrypting `encrypted-medical-history`. This prevents an\nattacker from moving medical history from one user to another.\n\nChoose a key type\n\nWhile we recommend **AES128_GCM** for most uses, there are various key types for\ndifferent needs (for 256-bit security, replace AES128 with AES256 below).\nGenerally:\n\n- AES128_CTR_HMAC_SHA256 with a 16-byte Initialization Vector (IV) is the most conservative mode with good bounds.\n- AES128_EAX is slightly less conservative and slightly faster than AES128_CTR_HMAC_SHA256.\n- AES128_GCM is usually the fastest mode, with the strictest limits on the number of messages and message size. When these limits on plaintext and associated data lengths (below) are exceeded, AES128_GCM fails and leaks key material.\n- AES128_GCM_SIV is nearly as fast as AES128_GCM. It has the same limits as AES128_GCM on the number of messages and message size, but when these limits are exceeded, it fails in a less catastrophic way: it may only leak the fact that two messages are equal. This makes it safer to use than AES128_GCM, but it is less widely used in practice. To use this in Java, you have to install [Conscrypt](https://conscrypt.org).\n- XChaCha20Poly1305 has a much greater limit on the number of messages and message size than AES128_GCM, but when it does fail (very unlikely) it also leaks key material. It isn't hardware accelerated, so it can be slower than AES modes in situations where hardware acceleration is available.\n\n| **Note:** The plaintext and associated data may have any length within 0..2^32^ bytes.\n\nSecurity guarantees\n\nAEAD implementations offer:\n\n- CCA2 security.\n- At least 80-bit authentication strength.\n- The ability to encrypt at least 2^32^ messages with a total of 2^50^ bytes. No attack with up to 2^32^ chosen plaintexts or chosen ciphertexts has success probability larger than 2^-32^.\n\n| **Caution:** **AEAD offers no secrecy guarantees for associated data.**\n\nExample use cases\n\nSee I want to [encrypt data](/tink/encrypt-data) and I want to [bind ciphertext to\nits context](/tink/bind-ciphertext)."]]