연관 데이터로 암호화 인증 (AEAD) 기본은 데이터 암호화에 가장 일반적인 기본이며 대부분의 요구사항에 적합합니다.
AEAD에는 다음과 같은 속성이 있습니다.
Secrecy: 길이를 제외하고는 일반 텍스트에 관한 정보는 아무것도 알려지지 않습니다.
신뢰성: 감지되지 않고는 암호문의 기본이 되는 암호화된 일반 텍스트를 변경할 수 없습니다.
대칭: 일반 텍스트를 암호화하고 암호문을 복호화하는 데 동일한 키가 사용됩니다.
무작위 순서 지정: 암호화가 무작위로 지정됩니다. 평문이 동일한 두 메시지는 서로 다른 암호문을 생성합니다. 공격자는 어떤 암호문이 특정 일반 텍스트에 해당하는지 알 수 없습니다. 이를 방지하려면 대신 결정론적 AEAD를 사용하세요.
관련 데이터
AEAD는 암호문을 특정 연결된 데이터에 연결하는 데 사용할 수 있습니다. user-id 및 encrypted-medical-history 필드가 있는 데이터베이스가 있다고 가정해 보겠습니다. 이 시나리오에서는 encrypted-medical-history를 암호화할 때 user-id를 연결된 데이터로 사용할 수 있습니다. 이렇게 하면 공격자가 한 사용자의 의료 기록을 다른 사용자로 이동할 수 없습니다.
키 유형 선택
대부분의 용도에는 AES128_GCM을 사용하는 것이 좋지만, 다양한 요구사항에 맞는 다양한 키 유형이 있습니다 (256비트 보안의 경우 아래에서 AES128을 AES256으로 대체하세요).
일반적으로 다음과 같습니다.
16바이트 초기화 벡터 (IV)가 있는 AES128_CTR_HMAC_SHA256은 경계가 확실한 가장 보수적인 모드입니다.
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비트 이상이어야 합니다.
총 250바이트의 메시지 232개 이상을 암호화하는 기능 선택된 평문 또는 선택된 암호문이 최대 232개인 공격의 성공 확률은 2-32보다 큽니다.
[[["이해하기 쉬움","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(UTC)"],[[["\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)."]]