Configurar o Tink C++

Depois de instalar e configurar o Tink, continue com as Próximas etapas.

Compatibilidade

Compatível com todas as bibliotecas Além disso, é compatível com o Tink C++
Idioma C++ >= 17 N/A
SO UbuntuLTS >= 20.04 (x86_64)
macOS >= 12.5 Monterey (x86_64)
Windows Server >= 2019 (x86_64)
Compilador GCC >= 7.5.0
Apple Clang >= 14
MSVC >= 2019
Sistema de build Bazel >= 7 LTS CMake >= 3.22

Instalação

Tink C++

A biblioteca principal do C++ é a tink-cc, e a versão mais recente é a 2.5.0.

Bazel

Bzlmod

Adicione isto ao seu arquivo MODULE.bazel:

bazel_dep(name = "tink_cc", version = "2.5.0")

WORKSPACE

Adicione isto ao seu arquivo WORKSPACE:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "tink_cc",
    urls = ["https://github.com/tink-crypto/tink-cc/archive/refs/tags/v2.5.0.zip"],
    strip_prefix = "tink-2.5.0",
    sha256 = "a7a779ffacf29a48e33153439968c018ae0f6b358b8adf13ec1476180c799ffa",
)

load("@tink_cc//:tink_cc_deps.bzl", "tink_cc_deps")

tink_cc_deps()

load("@tink_cc//:tink_cc_deps_init.bzl", "tink_cc_deps_init")

tink_cc_deps_init()

CMake

Adicione tink-cc como uma dependência na árvore.

cmake_minimum_required(VERSION 3.22)
project(YourProject CXX)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
include(FetchContent)

# Import Tink as an in-tree dependency.
FetchContent_Declare(
  tink
  URL       https://github.com/tink-crypto/tink-cc/archive/refs/tags/v2.5.0.zip
  URL_HASH  SHA256=a7a779ffacf29a48e33153439968c018ae0f6b358b8adf13ec1476180c799ffa
)
FetchContent_GetProperties(tink)
if(NOT googletest_POPULATED)
  FetchContent_Populate(tink)
    add_subdirectory(${tink_SOURCE_DIR} ${tink_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

add_executable(your_app your_app.cc)
target_link_libraries(your_app tink::static)

Extensão do KMS da AWS

A extensão AWS KMS do Tink C++ é a tink-cc-awskms, e a versão mais recente é a 2.0.1.

Bazel

WORKSPACE

Adicione isto ao seu arquivo WORKSPACE:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "tink_cc",
    urls = ["https://github.com/tink-crypto/tink-cc/archive/refs/tags/v2.5.0.zip"],
    strip_prefix = "tink-2.5.0",
    sha256 = "a7a779ffacf29a48e33153439968c018ae0f6b358b8adf13ec1476180c799ffa",
)

load("@tink_cc//:tink_cc_deps.bzl", "tink_cc_deps")

tink_cc_deps()

load("@tink_cc//:tink_cc_deps_init.bzl", "tink_cc_deps_init")

tink_cc_deps_init()

http_archive(
    name = "tink_cc_awskms",
    urls = ["https://github.com/tink-crypto/tink-cc-awskms/archive/refs/tags/v2.0.1.zip"],
    strip_prefix = "tink-cc-awskms-2.0.1",
    sha256 = "366319b269f62af120ee312ce4c99ce3738ceb23ce3f9491b4859432f8b991a4",
)

load("@tink_cc_awskms//:tink_cc_awskms_deps.bzl", "tink_cc_awskms_deps")

tink_cc_awskms_deps()

Extensão do Google Cloud KMS

A extensão Google Cloud KMS do Tink C++ é a tink-cc-gcpkms, e a versão mais recente é a 2.4.0.

Bazel

WORKSPACE

Adicione isto ao seu arquivo WORKSPACE:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "tink_cc_gcpkms",
    urls = ["https://github.com/tink-crypto/tink-cc-gcpkms/releases/download/v2.4.0/tink-cc-gcpkms-2.4.0.zip"],
    strip_prefix = "tink-cc-gcpkms-2.4.0",
    sha256 = "b2c7803b03fcce2d52b15e97f871155d477ccf88b2146337d54202defd074418",
)

load("@tink_cc_gcpkms//:tink_cc_gcpkms_deps.bzl", "tink_cc_gcpkms_deps")

tink_cc_gcpkms_deps()

load("@tink_cc_gcpkms//:tink_cc_gcpkms_deps_init.bzl", "tink_cc_gcpkms_deps_init")

tink_cc_gcpkms_deps_init(register_go = True)

Próximas etapas

Depois de configurar o Tink, siga as etapas padrão de uso do Tink:

  • Escolher um primitivo: decida qual primitivo usar com base no seu caso de uso.
  • Gerenciar chaves: proteja suas chaves com o KMS externo, gere conjuntos de chaves e faça a rotação delas.