デジタル署名
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
デジタル署名プリミティブを使用すると、データが改ざんされていないことを確認できます。署名されたデータの真正性と完全性は保証されますが、秘匿性は保証されません。デジタル署名は非対称であり、鍵ペア(公開鍵と秘密鍵)を使用します。
デジタル署名プリミティブには次のプロパティがあります。
- 真正性: 秘密鍵がない場合、
PublicKeyVerify.Verify(signature, message)
によって検証される署名は作成できません。
- 非対称: 署名を作成するときと、署名を確認するときでは、異なる鍵が使用されます。したがって、公開鍵を配布することができ、署名を自分で作成できないパーティーに向けた署名をそのパーティーが検証できます。
非対称性が不要な場合は、代わりにシンプルで効率的な MAC プリミティブを使用することを検討してください。
デジタル署名の機能は、Tink で次の 2 つのプリミティブのペアとして表されます。
- データの署名に PublicKeySign
- 署名の検証に使用する PublicKeyVerify
キーの種類を選択する
ほとんどのユースケースでは ECDSA_P256 を使用することをおすすめしますが、さまざまなオプションがあります。一般に、次のことが言えます。
- ECDSA_P256 は最も広く使用されているオプションであり、デフォルトとして適切です。ただし、ECDSA 署名は変更可能です。
- ED25519 は確定的な署名を作成し、ECDSA_P256 よりも優れたパフォーマンスを提供します。
- RSA_SSA_PKCS1_3072_SHA256_F4 は決定論的署名を作成し、検証のパフォーマンスが最も優れています(ただし、署名は ECDSA_P256 や ED25519 よりもはるかに遅くなります)。
最小限のセキュリティ保証
- 署名するデータの長さは任意です
- 楕円曲線ベースのスキーマに対する適応型選択メッセージ攻撃に対する 128 ビットのセキュリティ レベル
- RSA ベースのスキームの適応型選択メッセージ攻撃に対する 112 ビットのセキュリティ レベル(2,048 ビットの鍵を許可)
鍛性
攻撃者がすでに署名されたメッセージに対して別の有効な署名を作成できる場合、署名スキームは変更可能です。ほとんどのシナリオでは問題ありませんが、有効な署名が一意であるとプログラマが暗黙的に想定している場合、予期しない結果につながる可能性があります。
使用例
データにデジタル署名するをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[null,null,["最終更新日 2025-07-25 UTC。"],[[["\u003cp\u003eDigital signatures ensure data integrity and authenticity by verifying that data hasn't been tampered with.\u003c/p\u003e\n"],["\u003cp\u003eThey use a pair of keys (public and private) for asymmetric signing and verification, allowing for secure distribution of the public key.\u003c/p\u003e\n"],["\u003cp\u003eTink provides two primitives for digital signatures: \u003ccode\u003ePublicKeySign\u003c/code\u003e for signing and \u003ccode\u003ePublicKeyVerify\u003c/code\u003e for verifying.\u003c/p\u003e\n"],["\u003cp\u003eECDSA_P256 is generally recommended, with ED25519 offering better performance and RSA_SSA_PKCS1_3072_SHA256_F4 providing the fastest verification.\u003c/p\u003e\n"],["\u003cp\u003eDigital signatures in Tink guarantee a minimum of 112-bit security and support data of any length.\u003c/p\u003e\n"]]],["Digital signatures ensure data authenticity and integrity using asymmetric key pairs (public and private). `PublicKeySign` signs data, while `PublicKeyVerify` checks signatures. Key options include the widely used ECDSA_P256, faster ED25519, and high-verification-performance RSA_SSA_PKCS1_3072_SHA256_F4. Signatures offer 128-bit security (elliptic curves) or 112-bit security (RSA). ECDSA signatures are malleable, allowing attackers to forge valid signatures. If asymmetry is not needed consider using MAC.\n"],null,["# Digital Signature\n\nThe Digital Signature primitive lets you verify that no one has tampered with\nyour data. It provides authenticity and integrity, but not secrecy, of the\nsigned data. It is asymmetric, meaning it uses a pair of keys (public key and\nprivate key).\n\nThe Digital Signature primitive has the following properties:\n\n- **Authenticity** : It is impossible to create a signature for which `PublicKeyVerify.Verify(signature, message)` validates, unless you have the private key.\n- **Asymmetric**: Creating the signature uses a different key than verifying it. This lets you distribute the public key to verify signatures to parties that can't create signatures themselves.\n\nIf you don't need asymmetry, consider using the simpler and more efficient\n[MAC](/tink/mac) primitive instead.\n\nThe functionality of digital signatures is represented in Tink as a pair of\nprimitives:\n\n- *PublicKeySign* for signing data\n- *PublicKeyVerify* for verifying the signature\n\n### Choose a key type\n\nWe recommend using **ECDSA_P256** for most use cases, but there are a variety of\noptions. In general, the following holds true:\n\n- ECDSA_P256 is the most widely used option and a reasonable default. Note though that ECDSA signatures are [malleable](#malleable).\n- ED25519 creates deterministic signatures and provides better performance than ECDSA_P256.\n- RSA_SSA_PKCS1_3072_SHA256_F4 creates deterministic signatures and provides the best verification performance (but signing is much slower than ECDSA_P256 or ED25519).\n\n### Minimal security guarantees\n\n- Data to be signed can have arbitrary length\n- 128-bit security level against adaptive chosen-message attacks for elliptic curve based schemes\n- 112-bit security level against adaptive chosen-message attacks for RSA based schemes (allows 2048-bit keys)\n\n### Malleability\n\nA signature scheme is malleable if an attacker can create a different valid\nsignature for an already signed message. While this is not a problem for most\nscenarios, in some cases programmers implicitly assume that valid signatures are\nunique, and this can lead to unexpected results.\n\n### Example use case\n\nSee I want to [digitally sign data](/tink/digitally-sign-data)."]]