از 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 دارند. این بدان معنی است که شما فقط می توانید از Keysets برای الگوریتم هایی استفاده کنید که از یک ماژول رمزنگاری معتبر استفاده می کنند.
Tink بررسی میکند که آیا BoringSSL با ماژول BoringCrypto ساخته شده است یا خیر. هنگامی که ماژول در دسترس نباشد، فراخوانی به primitives یک خطای 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، یک پرچم در زمان کامپایل تنظیم کنید:
اگر میخواهید در زمان اجرا بررسی کنید که آیا Tink در حالت فقط FIPS ساخته شده است، میتوانید سرصفحه internal/fips_utils.h را اضافه کنید که kUseOnlyFips ثابت را ارائه میکند.
اگر Tink را در حالت فقط FIPS نمیسازید ، همچنان میتواند از پیادهسازیهای معتبر برای برخی الگوریتمها استفاده کند، اما استفاده از الگوریتمهای دیگر را محدود نمیکند.
در زمان اجرا فعال شود
بهعنوان جایگزینی برای ساخت Tink در حالت فقط FIPS، میتوانید crypto::tink::RestrictToFips() را از config/tink_fips.h فراخوانی کنید که در زمان اجرا پرچمی را برای فعال کردن محدودیتهای اولیه FIPS تنظیم میکند.
اخطار: اگر از گزینه runtime استفاده میکنید، باید crypto::tink::RestrictToFips() قبل از رسیدگی به هر ماده کلیدی، ثبت نام مدیر کلید یا سایر قابلیتهای Tink فراخوانی شود. علاوه بر این، باید مطمئن شوید که BoringSSL با ماژول BoringCrypto ساخته شده است، در غیر این صورت Tink به شما اجازه پردازش هیچ داده ای را نمی دهد.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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 بهوقت ساعت هماهنگ جهانی."],[[["\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."]]