Configuration de Tink

Vous pouvez compiler Tink à partir de la source ou utiliser des packages spécifiques au langage. Les instructions suivantes vous aideront à vous lancer.

Une fois Tink installé et configuré, passez aux étapes suivantes à la fin de cette page.

C++

Tink fournit les bibliothèques C++ suivantes:

Tink C++ (tink-cc)

Tink C++ dépend des éléments suivants:

Tink C++ est compatible avec:

  • C++ >= 14
  • OS:
    • UbuntuLTS 20.04 ou version ultérieure (x86_64)
    • Monterey 12.5 ou version ultérieure (macOS) (x86_64)
    • Windows Server 2019 ou version ultérieure (x86_64)
  • Compilateur :
    • GCC 7.5.0 ou version ultérieure
    • Apple Clang >= 14
    • MSVC >= 2019
  • Système de compilation :

CMake

Vous devez ajouter tink-cc en tant que dépendance "in-tree". Exemple :

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.2.0.zip
  URL_HASH  SHA256=88e1442182452caa16d0954ceaf73e17b0aa30837ee6c0cc16bf0112313ce753
)
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

Si vous utilisez Bazel avec des modules, ajoutez ce qui suit dans votre fichier MODULE.bazel:

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

ESPACE DE TRAVAIL

Si vous utilisez Bazel avec des fichiers WORKSPACE, ajoutez ce qui suit dans votre fichier 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.2.0.zip"],
    strip_prefix = "tink-2.2.0",
    sha256 = "88e1442182452caa16d0954ceaf73e17b0aa30837ee6c0cc16bf0112313ce753",
)

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

Extension AWS KMS C++ Tink (tink-cc-awskms)

Le fonctionnement de Google Cloud KMS avec Tink C++ dépend des éléments suivants:

Compatibilité du service de gestion des clés AWS avec C++ de Tink:

  • C++ >= 14
  • OS:
    • UbuntuLTS 20.04 ou version ultérieure (x86_64)
    • Monterey 12.5 ou version ultérieure (macOS) (x86_64)
  • Compilateur :
    • GCC 7.5.0 ou version ultérieure
    • Apple Clang >= 14
  • Système de compilation :

Bazel

Vous devez ajouter ce qui suit au fichier WORKSPACE de votre projet:

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.2.0.zip"],
    strip_prefix = "tink-2.2.0",
    sha256 = "88e1442182452caa16d0954ceaf73e17b0aa30837ee6c0cc16bf0112313ce753",
)

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

Extension Google Cloud KMS C++ Tink (tink-cc-gcpkms)

Le fonctionnement de Google Cloud KMS avec Tink C++ dépend des éléments suivants:

Compatibilité de Tink C++ avec Google Cloud KMS:

  • C++ >= 14
  • OS:
    • UbuntuLTS 20.04 ou version ultérieure (x86_64)
    • Monterey 12.5 ou version ultérieure (macOS) (x86_64)
  • Compilateur :
    • GCC 7.5.0 ou version ultérieure
    • Apple Clang >= 14
  • Système de compilation :

Bazel

Vous devez ajouter ce qui suit au fichier WORKSPACE de votre projet:

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.2.0/tink-cc-gcpkms-2.2.0.zip"],
    strip_prefix = "tink-cc-gcpkms-2.2.0",
    sha256 = "ffb9d05c64ca28b5eb54fe79e7c3f93fad68f00e45f74f6b9ce1bd3a32b3d6fd",
)

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

Tink fournit les bibliothèques Go suivantes:

Toutes les bibliothèques Tink Go sont publiées en tant que modules Go pouvant être utilisés avec les outils Go standards ou Bazel.

Tink Go (tink-go)

Outils Go

Exécutez la commande suivante à partir du répertoire de votre projet:

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

Consultez la documentation officielle de Go.

Bazel

Si vous souhaitez utiliser Tink Go avec Bazel, utilisez bazel-gazelle. Vous pouvez l'utiliser comme suit dans votre WORKSPACE:

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

