שימוש ב-Tink כדי לעמוד בדרישות האבטחה של FIPS 140-2
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
ה-Tink עצמו אינו
אישור FIPS 140-2 אושר. עם זאת, הוא תומך בכמה מודלים של FIPS
140-2 אלגוריתמים שאושרו וההטמעות הבסיסיות יכולים לנצל
מודולים קריפטוגרפיים מאומתים כמו
BoringSSLs BoringCrypto. Tink כולל
WORKSPACE לפיתוח BoringSSL במצב FIPS.
חשוב לשים לב שסביבת העבודה לא מספקת ערובה מעצם טבעה שהשימוש שלך ב-BoringSSL
תואם ל-FIPS. מומלץ מאוד לקרוא את
מדיניות האבטחה של BoringCrypto.
אם אתם נדרשים להשתמש באלגוריתמים שאושרו על ידי FIPS 140-2 ואומתו
אפשר לבנות Tink במצב FIPS בלבד. ההגדרה הזו מגבילה
לאלגוריתמים שאושרו וגם לבדוק אם ב-Tink נעשה שימוש באלגוריתם מאומת
למודול הקריפטוגרפי.
הפעולה הזו משנה את ההתנהגות של Tink בדרכים הבאות:
פונקציות Register() רושמות רק אלגוריתמים עם FIPS
יישום מאומת. המשמעות היא שרק אתם יכולים להשתמש
ערכות מפתחות לאלגוריתמים שמשתמשים במודול קריפטוגרפי מאומת.
Tink בודק אם BoringSSL נבנה באמצעות המודול BoringCrypto.
קריאות לרכיב ראשי מחזירות שגיאת INTERNAL כשהמודול לא
זמינים.
השימוש בפרימיטיביים ב-subtle/ מוגבל לאלגוריתמים שמשתמשים
מודול קריפטוגרפי מאומת.
BoringCrypto
Tink משתמש ב-BoringCrypto
ב-C++ כדי לספק גישה למודול קריפטוגרפי מאומת. הנוכחי
סטטוס האימות מחייב את המגבלות הנוספות הבאות על
במצב FIPS בלבד:
AES-CMAC לא אומת ואינו זמין
RSA-SSA-PKCS1 מוגבל למודולוס של 3072 ביט
RSA-SSA-PSS מוגבל למודול של 3072 ביט
כדי להשתמש במודול BoringCrypto עם Bazel, אפשר לבטל את הוספת ההערה
ההגדרה של local_repository עבור boringssl בC++
Workspace.
הפעלה בזמן הידור
כדי לבנות Tink במצב FIPS בלבד, מגדירים דגל בזמן הידור (compile) :
אם רוצים לבדוק בזמן הריצה אם Tink נבנה במצב FIPS בלבד,
אפשר לכלול את הכותרת internal/fips_utils.h שמספקת את הערך הקבוע
kUseOnlyFips.
אם אתם לא מפתחים את Tink במצב FIPS בלבד, אפשר עדיין להשתמש בו
אימותים של אלגוריתמים מסוימים, אבל לא מגבילים את השימוש
אלגוריתמים אחרים.
הפעלה בזמן הריצה
כחלופה לבניית Tink במצב FIPS בלבד, ניתן לבצע קריאה
crypto::tink::RestrictToFips() מ-config/tink_fips.h שמגדיר דגל
בזמן הריצה כדי לאפשר את ההגבלות לפרימיטיביים של FIPS.
אזהרה: אם משתמשים באפשרות של זמן ריצה, אז crypto::tink::RestrictToFips()
חייבים לקרוא להן לפני טיפול בחומר מפתח, רישום מנהל מפתחות או
פונקציות אחרות של Tink. בנוסף, עליך לוודא ש-BoringSSL
נבנה באמצעות המודול BoringCrypto, אחרת מערכת Tink לא מאפשרת לכם
לעבד נתונים כלשהם.
[[["התוכן קל להבנה","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\u003eTink supports using FIPS 140-2 approved cryptographic algorithms with validated implementations like BoringCrypto, although Tink itself is not FIPS validated.\u003c/p\u003e\n"],["\u003cp\u003eA FIPS-only mode in Tink (C++ only) restricts usage to approved algorithms and validated implementations, ensuring only FIPS-compliant keysets are used.\u003c/p\u003e\n"],["\u003cp\u003eIn FIPS-only mode, Tink utilizes BoringCrypto for its validated cryptographic module, with limitations on certain algorithms like AES-CMAC and RSA key sizes.\u003c/p\u003e\n"],["\u003cp\u003eYou can enable FIPS-only mode at compile time with a Bazel build flag or at runtime by calling \u003ccode\u003ecrypto::tink::RestrictToFips()\u003c/code\u003e before any Tink operations.\u003c/p\u003e\n"],["\u003cp\u003eWhen not in FIPS-only mode, Tink can still leverage validated implementations for some algorithms without enforcing restrictions on others.\u003c/p\u003e\n"]]],["Tink, while not FIPS 140-2 validated itself, supports several approved algorithms and can utilize validated modules like BoringCrypto in C++. In FIPS-only mode, enabled at compile or runtime, Tink restricts usage to validated algorithms. It checks for the BoringCrypto module, allowing only FIPS-approved keysets, algorithms and primitives. When using FIPS-only mode, specific algorithms like AES-CMAC are unavailable, and RSA is limited to 3072-bit modulus. Runtime enabling requires calling `crypto::tink::RestrictToFips()` before any Tink operations.\n"],null,["# Use Tink to meet FIPS 140-2 security requirements\n\n| **Note:** This is only supported in the C++ version of Tink at the moment.\n\nTink itself is not\n[FIPS 140-2](https://csrc.nist.gov/publications/detail/fips/140/2/final) validated. However, it supports several FIPS\n140-2 approved algorithms and the underlying implementations *can* utilize\nvalidated cryptographic modules like\n[BoringSSLs BoringCrypto](https://csrc.nist.gov/projects/cryptographic-module-validation-program/certificate/3678). Tink includes a\n[WORKSPACE](https://github.com/tink-crypto/tink-cc/blob/main/third_party/boringssl_fips) for building BoringSSL in FIPS mode.\n\nNote that the workspace gives no inherent guarantee that your use of BoringSSL\nis FIPS compliant. We strongly recommend that you read the official\n[security policy](https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp3678.pdf) for BoringCrypto.\n\nSupported algorithms\n--------------------\n\nThe following algorithms in Tink are approved according to\n[FIPS 140-2](https://csrc.nist.gov/publications/detail/fips/140/2/final) (see more information at\n[FIPS 140-2 Annex A](https://csrc.nist.gov/CSRC/media/Publications/fips/140/2/final/documents/fips1402annexa.pdf)):\n\n- Authenticated Encryption\n - AES-GCM\n - AES-CTR-HMAC-SHA256\n- MAC\n - HMAC-SHA256\n - AES-CMAC\n- Digital Signatures\n - ECDSA\n - RSA-SSA-PKCS1\n - RSA-SSA-PSS\n\nFIPS-only mode in C++\n---------------------\n\nIf you are required to use FIPS 140-2 approved algorithms and validated\nimplementations, you can build Tink in FIPS-only mode. This restricts\nusage to approved algorithms *and* checks if Tink is utilizing a validated\ncryptographic module.\n\nThis changes the behavior of Tink in the following ways:\n\n- `Register()` functions only register algorithms that have a FIPS validated implementation. This means that you are *only* able to use Keysets for algorithms that use a validated cryptographic module.\n- Tink checks if BoringSSL has been built with the BoringCrypto module. Calls to primitives return an `INTERNAL` error when the module is not available.\n- Using primitives in `subtle/` is restricted to algorithms that utilize a validated cryptographic module.\n\n### BoringCrypto\n\nTink uses [BoringCrypto](https://csrc.nist.gov/projects/cryptographic-module-validation-program/certificate/3678)\nin C++ to provide access to a validated cryptographic module. Its current\nvalidation status imposes the following additional constraints on available\nalgorithms when in FIPS-only mode:\n\n- AES-CMAC has not been validated and is not available\n- RSA-SSA-PKCS1 is restricted to 3072-bit modulus\n- RSA-SSA-PSS is restricted to 3072-bit modulus\n\nTo use the BoringCrypto module with Bazel, you can uncomment the\n`local_repository` definition for `boringssl` in the [C++\nWORKSPACE](https://github.com/google/tink/blob/master/cc/WORKSPACE).\n\n### Enable at compile time\n\nTo build Tink in FIPS-only mode, set a flag at compile time: \n\n bazel build ... --//third_party/tink/cc/config:use_only_fips=True\n\nIf you want to check at runtime whether Tink has been built in FIPS only mode,\nyou can include the header `internal/fips_utils.h` which provides the constant\n`kUseOnlyFips`.\n\nIf you are *not* building Tink in FIPS only mode, it can still utilize\nvalidated implementations for *some* algorithms but not restrict the usage of\nother algorithms.\n\n### Enable at run time\n\nAs an alternative to building Tink in FIPS-only mode, you can call\n`crypto::tink::RestrictToFips()` from `config/tink_fips.h` which sets a flag\nat runtime to enable the restrictions to FIPS primitives.\n\nWARNING: If you use the runtime option, then `crypto::tink::RestrictToFips()`\nmust be called before handling any key material, registering key manager, or\nother Tink functionalities. Additionally, you must ensure that BoringSSL has\nbeen built with the BoringCrypto module, otherwise Tink does not allow you to\nprocess any data."]]