با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
رمزگذاری تأیید شده با داده های مرتبط (AEAD) رایج ترین رمزگذاری اولیه برای رمزگذاری داده ها است و برای اکثر نیازها مناسب است.
AEAD دارای ویژگی های زیر است:
رازداری : هیچ چیز در مورد متن ساده مشخص نیست، به جز طول آن.
اصالت : تغییر متن رمزگذاری شده زیر متن رمزی بدون شناسایی غیرممکن است.
متقارن : رمزگذاری متن ساده و رمزگشایی متن رمزی با همان کلید انجام می شود.
تصادفی سازی : رمزگذاری تصادفی است. دو پیام با متن ساده یکسان، متن های رمزی متفاوتی را ارائه می دهند. مهاجمان نمی توانند بدانند که کدام متن رمزی با یک متن ساده مشخص مطابقت دارد. اگر می خواهید از این امر جلوگیری کنید، به جای آن از Deterministic AEAD استفاده کنید.
داده های مرتبط
از AEAD می توان برای گره زدن متن رمز به داده های مرتبط خاص استفاده کرد. فرض کنید یک پایگاه داده با فیلدهای 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 می کند، اما در عمل کمتر مورد استفاده قرار می گیرد. برای استفاده از آن در جاوا، باید Conscrypt را نصب کنید.
XChaCha20Poly1305 نسبت به AES128_GCM محدودیت بسیار بیشتری در تعداد پیامها و اندازه پیام دارد، اما زمانی که شکست میخورد (بعید است) مطالب کلیدی را نیز به بیرون درز میکند. شتاب سختافزاری ندارد، بنابراین در شرایطی که شتاب سختافزاری در دسترس است، میتواند کندتر از حالتهای AES باشد.
تضمین های امنیتی
پیاده سازی AEAD ارائه می دهد:
امنیت CCA2
حداقل قدرت احراز هویت 80 بیتی.
امکان رمزگذاری حداقل 232 پیام با مجموع 250 بایت. هیچ حمله ای با حداکثر 2 32 متن ساده یا متن رمزی انتخاب شده احتمال موفقیت بزرگتر از 2 -32 ندارد.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 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,["# Authenticated Encryption with Associated Data (AEAD)\n\nThe 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\n### Associated data\n\n| **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\n### Choose 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\n### Security 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\n### Example use cases\n\nSee I want to [encrypt data](/tink/encrypt-data) and I want to [bind ciphertext to\nits context](/tink/bind-ciphertext)."]]