http_archive(
    name = "io_bazel_rules_go",
    integrity = "sha256-gKmCd60TEdrNg3+bFttiiHcC6fHRxMn3ltASGkbI4YQ=",
    urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip",
    ],
)

http_archive(
    name = "bazel_gazelle",
    integrity = "sha256-MpOL2hbmcABjA1R5Bj2dJMYO2o15/Uc5Vj9Q0zHLMgk=",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
        "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
    ],
)

TINK_GO_VERSION="2.2.0"
TINK_GO_SHA256="fea1ff9ed06a7302e3496587834a53f91235085e45e3de03af80b897514b7a1b"

http_archive(
    name = "com_github_tink_crypto_tink_go_v2",
    urls = ["https://github.com/tink-crypto/tink-go/releases/download/v%s/tink-go-%s.zip" % (TINK_GO_VERSION, TINK_GO_VERSION)],
    strip_prefix = "tink-go-%s" % TINK_GO_VERSION,
    sha256 = TINK_GO_SHA256,
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

load("@com_github_tink_crypto_tink_go_v2//:deps.bzl", tink_go_dependencies="go_dependencies")

tink_go_dependencies()

#######################################
#
# Your project dependencies here.
#
#######################################

go_rules_dependencies()

go_register_toolchains(version = "1.20.10")

gazelle_dependencies()

Extension AWS KMS Tink Go (tink-go-awskms)

Outils Go

Exécutez la commande suivante à partir du répertoire de votre projet:

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

Consultez la documentation officielle de Go.

Bazel

Si vous souhaitez utiliser l'extension Tink Go AWS KMS avec Bazel, utilisez bazel-gazelle. Vous pouvez l'utiliser comme suit dans votre WORKSPACE:

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

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
    ],
)

http_archive(
    name = "bazel_gazelle",
    sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
        "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
    ],
)

# [Optional]: tink-go is imported as a go_repository by tink_go_awskms_dependencies.
# this is needed only if the user wants to pin to a specific commit/version of tink-go.
# TINK_GO_VERSION="2.2.0"
# TINK_GO_SHA256="fea1ff9ed06a7302e3496587834a53f91235085e45e3de03af80b897514b7a1b"
#
# http_archive(
#     name = "com_github_tink_crypto_tink_go_v2",
#     urls = ["https://github.com/tink-crypto/tink-go/releases/download/v%s/tink-go-%s.zip" % (TINK_GO_VERSION, TINK_GO_VERSION)],
#     strip_prefix = "tink-go-%s" % TINK_GO_VERSION,
#     sha256 = TINK_GO_SHA256,
# )

http_archive(
    name = "com_github_tink_crypto_tink_go_awskms_v2",
    urls = ["https://github.com/tink-crypto/tink-go-awskms/releases/tag/v2.1.0.zip"],
    strip_prefix = "tink-go-awskms-2.1.0",
    sha256 = "2d99ea5dd0106703385cc12c7a969fca86b338a03e6694dbcf5b273011b5fdba",
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

# [Optional]: tink-go is imported as a go_repository by tink_go_awskms_dependencies.
# this is needed only if the user wants to pin to a specific commit/version of tink-go.
# load("@com_github_tink_crypto_tink_go_v2//:deps.bzl", tink_go_dependencies="go_dependencies")
#
# tink_go_dependencies()

load("@com_github_tink_crypto_tink_go_awskms_v2//:deps.bzl", "tink_go_awskms_dependencies")

tink_go_awskms_dependencies()

#######################################
#
# Your project dependencies here.
#
#######################################

go_rules_dependencies()

go_register_toolchains(version = "1.19.9")

gazelle_dependencies()

Extension Tink Go pour Google Cloud KMS (tink-go-gcpkms)

Outils Go

Exécutez la commande suivante à partir du répertoire de votre projet:

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

Consultez la documentation officielle de Go.

Bazel

Si vous souhaitez utiliser l'extension Google Cloud KMS Tink Go avec Bazel, utilisez bazel-gazelle. Vous pouvez l'utiliser comme suit dans votre WORKSPACE:

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

# Release X.25.2 from 2024-01-09.
http_archive(
    name = "com_google_protobuf",
    sha256 = "5e8e2b369a6fcaa24fada21135782eef147aec467cd286c108936a3277e88d2b",
    strip_prefix = "protobuf-25.2",
    urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v25.2/protobuf-25.2.zip"],
)

# Release from 2023-04-20
http_archive(
    name = "io_bazel_rules_go",
    sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
    ],
)

