Configuração do Tink

É possível criar o Tink a partir da origem ou usar pacotes específicos para cada idioma. Siga as instruções a seguir para começar.

Depois de instalar e configurar o Tink, siga as próximas etapas no final desta página.

C++

O Tink fornece as seguintes bibliotecas C++:

Tink C++ (tink-cc)

O Tink C++ depende de:

O Tink C++ oferece suporte a:

  • C++ >= 14
  • 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:

CMake

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

cmake_minimum_required(VERSION 3.13)
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.3.0.zip
  URL_HASH  SHA256=363ce671ab5ce0b24f279d3647185597a25f407c3608db007315f79f151f436b
)
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)

Bazel

Bzlmod

Se você usa o Bazel com módulos, adicione o seguinte ao arquivo MODULE.bazel:

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

ESPAÇO DE TRABALHO

Se você usa o Bazel com arquivos WORKSPACE, adicione o seguinte ao 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.3.0.zip"],
    strip_prefix = "tink-2.3.0",
    sha256 = "363ce671ab5ce0b24f279d3647185597a25f407c3608db007315f79f151f436b",
)

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()

Extensão do AWS KMS do Tink C++ (tink-cc-awskms)

O Tink C++ Google Cloud KMS depende de:

O Tink C++ AWS KMS oferece suporte a:

  • C++ >= 14
  • SO:
    • UbuntuLTS >= 20.04 (x86_64)
    • macOS >= 12.5 Monterey (x86_64)
  • Compilador:
    • GCC >= 7.5.0
    • Apple Clang >= 14
  • Sistema de build:

Bazel

Adicione o seguinte ao arquivo WORKSPACE do seu projeto:

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.3.0.zip"],
    strip_prefix = "tink-2.3.0",
    sha256 = "363ce671ab5ce0b24f279d3647185597a25f407c3608db007315f79f151f436b",
)

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 do Tink em C++ (tink-cc-gcpkms)

O Tink C++ Google Cloud KMS depende de:

O Google Cloud KMS do Tink C++ oferece suporte a:

  • C++ >= 14
  • SO:
    • UbuntuLTS >= 20.04 (x86_64)
    • macOS >= 12.5 Monterey (x86_64)
  • Compilador:
    • GCC >= 7.5.0
    • Apple Clang >= 14
  • Sistema de build:

Bazel

Adicione o seguinte ao arquivo WORKSPACE do projeto:

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.3.0/tink-cc-gcpkms-2.3.0.zip"],
    strip_prefix = "tink-cc-gcpkms-2.3.0",
    sha256 = "5af0d0a502afc346bbaa40f226e8f3b28fe3f5def696cbaaa7bc13702af78901",
)

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)

Go

O Tink oferece as seguintes bibliotecas Go:

Todas as bibliotecas do Tink Go são publicadas como módulos Go que podem ser usados com ferramentas Go padrão ou Bazel.

Tink Go (tink-go)

Ferramentas do Go

Execute o seguinte comando no diretório do projeto:

go get github.com/tink-crypto/tink-go/v2@v2.3.0

Consulte a documentação oficial do Go.

Extensão do KMS da AWS do Tink Go (tink-go-awskms)

Ferramentas do Go

Execute o comando a seguir no diretório do projeto:

go get github.com/tink-crypto/tink-go-awskms/v2@2.1.0

Consulte a documentação oficial do Go.

Extensão do Google Cloud KMS do Tink Go (tink-go-gcpkms)

Ferramentas do Go

Execute o comando a seguir no diretório do projeto:

go get github.com/tink-crypto/tink-go-gcpkms/v2@v2.2.0

Consulte a documentação oficial do Go.

Extensão do HashiCorp Vault do Tink Go (tink-go-hcvault)

Ferramentas do Go

Execute o comando a seguir no diretório do projeto:

go get github.com/tink-crypto/tink-go-hcvault/v2@v2.2.0

Consulte a documentação oficial do Go.

Java

Configurar o Tink Java e as extensões

ObjC

Consulte o HOWTO no GitHub.

Python

A biblioteca Tink Python, tink-py, oferece suporte ao Python 3.8 ou mais recente no macOS (x86-64 e ARM64), Linux (x86-64 e ARM64) e Windows (x86-64). A versão mais recente é a 1.10.0. Ele pode ser instalado localmente usando o Pip ou usado com o Bazel.

O Tink Python oferece integrações com o AWS KMS, o Google Cloud KMS e o HashiCorp Vault.

Pip

É possível instalar a versão binária do Python do Tink para seu sistema no PyPI (link em inglês), executando o seguinte comando:

pip3 install tink==1.10.0
# Core Tink + Google Cloud KMS extension.
pip3 install tink[gcpkms]==1.10.0
# Core Tink + AWS KMS extension.
pip3 install tink[awskms]==1.10.0
# Core Tink + HashiCorp Vault KMS extension.
pip3 install tink[hcvault]==1.10.0
# Core Tink + all the KMS extensions.
pip3 install tink[all]==1.10.0

Se um pacote binário não for publicado para seu ambiente, o pip recorre automaticamente à criação do projeto usando a distribuição de origem publicada no PyPI. Nesse caso, é necessário instalar o Bazel ou o Bazelisk e o compilador protobuf para criar o projeto.

Bazel

Os usuários do Bazel podem incluir o Tink Python no arquivo WORKSPACE da seguinte maneira:

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

http_archive(
    name = "tink_py",
    urls = ["https://github.com/tink-crypto/tink-py/releases/download/v1.10.0/tink-py-1.10.0.zip"],
    strip_prefix = "tink-py-1.10.0",
    sha256 = "767453aae4aad6de4fbb4162992184aa427b7b27864fe9912c270b24c673e1cc",
)

load("@tink_py//:tink_py_deps.bzl", "tink_py_deps")
tink_py_deps()

load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()

load("@tink_py//:tink_py_deps_init.bzl", "tink_py_deps_init")
tink_py_deps_init("tink_py")

Próximas etapas

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

  • Escolher uma primitiva: decida qual primitiva 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 das chaves.