استخدام Tink لاستيفاء متطلبات الأمان على معيار FIPS 140-2
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
Tink بحد ذاته ليس
تم التحقق من صحة FIPS 140-2. مع ذلك، يتوافق مع العديد من بروتوكولات FIPS
يمكن أن يستخدم 140-2 من الخوارزميات المعتمدة وعمليات التنفيذ الأساسية
وحدات التشفير التي تم التحقق منها مثل
BoringSSLs BuringCrypto. يتضمن Tink
WorkSPACE لإنشاء BuringSSL في وضع FIPS.
تجدر الإشارة إلى أنّ مساحة العمل لا تقدّم أي ضمانات متأصّلة أنّ استخدامك لـ BuringSSL
متوافق مع معيار FIPS ننصحك بشدة بقراءة المقالة الرسمية
سياسة الأمان لشركة BuringCrypto.
الخوارزميات المتوافقة
تمت الموافقة على الخوارزميات التالية في Tink وفقًا
FIPS 140-2 (يمكنك الاطّلاع على مزيد من المعلومات على
الملحق "أ" (أ) وفقًا لمعايير FIPS 140-2:
التشفير الذي تمت مصادقته
AES-GCM
AES-CTR-HMAC-SHA256
MAC
معيار HMAC-SHA256
AES-CMAC
التوقيعات الرقمية
ECDSA
RSA-SSA-PKCS1
RSA-SSA-PSS
وضع FIPS فقط في C++
إذا طُلب منك استخدام خوارزميات FIPS 140-2 المعتمدة وتم التحقق من صحتها
عمليات التنفيذ، يمكنك إنشاء Tink في وضع FIPS فقط. يؤدي ذلك إلى تقييد
استخدامها للخوارزميات المُعتمَدة والتحقق مما إذا كان Tink يستخدم أداة
وحدة تشفير.
يؤدي هذا إلى تغيير سلوك Tink بالطرق التالية:
دوال Register() لا تسجِّل سوى الخوارزميات التي تحتوي على FIPS
والذي تم التحقق من صحته. وهذا يعني أنه يمكنك فقط استخدام
مجموعات مفاتيح خاصة بالخوارزميات التي تستخدم وحدة تشفير تم التحقق من صحتها.
يتحقّق Tink مما إذا كان قد تم إنشاء BuringSSL باستخدام وحدة BuringCrypto.
تعرض استدعاءات الوحدات الأولية خطأ INTERNAL عندما تكون الوحدة غير مفعّلة
المتوفرة.
يقتصر استخدام الأساسيات في subtle/ على الخوارزميات التي تستخدم
وحدة تشفير تم التحقق من صحتها.
BoringCrypto
يستخدم Tink أداة BoringCrypto
في لغة C++ لإتاحة الوصول إلى وحدة تشفير تم التحقق من صحتها. الوقت الحالي
تفرض حالة التحقق من الصحة القيود الإضافية التالية على
الخوارزميات عندما تكون في وضع FIPS فقط:
لم يتم التحقق من صحة AES-CMAC وهي غير متاحة
تم تقييد RSA-SSA-PKCS1 على معامل 3072 بت.
يقتصر RSA-SSA-PSS على معامل 3072 بت
لاستخدام وحدة BuringCrypto مع 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.
تحذير: في حال استخدام خيار بيئة التشغيل، سيتم تحديد crypto::tink::RestrictToFips().
عن طريق الاتصال قبل التعامل مع أي مواد رئيسية أو تسجيل مدير المفاتيح
وظائف Tink الأخرى. بالإضافة إلى ذلك، يجب التأكد من أن BuringSSL لديه
باستخدام وحدة BuringCrypto، وبخلاف ذلك، لن تسمح لك 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."]]