# Release from 2023-01-14
http_archive(
    name = "bazel_gazelle",
    sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
        "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
    ],
)

# [Optional]: tink-go is imported as a go_repository by tink_go_gcpkms_dependencies.
# this is needed only if the user wants to pin to a specific commit/version of tink-go.
# TINK_GO_VERSION="2.2.0"
# TINK_GO_SHA256="fea1ff9ed06a7302e3496587834a53f91235085e45e3de03af80b897514b7a1b"
#
# http_archive(
#     name = "com_github_tink_crypto_tink_go_v2",
#     urls = ["https://github.com/tink-crypto/tink-go/releases/download/v%s/tink-go-%s.zip" % (TINK_GO_VERSION, TINK_GO_VERSION)],
#     strip_prefix = "tink-go-%s" % TINK_GO_VERSION,
#     sha256 = TINK_GO_SHA256,
# )

http_archive(
    name = "com_github_tink_crypto_tink_go_gcpkms_v2",
    urls = ["https://github.com/tink-crypto/tink-go-gcpkms/download/v2.2.0/tink-go-gcpkms-2.2.0.zip"],
    strip_prefix = "tink-go-gcpkms-2.2.0",
    sha256 = "78177646479314e19c467a9eac90ab96667581b4d6ea5e485c5d2643dfc9b55b",
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

# [Optional]: tink-go is imported as a go_repository by tink_go_gcpkms_dependencies.
# this is needed only if the user wants to pin to a specific commit/version of tink-go.
# load("@com_github_tink_crypto_tink_go_v2//:deps.bzl", tink_go_dependencies="go_dependencies")
#
# tink_go_dependencies()

load("@com_github_tink_crypto_tink_go_gcpkms_v2//:deps.bzl", "tink_go_gcpkms_dependencies")

tink_go_awskms_dependencies()

#######################################
#
# Your project dependencies here.
#
#######################################

go_rules_dependencies()

go_register_toolchains(version = "1.20.13")

gazelle_dependencies()

Extension Tink Go HashiCorp Vault (tink-go-hcvault)

Outils Go

Exécutez la commande suivante à partir du répertoire de votre projet:

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

Consultez la documentation officielle de Go.

Bazel

Si vous souhaitez utiliser l'extension Tink HashiCorp Vault avec Bazel, utilisez bazel-gazelle. Vous pouvez l'utiliser comme suit dans votre WORKSPACE:

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

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
    ],
)

http_archive(
    name = "bazel_gazelle",
    sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
        "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
    ],
)

# [Optional]: tink-go is imported as a go_repository by tink_go_hcvault_dependencies.
# this is needed only if the user wants to pin to a specific commit/version of tink-go.
# TINK_GO_VERSION="2.2.0"
# TINK_GO_SHA256="fea1ff9ed06a7302e3496587834a53f91235085e45e3de03af80b897514b7a1b"
#
# http_archive(
#     name = "com_github_tink_crypto_tink_go_v2",
#     urls = ["https://github.com/tink-crypto/tink-go/releases/download/v%s/tink-go-%s.zip" % (TINK_GO_VERSION, TINK_GO_VERSION)],
#     strip_prefix = "tink-go-%s" % TINK_GO_VERSION,
#     sha256 = TINK_GO_SHA256,
# )

