メッセージ認証コード(MAC)
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
MAC プリミティブを使用すると、データが改ざんされていないことを確認できます。送信者が受信者と対称鍵を共有すると、特定のメッセージの認証タグを計算できます。これにより、受信者はメッセージが想定される送信者から送られ、変更されていないことを確認できます。
MAC には次のプロパティがあります。
- 真正性: 検証可能な MAC タグを作成するには、鍵を知っている必要があります。
- Symmetric: タグの計算と検証には同じ鍵が必要です。
MAC は、アルゴリズムによって確定的またはランダム化できます。Tink では現在、非決定的 MAC アルゴリズムを実装していません。MAC は、疑似乱数バイトの生成などの他の目的ではなく、メッセージ認証にのみ使用する必要があります(詳しくは、PRF をご覧ください)。
代わりに非対称プリミティブが必要な場合は、デジタル署名をご覧ください。
キータイプを選択する
ほとんどの用途では HMAC_SHA256 を使用することをおすすめしますが、他のオプションもあります。
一般に、次のことが言えます。
最小限のセキュリティ保証
- 80 ビット以上の認証強度
- 選択平文攻撃による実在の偽造に対する保護
- 鍵復元攻撃に対する 128 ビット以上のセキュリティ、およびマルチユーザー シナリオ(攻撃者が特定の鍵ではなく、最大 232 個の鍵のセットの任意の鍵をターゲットとしている場合)
使用例
データを改ざんから保護したいをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[[["わかりやすい","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\u003eThe Message Authentication Code (MAC) primitive, using a shared symmetric key, enables verification of data integrity and authenticity by generating an authentication tag.\u003c/p\u003e\n"],["\u003cp\u003eMAC ensures authenticity as only the key holder can create a verifiable tag, and it's symmetric, requiring the same key for both computation and verification.\u003c/p\u003e\n"],["\u003cp\u003eTink recommends HMAC_SHA256 for most use cases, while HMAC_SHA512 offers higher security and AES256_CMAC might provide better performance with specific hardware.\u003c/p\u003e\n"],["\u003cp\u003eTink's MAC implementation guarantees a minimum of 80-bit authentication strength, protection against forgery, and at least 128-bit security against key recovery attacks, even in multi-user environments.\u003c/p\u003e\n"]]],["MAC uses a shared symmetric key between sender and recipient to verify message authenticity and integrity. The sender computes an authentication tag for a message, which the recipient uses to confirm its origin and unaltered state. MAC guarantees authenticity, where only key holders can create verifiable tags. Key recommendations include HMAC_SHA256, HMAC_SHA512 (most conservative), and AES256_CMAC (fastest with AES-NI). MAC is designed solely for message authentication, offering a minimum of 80-bit authentication strength.\n"],null,[]]