חתימה דיגיטלית
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בעזרת הפרימיטיב של החתימה הדיגיטלית אפשר לוודא שאף אחד לא שינה את הנתונים שלכם. היא מספקת אותנטיות ותקינות של הנתונים החתומים, אבל לא סודיות. הוא אסימטרי, כלומר הוא משתמש בזוג מפתחות (מפתח ציבורי ומפתח פרטי).
לפרימיטיב החתימה הדיגיטלית יש את המאפיינים הבאים:
- אותנטיות: אי אפשר ליצור חתימה ש-
PublicKeyVerify.Verify(signature, message)
מאמתת, אלא אם יש לכם את המפתח הפרטי.
- אסימטרי: ליצירת החתימה נעשה שימוש במפתח שונה מזה שמשמש לאימות שלה. כך תוכלו להפיץ את המפתח הציבורי לאימות חתימות לצדדים שלא יכולים ליצור חתימות בעצמם.
אם אין צורך באסימטריה, מומלץ להשתמש במקום זאת בפרימיטיב MAC הפשוט והיעיל יותר.
הפונקציונליות של חתימות דיגיטליות מיוצגת ב-Tink כצמד פרימיטיבים:
- PublicKeySign לחתימה על נתונים
- PublicKeyVerify לאימות החתימה
בחירת סוג מפתח
מומלץ להשתמש ב-ECDSA_P256 ברוב תרחישי השימוש, אבל יש מגוון אפשרויות. באופן כללי, הכלל הבא תקף:
- ECDSA_P256 היא האפשרות הנפוצה ביותר, וזוהי ברירת המחדל הסבירה. עם זאת, חשוב לזכור שחתימות ECDSA הן ניתנות לשינוי.
- פרוטוקול ED25519 יוצר חתימות גורםיות ומספק ביצועים טובים יותר מ-ECDSA_P256.
- RSA_SSA_PKCS1_3072_SHA256_F4 יוצר חתימות ודטרמיניסטיות ומספק את ביצועי האימות הטובים ביותר (אבל החתימה איטית בהרבה מ-ECDSA_P256 או מ-ED25519).
ערבויות אבטחה מינימליות
- אורך הנתונים לחתימה יכול להיות שרירותי
- רמת אבטחה של 128 ביט מפני התקפות הודעות נבחרות אדפטיביות לסכמות שמבוססות על עקומה אליפטית
- רמת אבטחה של 112 ביט מפני התקפות אדפטיביות של הודעות שנבחרו מראש לסכמות מבוססות RSA (מאפשרת מפתחות של 2048 ביט)
גמישות
סכימה לחתימה היא גמישה אם תוקף יכול ליצור חתימה תקפה אחרת להודעה שכבר חתומה. זה לא בעיה ברוב התרחישים, אבל במקרים מסוימים מתכנתים מניחים באופן משתמע שחתימות תקינות הן ייחודיות, וזה עלול להוביל לתוצאות בלתי צפויות.
תרחיש לדוגמה
מידע נוסף זמין במאמר חתימה דיגיטלית על נתונים.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 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)."]]