http_archive(
    name = "com_github_tink_crypto_tink_go_hcvault_v2",
    urls = ["https://github.com/tink-crypto/tink-go-hcvault/download/v2.1.0/tink-go-hcvault-2.1.0.zip"],
    strip_prefix = "tink-go-hcvault-2.1.0",
    sha256 = "b053b67ccc308cfe1cff92d6a74b573d058c5ffe950263026f3d46cb67653def",
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

# [Optional]: tink-go is imported as a go_repository by tink_go_hcvault_dependencies.
# this is needed only if the user wants to pin to a specific commit/version of tink-go.
# load("@com_github_tink_crypto_tink_go_v2//:deps.bzl", tink_go_dependencies="go_dependencies")
#
# tink_go_dependencies()

load("@com_github_tink_crypto_tink_go_hcvault_v2//:deps.bzl", "tink_go_hcvault_dependencies")

tink_go_awskms_dependencies()

#######################################
#
# Your project dependencies here.
#
#######################################

go_rules_dependencies()

go_register_toolchains(version = "1.20.14")

gazelle_dependencies()

Java

Tink fournit les bibliothèques Java suivantes:

La version Java de Tink est compatible avec Java 8 ou version ultérieure. Vous pouvez inclure les artefacts Java Maven de Tink dans votre projet Maven ou Gradle, ou utiliser Bazel.

Tink Android est entièrement compatible à partir du niveau d'API 24. La plupart des parties de Tink devraient fonctionner à partir du niveau d'API 21. Tink ne fonctionne pas immédiatement avec le niveau d'API 21:

  • La bibliothèque JWT nécessite le niveau d'API 24, car elle utilise des classes telles que java.util.Optional. Cette limitation peut être évitée avec le désucrage.
  • Les classes dans com.google.crypto.tink.integration.android ne sont entièrement testées qu'à partir du niveau d'API 23.
  • Certaines API de com.google.crypto.tink.streamingaead utilisent SeekableByteBufferChannel, qui n'est disponible qu'à partir du niveau d'API 24.

Pour des raisons techniques, nous ne testons Tink que sur Android sur l'infrastructure interne de Google. Nous ne prévoyons aucun problème pour cette raison, mais si vous rencontrez des problèmes, veuillez signaler un problème.

Tink Android ne nécessite aucune configuration ProGuard.

Tink Java (tink-java)

Maven

Vous pouvez inclure Tink Java et la bibliothèque Android Tink à l'aide de Maven:

<dependency>
  <groupId>com.google.crypto.tink</groupId>
  <artifactId>tink</artifactId>
  <version>1.14.0</version>
</dependency>

Si vous ciblez Android, vous pouvez utiliser tink-android à partir de Gradle à l'aide de la commande suivante:

dependencies {
  implementation 'com.google.crypto.tink:tink-android:1.14.0'
}

Bazel

Pour ajouter Tink Java en tant que dépendance, il est recommandé aux utilisateurs de Bazel d'installer l'artefact de version Maven à l'aide de l'outil rules_jvm_external dans leur fichier WORKSPACE:

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

RULES_JVM_EXTERNAL_TAG = "4.5"
RULES_JVM_EXTERNAL_SHA ="b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6"

http_archive(
    name = "rules_jvm_external",
    strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
    sha256 = RULES_JVM_EXTERNAL_SHA,
    url = "https://github.com/bazelbuild/rules_jvm_external/archive/refs/tags/%s.zip" % RULES_JVM_EXTERNAL_TAG,
)

load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")

rules_jvm_external_deps()

load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")

rules_jvm_external_setup()

load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
    artifacts = [
        "com.google.crypto.tink:tink:1.14.0",
        # ... other dependencies ...
    ],
    repositories = [
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
)

Si vous souhaitez compiler tink-java à partir de la source, par exemple pour épingler un commit spécifique, vous pouvez l'inclure en tant que http_archive dans votre fichier WORKSPACE:

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

TINK_COMMIT="27b061bb9ed1af1a6f538410bff443290e427e66"
TINK_SHA256="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

http_archive(
    name = "tink_java",
    urls = ["https://github.com/tink-crypto/tink-java/archive/%s.zip" % TINK_COMMIT],
    strip_prefix = "tink-%s" % TINK_COMMIT,
    sha256 = TINK_SHA256
)

load("@tink_java//:tink_java_deps.bzl", "TINK_MAVEN_ARTIFACTS", "tink_java_deps")

tink_java_deps()

load("@tink_java//:tink_java_deps_init.bzl", "tink_java_deps_init")

tink_java_deps_init()

# rules_jvm_external is imported and initialized by tink_java_deps and
# tink_java_deps_init.
load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
  artifacts = TINK_MAVEN_ARTIFACTS + # ... other dependencies ...
  repositories = [
      "https://maven.google.com",
      "https://repo1.maven.org/maven2",
  ],
)

