Ajoutez tink-cc en tant que dépendance dans l'arborescence.
cmake_minimum_required(VERSION3.22)project(YourProjectCXX)set(CMAKE_CXX_STANDARD_REQUIREDON)set(CMAKE_CXX_STANDARD14)include(FetchContent)# Import Tink as an in-tree dependency.FetchContent_Declare(tinkURLhttps://github.com/tink-crypto/tink-cc/archive/refs/tags/v2.4.0.zipURL_HASHSHA256=06c4d49b0b1357f0b8c3abc77a7d920130dc868e4597d432a9ce1cda4f65e382)FetchContent_GetProperties(tink)if(NOTgoogletest_POPULATED)FetchContent_Populate(tink)add_subdirectory(${tink_SOURCE_DIR}${tink_BINARY_DIR}EXCLUDE_FROM_ALL)endif()add_executable(your_appyour_app.cc)target_link_libraries(your_apptink::static)
Une fois que vous avez terminé de configurer Tink, suivez les étapes d'utilisation standard de Tink :
Choisir une primitive : décidez quelle primitive utiliser en fonction de votre cas d'utilisation.
Gérer les clés : protégez vos clés avec votre KMS externe, générez des ensembles de clés et effectuez une rotation de vos clés.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/25 (UTC).
[null,null,["Dernière mise à jour le 2025/07/25 (UTC)."],[],[],null,["# Set up Tink C++\n\nAfter installing and setting up Tink, continue with [Next Steps](#next_steps).\n\nCompatibility\n-------------\n\n| | Compatible with all libraries | Additionally compatible with Tink C++ |\n|--------------|---------------------------------------------------------------|---------------------------------------|\n| Language | C++ \\\u003e= 17 | n/a |\n| OS | UbuntuLTS \\\u003e= 20.04 (x86_64) macOS \\\u003e= 12.5 Monterey (x86_64) | Windows Server \\\u003e= 2019 (x86_64) |\n| Compiler | GCC \\\u003e= 7.5.0 Apple Clang \\\u003e= 14 | MSVC \\\u003e= 2019 |\n| Build system | [Bazel](http://bazel.build) \\\u003e= 7 LTS | [CMake](https://cmake.org/) \\\u003e= 3.22 |\n\nInstallation\n------------\n\n### Tink C++\n\nThe core C++ library is [tink-cc](https://github.com/tink-crypto/tink-cc) with\n[2.4.0](https://github.com/tink-crypto/tink-cc/releases/tag/v2.4.0) as the latest release.\n\nBazel\n-----\n\n### Bzlmod\n\nAdd this to your [`MODULE.bazel`](https://bazel.build/external/migration)\nfile: \n\n bazel_dep(name = \"tink_cc\", version = \"2.4.0\")\n\n### WORKSPACE\n\nAdd this to your `WORKSPACE` file: \n\n load(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\n\n http_archive(\n name = \"tink_cc\",\n urls = [\"https://github.com/tink-crypto/tink-cc/archive/refs/tags/v2.4.0.zip\"],\n strip_prefix = \"tink-2.4.0\",\n sha256 = \"06c4d49b0b1357f0b8c3abc77a7d920130dc868e4597d432a9ce1cda4f65e382\",\n )\n\n load(\"@tink_cc//:tink_cc_deps.bzl\", \"tink_cc_deps\")\n\n tink_cc_deps()\n\n load(\"@tink_cc//:tink_cc_deps_init.bzl\", \"tink_cc_deps_init\")\n\n tink_cc_deps_init()\n\nCMake\n-----\n\nAdd `tink-cc` as an in-tree dependency. \n\n cmake_minimum_required(VERSION 3.22)\n project(YourProject CXX)\n set(CMAKE_CXX_STANDARD_REQUIRED ON)\n set(CMAKE_CXX_STANDARD 14)\n include(FetchContent)\n\n # Import Tink as an in-tree dependency.\n FetchContent_Declare(\n tink\n URL https://github.com/tink-crypto/tink-cc/archive/refs/tags/v2.4.0.zip\n URL_HASH SHA256=06c4d49b0b1357f0b8c3abc77a7d920130dc868e4597d432a9ce1cda4f65e382\n )\n FetchContent_GetProperties(tink)\n if(NOT googletest_POPULATED)\n FetchContent_Populate(tink)\n add_subdirectory(${tink_SOURCE_DIR} ${tink_BINARY_DIR} EXCLUDE_FROM_ALL)\n endif()\n\n add_executable(your_app your_app.cc)\n target_link_libraries(your_app tink::static)\n\n| **Note:** Tink defines the C++ standard using the `TINK_CXX_STANDARD` variable, which is 14 by default. If you want to propagate `CMAKE_CXX_STANDARD` to Tink, use `set(CMAKE_CXX_STANDARD_REQUIRED ON)`.\n\n### AWS KMS Extension\n\nThe Tink C++ [AWS KMS](https://aws.amazon.com/kms/) extension is\n[tink-cc-awskms](https://github.com/tink-crypto/tink-cc-awskms) with\n[2.0.1](https://github.com/tink-crypto/tink-cc-awskms/releases/tag/v2.0.1) as the latest\nrelease.\n\nBazel\n-----\n\n### WORKSPACE\n\nAdd this to your `WORKSPACE` file: \n\n load(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\n\n http_archive(\n name = \"tink_cc\",\n urls = [\"https://github.com/tink-crypto/tink-cc/archive/refs/tags/v2.4.0.zip\"],\n strip_prefix = \"tink-2.4.0\",\n sha256 = \"06c4d49b0b1357f0b8c3abc77a7d920130dc868e4597d432a9ce1cda4f65e382\",\n )\n\n load(\"@tink_cc//:tink_cc_deps.bzl\", \"tink_cc_deps\")\n\n tink_cc_deps()\n\n load(\"@tink_cc//:tink_cc_deps_init.bzl\", \"tink_cc_deps_init\")\n\n tink_cc_deps_init()\n\n http_archive(\n name = \"tink_cc_awskms\",\n urls = [\"https://github.com/tink-crypto/tink-cc-awskms/archive/refs/tags/v2.0.1.zip\"],\n strip_prefix = \"tink-cc-awskms-2.0.1\",\n sha256 = \"366319b269f62af120ee312ce4c99ce3738ceb23ce3f9491b4859432f8b991a4\",\n )\n\n load(\"@tink_cc_awskms//:tink_cc_awskms_deps.bzl\", \"tink_cc_awskms_deps\")\n\n tink_cc_awskms_deps()\n\n### Google Cloud KMS Extension\n\nThe Tink C++ [Google Cloud KMS](https://cloud.google.com/kms/) extension is\n[tink-cc-gcpkms](https://github.com/tink-crypto/tink-cc-gcpkms) with\n[2.4.0](https://github.com/tink-crypto/tink-cc-gcpkms/releases/tag/v2.4.0) as the latest\nrelease.\n\nBazel\n-----\n\n### WORKSPACE\n\nAdd this to your `WORKSPACE` file: \n\n load(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\n\n http_archive(\n name = \"tink_cc_gcpkms\",\n urls = [\"https://github.com/tink-crypto/tink-cc-gcpkms/releases/download/v2.4.0/tink-cc-gcpkms-2.4.0.zip\"],\n strip_prefix = \"tink-cc-gcpkms-2.4.0\",\n sha256 = \"b2c7803b03fcce2d52b15e97f871155d477ccf88b2146337d54202defd074418\",\n )\n\n load(\"@tink_cc_gcpkms//:tink_cc_gcpkms_deps.bzl\", \"tink_cc_gcpkms_deps\")\n\n tink_cc_gcpkms_deps()\n\n load(\"@tink_cc_gcpkms//:tink_cc_gcpkms_deps_init.bzl\", \"tink_cc_gcpkms_deps_init\")\n\n tink_cc_gcpkms_deps_init(register_go = True)\n\nNext steps\n----------\n\nOnce you've finished setting up Tink, continue with the standard Tink usage\nsteps:\n\n- [Choose a primitive](/tink/choose-primitive) -- Decide which primitive to use based on your use case\n- [Manage keys](/tink/key-management-overview) -- Protect your keys with your external KMS, generate keysets, and rotate your keys"]]