Tink-Einrichtung

Sie können Tink aus dem Quellcode erstellen oder sprachspezifische Pakete verwenden. Die folgende Anleitung soll Ihnen den Einstieg erleichtern.

Nachdem Sie Tink installiert und eingerichtet haben, fahren Sie mit den nächsten Schritten am Ende dieser Seite fort.

C++

Tink bietet die folgenden C++-Bibliotheken:

Tink C++ (tink-cc)

Für Tink C++ gilt Folgendes:

Tink C++ unterstützt:

  • C++ >= 14
  • Betriebssystem:
    • UbuntuLTS >= 20.04 (x86_64)
    • macOS >= 12.5 Monterey (x86_64)
    • Windows Server >= 2019 (x86_64)
  • Compiler:
    • GCC >= 7.5.0
    • Apfel-Clang >= 14
    • MSVC ab 2019
  • Build-System:

CMake

Sie sollten tink-cc als integrierte Abhängigkeit hinzufügen. Beispiel:

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

Wenn Sie Bazel mit Modulen verwenden, fügen Sie der Datei MODULE.bazel Folgendes hinzu:

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

ARBEITSBEREICH

Wenn Sie Bazel mit WORKSPACE-Dateien verwenden, fügen Sie Folgendes in Ihre WORKSPACE-Datei ein:

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

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

Tink C++ Google Cloud KMS ist abhängig von:

Tink C++ AWS KMS unterstützt:

  • C++ >= 14
  • Betriebssystem:
    • UbuntuLTS >= 20.04 (x86_64)
    • macOS >= 12.5 Monterey (x86_64)
  • Compiler:
    • GCC >= 7.5.0
    • Apfel-Clang >= 14
  • Build-System:

Bazel

Fügen Sie der Datei WORKSPACE Ihres Projekts Folgendes hinzu:

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

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

Tink C++ Google Cloud KMS ist abhängig von:

Tink C++ Google Cloud KMS unterstützt:

  • C++ >= 14
  • Betriebssystem:
    • UbuntuLTS >= 20.04 (x86_64)
    • macOS >= 12.5 Monterey (x86_64)
  • Compiler:
    • GCC >= 7.5.0
    • Apfel-Clang >= 14
  • Build-System:

Bazel

Fügen Sie der Datei WORKSPACE Ihres Projekts Folgendes hinzu:

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)

Ok

Tink bietet die folgenden Go-Bibliotheken:

Alle Tink Go-Bibliotheken werden als Go-Module veröffentlicht, die mit Go-Standardtools oder Bazel verwendet werden können.

Tink Go

Go-Tools

Führen Sie den folgenden Befehl aus Ihrem Projektverzeichnis aus:

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

Weitere Informationen finden Sie in der offiziellen Go-Dokumentation.

Bazel

Wenn Sie Tink Go mit Bazel verwenden möchten, sollten Sie bazel-gazelle verwenden. Sie können es so in Ihrem WORKSPACE verwenden:

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

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

Go-Tools

Führen Sie in Ihrem Projektverzeichnis den folgenden Befehl aus:

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

Weitere Informationen finden Sie in der offiziellen Go-Dokumentation.

Bazel

Wenn Sie die Tink Go AWS KMS-Erweiterung mit Bazel verwenden möchten, sollten Sie bazel-gazelle verwenden. Sie können es so in Ihrem WORKSPACE verwenden:

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

Google Cloud KMS-Erweiterung für Tink Go (tink-go-gcpkms)

Go-Tools

Führen Sie in Ihrem Projektverzeichnis den folgenden Befehl aus:

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

Weitere Informationen finden Sie in der offiziellen Go-Dokumentation.

Bazel

Wenn Sie die Google Cloud KMS-Erweiterung Tink Go mit Bazel verwenden möchten, sollten Sie bazel-gazelle verwenden. Sie können es so in Ihrem WORKSPACE verwenden:

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

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

Go-Tools

Führen Sie in Ihrem Projektverzeichnis den folgenden Befehl aus:

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

Weitere Informationen finden Sie in der offiziellen Go-Dokumentation.

Bazel

Wenn Sie die Tink HashiCorp Vault-Erweiterung mit Bazel verwenden möchten, sollten Sie bazel-gazelle verwenden. Sie können es so in Ihrem WORKSPACE verwenden:

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 bietet die folgenden Java-Bibliotheken:

Die Java-Version von Tink unterstützt Java 8 oder höher. Sie können entweder die Maven-Artefakte von Tink in Ihrem Maven- oder Gradle-Projekt einbinden oder Bazel verwenden.

Tink Android wird ab API-Level 24 vollständig unterstützt. Die meisten Teile von Tink sollten ab API-Level 21 funktionieren. In den folgenden Bereichen ist Tink mit API-Level 21 nicht standardmäßig verfügbar:

  • Für die JWT-Bibliothek ist API-Level 24 erforderlich, da sie Klassen wie java.util.Optional verwendet. Diese Einschränkung kann durch Desugaring vermieden werden.
  • Die Klassen in com.google.crypto.tink.integration.android wurden erst ab API-Level 23 vollständig getestet.
  • Einige APIs in com.google.crypto.tink.streamingaead verwenden SeekableByteBufferChannel, das erst ab API-Level 24 verfügbar ist.

Aus technischen Gründen testen wir Tink für Android nur in der internen Infrastruktur von Google. Es sind keine Probleme durch diese Änderung zu erwarten. Sollten dennoch Probleme auftreten, melden Sie dies bitte.

Tink Android erfordert keine Proguard-Konfiguration.

Tink Java (Tink-Java)

Maven

Sie können Tink Java und die Tink Android-Bibliothek mithilfe von Maven einbinden:

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

Bei einer Ausrichtung auf Android können Sie tink-android in Gradle so verwenden:

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

Bazel

Nutzern von Bazel wird empfohlen, Tink Java als Abhängigkeit hinzuzufügen. Dazu installieren sie das Maven-Releaseartefakt mithilfe des rules_jvm_external-Tools in der WORKSPACE-Datei:

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

Wenn Sie tink-java aus der Quelle erstellen möchten, um beispielsweise ein bestimmtes Commit anzupinnen, können Sie es als http_archive in Ihre WORKSPACE-Datei aufnehmen:

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

AWS KMS-Erweiterung für Tink Java (tink-java-awskms)

Maven

Sie können Tink Java und die Tink Android-Bibliothek mithilfe von Maven einbinden:

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

Bazel

Sie können das Maven-Artefakt com.google.crypto.tink:tink-awskms zusammen mit com.google.crypto.tink:tink mithilfe des rules_jvm_external-Tools installieren.

# ...

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

Alternativ können Sie es als http_archive-Abhängigkeit einschließen:

# ...

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

Google Cloud KMS-Erweiterung für Tink Java (tink-java-gcpkms)

Maven

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

Bazel

Sie können das Maven-Artefakt com.google.crypto.tink:tink-gcpkms zusammen mit com.google.crypto.tink:tink mithilfe des rules_jvm_external-Tools installieren.

# ...

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

Alternativ können Sie es als http_archive-Abhängigkeit einschließen:

# ...

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

Tink Java Apps-Erweiterungen (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

Sie können jedes der com.google.crypto.tink:apps-*-Maven-Artefakte mit dem rules_jvm_external-Tool installieren.

# ...

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

Siehe HOWTO auf GitHub

Python

Die Tink-Python-Bibliothek tink-py unterstützt Python 3.8 oder höher unter macOS (x86-64 und ARM64), Linux (x86-64 und ARM64) und Windows (x86-64). Die neueste Version ist 1.10.0. Es kann lokal mit Pip installiert oder mit Bazel verwendet werden.

Tink Python bietet Integrationen in AWS KMS, Google Cloud KMS und HashiCorp Vault.

Pippin

Sie können den Binärrelease Tink Python aus PyPI für Ihr System installieren, indem Sie den folgenden Befehl ausführen:

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

Wenn für Ihre Umgebung kein Binärpaket veröffentlicht wurde, erstellt pip automatisch das Projekt mit der in PyPI veröffentlichten Quellverteilung. In diesem Fall müssen Bazel oder Bazelisk und der protobuf-Compiler installiert sein, um das Projekt erfolgreich zu erstellen.

Bazel

Bazel können Tink Python so in ihre WORKSPACE-Datei aufnehmen:

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

Nächste Schritte

Nachdem du Tink eingerichtet hast, fahre mit den standardmäßigen Verwendungsschritten von Tink fort:

  • Primitive auswählen: Entscheiden Sie je nach Anwendungsfall, welche Primitive verwendet werden soll.
  • Schlüssel verwalten – Schützen Sie Ihre Schlüssel mit Ihrem externen KMS, generieren Sie Schlüsselsätze und rotieren Sie Ihre Schlüssel