Extension Java AWS KMS Tink (tink-java-awskms)

Maven

Vous pouvez inclure Tink Java et la bibliothèque Android Tink à l'aide de Maven:

<dependencies>
  <dependency>
    <groupId>com.google.crypto.tink</groupId>
    <artifactId>tink-awskms</artifactId>
    <version>1.9.1</version>
  </dependency>
</dependencies>

Bazel

Vous pouvez installer l'artefact Maven com.google.crypto.tink:tink-awskms avec com.google.crypto.tink:tink à l'aide de l'outil rules_jvm_external.

# ...

maven_install(
    artifacts = [
        "com.google.crypto.tink:tink:1.14.0",
        "com.google.crypto.tink:tink-awskms:1.9.1",
        # ... other dependencies ...
    ],
    repositories = [
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
)

Vous pouvez également l'inclure en tant que dépendance http_archive:

# ...

http_archive(
    name = "tink_java",
    urls = ["https://github.com/tink-crypto/tink-java/releases/download/v1.14.0/tink-java-1.14.0.zip"],
    strip_prefix = "tink-java-1.14.0",
    sha256 = "54316e74f759bf7562d7a63c0340c66fe63917310433e547ad6d37acb75fa7c8",
)

load("@tink_java//:tink_java_deps.bzl", "TINK_MAVEN_ARTIFACTS", "tink_java_deps")

tink_java_deps()

load("@tink_java//:tink_java_deps_init.bzl", "tink_java_deps_init")

tink_java_deps_init()

http_archive(
    name = "tink_java_awskms",
    urls = ["https://github.com/tink-crypto/tink-java-awskms/releases/download/v1.9.1/tink-java-awskms-1.9.1.zip"],
    strip_prefix = "tink-java-awskms-1.9.1",
    sha256 = "57bd15391ec949660a8d4f0b0aa3cdd1bba2938a49c2a41f64349312873bcc56",
)

load("@tink_java_awskms//:tink_java_awskms_deps.bzl", "TINK_JAVA_AWSKMS_MAVEN_ARTIFACTS")

maven_install(
    artifacts = TINK_MAVEN_ARTIFACTS + TINK_JAVA_AWSKMS_MAVEN_ARTIFACTS + [
        # ... other dependencies ...
    ],
    repositories = [
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
)

Extension Java Google Cloud KMS Tink (tink-java-gcpkms)

Maven

<dependencies>
  <dependency>
    <groupId>com.google.crypto.tink</groupId>
    <artifactId>tink-gcpkms</artifactId>
    <version>1.10.0/version>
  </dependency>
</dependencies>

Bazel

Vous pouvez installer l'artefact Maven com.google.crypto.tink:tink-gcpkms avec com.google.crypto.tink:tink à l'aide de l'outil rules_jvm_external.

# ...

maven_install(
    artifacts = [
        "com.google.crypto.tink:tink:1.14.0",
        "com.google.crypto.tink:tink-gcpkms:1.10.0",
        # ... other dependencies ...
    ],
    repositories = [
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
)

Vous pouvez également l'inclure en tant que dépendance http_archive:

# ...

http_archive(
    name = "tink_java",
    urls = ["https://github.com/tink-crypto/tink-java/releases/download/v1.14.0/tink-java-1.14.0.zip"],
    strip_prefix = "tink-java-1.14.0",
    sha256 = "54316e74f759bf7562d7a63c0340c66fe63917310433e547ad6d37acb75fa7c8",
)

load("@tink_java//:tink_java_deps.bzl", "TINK_MAVEN_ARTIFACTS", "tink_java_deps")

tink_java_deps()

load("@tink_java//:tink_java_deps_init.bzl", "tink_java_deps_init")

tink_java_deps_init()

http_archive(
    name = "tink_java_gcpkms",
    urls = ["https://github.com/tink-crypto/tink-java-gcpkms/releases/download/v1.10.0/tink-java-gcpkms-1.10.0.zip"],
    strip_prefix = "tink-java-gcpkms-1.10.0",
    sha256 = "ad85625cc4409f2f6ab13a8eef39c965501585e9323d59652cce322b3d2c09a2",
)

load("@tink_java_gcpkms//:tink_java_gcpkms_deps.bzl", "TINK_JAVA_GCPKMS_MAVEN_ARTIFACTS")

maven_install(
    artifacts =  TINK_MAVEN_ARTIFACTS + TINK_JAVA_GCPKMS_MAVEN_ARTIFACTS + [
        # ... other dependencies ...
    ],
    repositories = [
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
)

Extensions d'applications Java Tink (tink-java-apps)

Maven

<dependency>
  <groupId>com.google.crypto.tink</groupId>
  <artifactId>apps-webpush</artifactId>
  <version>1.11.0</version>
</dependency>

<dependency>
  <groupId>com.google.crypto.tink</groupId>
  <artifactId>apps-paymentmethodtoken</artifactId>
  <version>1.11.0</version>
</dependency>

<dependency>
  <groupId>com.google.crypto.tink</groupId>
  <artifactId>apps-rewardedads</artifactId>
  <version>1.11.0</version>
</dependency>

Bazel

Vous pouvez installer tous les artefacts Maven com.google.crypto.tink:apps-* à l'aide de l'outil rules_jvm_external.

# ...

maven_install(
    artifacts = [
        "com.google.crypto.tink:apps-webpush:1.11.0",
        "com.google.crypto.tink:apps-paymentmethodtoken:1.11.0",
        "com.google.crypto.tink:apps-rewardedads:1.11.0",
        # ... other dependencies ...
    ],
    repositories = [
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
)

ObjC

Consultez le guide sur GitHub.

Python

La bibliothèque Tink Python, tink-py, est compatible avec Python 3.8 ou version ultérieure sur macOS (x86-64 et ARM64), Linux (x86-64 et ARM64) et Windows (x86-64). La dernière version est la version 1.10.0. Il peut être installé localement à l'aide de Pip ou utilisé avec Bazel.

Tink Python fournit des intégrations avec AWS KMS, Google Cloud KMS et HashiCorp Vault.

PIP

Vous pouvez installer la version binaire Python Tink de votre système à partir de PyPI en exécutant la commande suivante:

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

Si un package binaire n'est pas publié pour votre environnement, pip crée automatiquement le projet à l'aide de la distribution source publiée dans PyPI. Dans ce cas, vous devez installer Bazel ou Bazelisk et installer le compilateur de tampons de protocole pour compiler le projet.

Bazel

Les utilisateurs Bazel peuvent inclure Tink Python dans leur fichier WORKSPACE comme suit:

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

Étapes suivantes

Une fois Tink configuré, poursuivez les étapes d'utilisation standards de Tink:

  • Choisir une primitive : choisissez la primitive à utiliser en fonction de votre cas d'utilisation.
  • Gérer les clés : protégez vos clés à l'aide de votre service de gestion des clés externe, générez des collections de clés et alternez vos clés.